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

Update errorprone(-plugin) and make Unused(Variable|Method) an error

This commit is contained in:
Florian Schmaus 2019-05-07 22:58:02 +02:00
parent 68d7d738b6
commit 7f0dc72dab
46 changed files with 81 additions and 126 deletions

View file

@ -329,6 +329,21 @@ public class StanzaCollector implements AutoCloseable {
return resultQueue.size();
}
private String stringCache;
@Override
public String toString() {
if (stringCache == null) {
StringBuilder sb = new StringBuilder(128);
sb.append("Stanza Collector filter='").append(packetFilter).append('\'');
if (request != null) {
sb.append(" request='").append(request).append('\'');
}
stringCache = sb.toString();
}
return stringCache;
}
synchronized void notifyConnectionError(Exception exception) {
connectionException = exception;
notifyAll();

View file

@ -73,7 +73,6 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
of all zero bits.
*/
index = 0;
buf[index++] = 4;
buf[index++] = 1;

View file

@ -368,6 +368,7 @@ public class PacketParserUtils {
return xml;
}
@SuppressWarnings("UnusedVariable")
private static CharSequence parseContentDepthWithRoundtrip(XmlPullParser parser, int depth, boolean fullNamespaces)
throws XmlPullParserException, IOException {
XmlStringBuilder sb = new XmlStringBuilder();

View file

@ -51,6 +51,7 @@ public class MemoryLeakTestUtil {
private static final Logger LOGGER = Logger.getLogger(MemoryLeakTestUtil.class.getName());
@SuppressWarnings("UnusedVariable")
public static <M extends Manager> void noResourceLeakTest(Function<DummyConnection, M> managerSupplier)
throws XmppStringprepException, IllegalArgumentException, InterruptedException {
final int numConnections = 10;
@ -119,6 +120,7 @@ public class MemoryLeakTestUtil {
assertNull(reference);
}
@SuppressWarnings("UnusedVariable")
private static void triggerGarbageCollection() {
Object object = new Object();
WeakReference<Object> weakReference = new WeakReference<>(object);

View file

@ -31,11 +31,9 @@ import org.junit.Test;
public class StringUtilsTest {
@Test
public void testEscapeForXml() {
String input = null;
assertNull(StringUtils.escapeForXml(null));
input = "<b>";
String input = "<b>";
assertCharSequenceEquals("&lt;b&gt;", StringUtils.escapeForXml(input));
input = "\"";