1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-21 22:02:06 +01:00

Bump errorprone to 2.2.0

This commit is contained in:
Florian Schmaus 2018-03-28 15:56:04 +02:00
parent 214218c49b
commit 3132d9a224
17 changed files with 59 additions and 87 deletions

View file

@ -10,7 +10,7 @@ buildscript {
classpath 'org.kordamp:markdown-gradle-plugin:1.0.0'
classpath 'org.kordamp.gradle:clirr-gradle-plugin:0.2.2'
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1"
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.10'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
}
}
@ -160,7 +160,15 @@ allprojects {
'-Xlint:-path',
// Disable errorprone checks
'-Xep:TypeParameterUnusedInFormals:OFF',
'-Xep:TopLevel:OFF',
// Disable errorpone StringSplitter check, as it
// recommends using Splitter from Guava, which we don't
// have (nor want to use in Smack).
'-Xep:StringSplitter:OFF',
'-Xep:JdkObsolete:OFF',
// Disabled because sinttest re-uses BeforeClass from junit.
// TODO: change sinttest so that it has it's own
// BeforeClass and re-enable this check.
'-Xep:JUnit4ClassAnnotationNonStatic:OFF',
]
}
@ -191,11 +199,8 @@ allprojects {
options.encoding = 'UTF-8'
}
// Pin the errorprone version to prevent "unsupported major.minor
// version 52.0" error messages caused by the errorprone javac.
// See https://github.com/tbroyer/gradle-errorprone-plugin/issues/18 for more information.
configurations.errorprone {
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.18'
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.2.0'
}
// Make all project's 'test' target depend on javadoc, so that

View file

@ -88,6 +88,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
/**
* Holds the initial configuration used while creating the connection.
*/
@SuppressWarnings("HidingField")
private final BOSHConfiguration config;
// Some flags which provides some info about the current state.

View file

@ -18,20 +18,18 @@ package org.jivesoftware.smack;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Ignore;
import org.junit.Test;
public class SmackConfigurationTest {
/**
* Test is Smack is able to initialize itself without throwing a Throwable.
*/
@Test
public void testSmackConfiguration() {
try {
SmackConfiguration.getDefaultReplyTimeout();
} catch (Throwable t) {
fail("SmackConfiguration threw Throwable");
}
}
// As there is currently no annotation/way to run a testclass/single test in a separate VM,

View file

@ -312,6 +312,7 @@ public abstract class FileTransfer {
return amountWritten;
}
@SuppressWarnings("JavaLangClash")
public enum Error {
/**
* No error.

View file

@ -160,7 +160,7 @@ public class InBandBytestreamManagerTest extends InitExtensions {
}
@Test
public void shouldUseConfiguredStanzaType() throws SmackException, InterruptedException {
public void shouldUseConfiguredStanzaType() throws SmackException, InterruptedException, XMPPException {
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
byteStreamManager.setStanza(StanzaType.MESSAGE);
@ -173,14 +173,10 @@ public class InBandBytestreamManagerTest extends InitExtensions {
});
try {
// start In-Band Bytestream
byteStreamManager.establishSession(targetJID);
}
catch (XMPPException e) {
protocol.verifyAll();
}
protocol.verifyAll();
}
@Test

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.pubsub;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
@ -77,6 +78,7 @@ public class ConfigureFormTest extends InitExtensions
try
{
node.getNodeConfiguration();
fail();
}
catch (XMPPErrorException e)
{

View file

@ -67,13 +67,8 @@ public class DataValidationHelperTest {
}
field.setType(FormField.Type.list_multi);
try {
element.checkConsistency(field);
}
catch (ValidationConsistencyException e) {
fail("No correct check on consistency");
}
}
@Test

View file

@ -21,7 +21,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.packet.Message;
@ -343,7 +342,7 @@ public class ChatConnectionTest {
try {
chatServer.join();
} catch (InterruptedException e) {
fail();
throw new AssertionError(e);
}
waitListener.waitAndReset();
}

View file

@ -683,9 +683,9 @@ public class RosterTest extends InitSmackIm {
connection.processStanza(response);
// Verify the roster update request
assertSame("A roster set MUST contain one and only one <item/> element.",
1,
rosterRequest.getRosterItemCount());
if (rosterRequest.getRosterItemCount() != 1) {
throw new AssertionError("A roster set MUST contain one and only one <item/> element.");
}
verifyUpdateRequest(rosterRequest);
break;
}

View file

@ -180,9 +180,9 @@ public class SubscriptionPreApprovalTest extends InitSmackIm {
connection.processStanza(response);
// Verify the roster update request
assertSame("A roster set MUST contain one and only one <item/> element.",
1,
rosterRequest.getRosterItemCount());
if (rosterRequest.getRosterItemCount() != 1) {
throw new AssertionError("A roster set MUST contain one and only one <item/> element.");
}
verifyRosterUpdateRequest(rosterRequest);
break;
}

View file

@ -23,7 +23,6 @@ import static org.jivesoftware.smackx.omemo.OmemoIntegrationTestHelper.unidirect
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import org.jivesoftware.smack.SmackException;
@ -37,7 +36,6 @@ import org.jivesoftware.smackx.omemo.internal.OmemoMessageInformation;
import org.jivesoftware.smackx.omemo.listener.OmemoMessageListener;
import org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder;
import junit.framework.TestCase;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
@ -97,11 +95,8 @@ public class OmemoKeyTransportTest extends AbstractOmemoIntegrationTest {
ChatManager.getInstanceFor(alice.getConnection()).chatWith(bob.getOwnJid().asEntityBareJidIfPossible())
.send(message);
try {
// TODO: Should use 'timeout' field instead of hardcoded '10 * 1000'.
syncPoint.waitForResult(10 * 1000);
} catch (TimeoutException e) {
TestCase.fail("We MUST have received the keyTransportMessage within 10 seconds.");
}
}
@Override

View file

@ -39,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class AgentStatus implements ExtensionElement {
@SuppressWarnings("SimpleDateFormatConstant")
@SuppressWarnings("DateFormatConstant")
private static final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
static {

View file

@ -41,7 +41,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class OccupantsInfo extends IQ {
@SuppressWarnings("SimpleDateFormatConstant")
@SuppressWarnings("DateFormatConstant")
private static final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
static {

View file

@ -37,7 +37,7 @@ import org.jxmpp.jid.Jid;
*/
public class Transcripts extends IQ {
@SuppressWarnings("SimpleDateFormatConstant")
@SuppressWarnings("DateFormatConstant")
private static final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
static {
UTC_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+0"));

View file

@ -39,7 +39,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class TranscriptsProvider extends IQProvider<Transcripts> {
@SuppressWarnings("SimpleDateFormatConstant")
@SuppressWarnings("DateFormatConstant")
private static final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
static {
UTC_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+0"));

View file

@ -24,7 +24,6 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertNotSame;
import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
import java.util.HashMap;
import java.util.Iterator;
@ -66,32 +65,24 @@ public class SignalOmemoKeyUtilTest extends SmackTestSuite {
}
@Test
public void omemoIdentityKeyPairSerializationTest() {
public void omemoIdentityKeyPairSerializationTest() throws CorruptedOmemoKeyException {
IdentityKeyPair ikp = keyUtil.generateOmemoIdentityKeyPair();
byte[] bytes = keyUtil.identityKeyPairToBytes(ikp);
assertNotNull("serialized identityKeyPair must not be null.",
bytes);
assertNotSame("serialized identityKeyPair must not be of length 0.",
0, bytes.length);
try {
IdentityKeyPair ikp2 = keyUtil.identityKeyPairFromBytes(bytes);
assertTrue("Deserialized IdentityKeyPairs PublicKey must equal the originals one.",
ikp.getPublicKey().equals(ikp2.getPublicKey()));
} catch (CorruptedOmemoKeyException e) {
fail("Caught exception while deserializing IdentityKeyPair.");
}
}
@Test
public void omemoIdentityKeySerializationTest() {
public void omemoIdentityKeySerializationTest() throws CorruptedOmemoKeyException {
IdentityKey k = keyUtil.generateOmemoIdentityKeyPair().getPublicKey();
try {
assertEquals("Deserialized IdentityKey must equal the original one.",
k, keyUtil.identityKeyFromBytes(keyUtil.identityKeyToBytes(k)));
} catch (CorruptedOmemoKeyException e) {
fail("Caught exception while serializing and deserializing identityKey (" + e + "): " + e.getMessage());
}
assertEquals("Deserialized IdentityKey must equal the original one.", k,
keyUtil.identityKeyFromBytes(keyUtil.identityKeyToBytes(k)));
}
@Test
@ -103,16 +94,12 @@ public class SignalOmemoKeyUtilTest extends SmackTestSuite {
}
@Test
public void generateOmemoSignedPreKeyTest() {
public void generateOmemoSignedPreKeyTest() throws CorruptedOmemoKeyException {
IdentityKeyPair ikp = keyUtil.generateOmemoIdentityKeyPair();
try {
SignedPreKeyRecord spk = keyUtil.generateOmemoSignedPreKey(ikp, 1);
assertNotNull("SignedPreKey must not be null.", spk);
assertEquals("SignedPreKeyId must match.", 1, spk.getId());
assertEquals("singedPreKeyId must match here also.", 1, keyUtil.signedPreKeyIdFromKey(spk));
} catch (CorruptedOmemoKeyException e) {
fail("Caught an exception while generating signedPreKey (" + e + "): " + e.getMessage());
}
}
@Test
@ -124,25 +111,17 @@ public class SignalOmemoKeyUtilTest extends SmackTestSuite {
}
@Test
public void addressToDeviceTest() {
public void addressToDeviceTest() throws XmppStringprepException {
SignalProtocolAddress address = new SignalProtocolAddress("test@server.tld", 1337);
try {
OmemoDevice device = keyUtil.addressAsOmemoDevice(address);
assertEquals(device, new OmemoDevice(JidCreate.bareFrom("test@server.tld"), 1337));
} catch (XmppStringprepException e) {
fail("Could not convert address to device: " + e + " " + e.getMessage());
}
}
@Test
public void deviceToAddressTest() {
try {
public void deviceToAddressTest() throws XmppStringprepException {
OmemoDevice device = new OmemoDevice(JidCreate.bareFrom("test@server.tld"), 1337);
SignalProtocolAddress address = keyUtil.omemoDeviceAsAddress(device);
assertEquals(address, new SignalProtocolAddress("test@server.tld", 1337));
} catch (XmppStringprepException e) {
fail("Could not convert device to address: " + e + " " + e.getMessage());
}
}
@Test

View file

@ -293,6 +293,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
*/
private final Set<StanzaFilter> requestAckPredicates = new LinkedHashSet<>();
@SuppressWarnings("HidingField")
private final XMPPTCPConnectionConfiguration config;
/**