1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Add errorprone check and fix found errors

Adds gradle-errorprone-plugin 0.0.8, requires Gradle 2.6.
This commit is contained in:
Florian Schmaus 2015-09-13 18:12:33 +02:00
parent 8096da43e0
commit d728204890
23 changed files with 64 additions and 44 deletions

View file

@ -55,8 +55,8 @@ public class AgentRoster {
private XMPPConnection connection;
private Jid workgroupJID;
private List<String> entries;
private List<AgentRosterListener> listeners;
private final List<String> entries = new ArrayList<String>();
private final List<AgentRosterListener> listeners = new ArrayList<>();
private final Map<Jid, Map<Resourcepart, Presence>> presenceMap = new HashMap<>();
// The roster is marked as initialized when at least a single roster packet
// has been recieved and processed.
@ -72,8 +72,6 @@ public class AgentRoster {
AgentRoster(XMPPConnection connection, Jid workgroupJID) throws NotConnectedException, InterruptedException {
this.connection = connection;
this.workgroupJID = workgroupJID;
entries = new ArrayList<String>();
listeners = new ArrayList<AgentRosterListener>();
// Listen for any roster packets.
StanzaFilter rosterFilter = new StanzaTypeFilter(AgentStatusRequest.class);
connection.addAsyncStanzaListener(new AgentStatusListener(), rosterFilter);

View file

@ -47,11 +47,10 @@ public class AgentStatusRequest extends IQ {
*/
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private Set<Item> agents;
private final Set<Item> agents = new HashSet<>();
public AgentStatusRequest() {
super(ELEMENT_NAME, NAMESPACE);
agents = new HashSet<Item>();
}
public int getAgentCount() {

View file

@ -132,7 +132,7 @@ public class OccupantsInfo extends IQ {
public static class Provider extends IQProvider<OccupantsInfo> {
@Override
public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
public OccupantsInfo parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException {
OccupantsInfo occupantsInfo = new OccupantsInfo(parser.getAttributeValue("", "roomID"));
boolean done = false;
@ -149,7 +149,7 @@ public class OccupantsInfo extends IQ {
return occupantsInfo;
}
private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException {
private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
boolean done = false;
String jid = null;
@ -167,7 +167,7 @@ public class OccupantsInfo extends IQ {
try {
joined = UTC_FORMAT.parse(parser.nextText());
} catch (ParseException e) {
new SmackException(e);
throw new SmackException(e);
}
} else if (eventType == XmlPullParser.END_TAG &&
"occupant".equals(parser.getName())) {

View file

@ -56,14 +56,7 @@ public final class QueueDetails implements ExtensionElement {
/**
* The list of users in the queue.
*/
private Set<QueueUser> users;
/**
* Creates a new QueueDetails packet
*/
private QueueDetails() {
users = new HashSet<QueueUser>();
}
private final Set<QueueUser> users = new HashSet<>();
/**
* Returns the number of users currently in the queue that are waiting to

View file

@ -50,7 +50,7 @@ import java.util.List;
*/
public class RosterExchange implements ExtensionElement {
private List<RemoteRosterEntry> remoteRosterEntries = new ArrayList<RemoteRosterEntry>();
private final List<RemoteRosterEntry> remoteRosterEntries = new ArrayList<>();
/**
* Creates a new empty roster exchange package.