1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +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

@ -75,7 +75,6 @@ class Socks5Client {
*/
public Socket getSocket(int timeout) throws IOException, XMPPErrorException, InterruptedException,
TimeoutException, SmackException, XMPPException {
// wrap connecting in future for timeout
FutureTask<Socket> futureTask = new FutureTask<Socket>(new Callable<Socket>() {

View file

@ -38,7 +38,7 @@ public class OfflineMessageRequest extends IQ {
public static final String ELEMENT = "offline";
public static final String NAMESPACE = "http://jabber.org/protocol/offline";
private List<Item> items = new ArrayList<Item>();
private final List<Item> items = new ArrayList<>();
private boolean purge = false;
private boolean fetch = false;

View file

@ -70,7 +70,7 @@ public class DataForm implements ExtensionElement {
private Type type;
private String title;
private List<String> instructions = new ArrayList<String>();
private final List<String> instructions = new ArrayList<>();
private ReportedData reportedData;
private final List<Item> items = new ArrayList<Item>();
private final Map<String, FormField> fields = new LinkedHashMap<>();
@ -197,7 +197,10 @@ public class DataForm implements ExtensionElement {
* @param instructions list of instructions that explain how to fill out the form.
*/
public void setInstructions(List<String> instructions) {
this.instructions = instructions;
synchronized (this.instructions) {
this.instructions.clear();
this.instructions.addAll(instructions);
}
}
/**

View file

@ -40,7 +40,7 @@ public class XHTMLExtension implements ExtensionElement {
public static final String ELEMENT = "html";
public static final String NAMESPACE = "http://jabber.org/protocol/xhtml-im";
private List<CharSequence> bodies = new ArrayList<CharSequence>();
private final List<CharSequence> bodies = new ArrayList<>();
/**
* Returns the XML element name of the extension sub-packet root element.

View file

@ -173,6 +173,7 @@ public final class Socks5TestProxy {
* @param digest identifying the connection
* @return socket or null if there is no socket for the given digest
*/
@SuppressWarnings("WaitNotInLoop")
public Socket getSocket(String digest) {
synchronized(this) {
if (!startupComplete) {
@ -180,13 +181,12 @@ public final class Socks5TestProxy {
wait(5000);
} catch (InterruptedException e) {
LOGGER.log(Level.SEVERE, "exception", e);
} finally {
if (!startupComplete) {
throw new IllegalStateException("Startup of Socks5TestProxy failed within 5 seconds");
}
}
}
}
if (!startupComplete) {
throw new IllegalStateException("Startup of Socks5TestProxy failed within 5 seconds");
}
return this.connectionMap.get(digest);
}