mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-17 17:52:06 +01:00
Bump errorprone to 2.2.0
This commit is contained in:
parent
214218c49b
commit
3132d9a224
17 changed files with 59 additions and 87 deletions
19
build.gradle
19
build.gradle
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
SmackConfiguration.getDefaultReplyTimeout();
|
||||
}
|
||||
|
||||
// As there is currently no annotation/way to run a testclass/single test in a separate VM,
|
||||
|
|
|
@ -312,6 +312,7 @@ public abstract class FileTransfer {
|
|||
return amountWritten;
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavaLangClash")
|
||||
public enum Error {
|
||||
/**
|
||||
* No error.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
// start In-Band Bytestream
|
||||
byteStreamManager.establishSession(targetJID);
|
||||
|
||||
protocol.verifyAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -67,12 +67,7 @@ public class DataValidationHelperTest {
|
|||
}
|
||||
|
||||
field.setType(FormField.Type.list_multi);
|
||||
try {
|
||||
element.checkConsistency(field);
|
||||
}
|
||||
catch (ValidationConsistencyException e) {
|
||||
fail("No correct check on consistency");
|
||||
}
|
||||
element.checkConsistency(field);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
syncPoint.waitForResult(10 * 1000);
|
||||
} catch (TimeoutException e) {
|
||||
TestCase.fail("We MUST have received the keyTransportMessage within 10 seconds.");
|
||||
}
|
||||
// TODO: Should use 'timeout' field instead of hardcoded '10 * 1000'.
|
||||
syncPoint.waitForResult(10 * 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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.",
|
||||
|
||||
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());
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -124,25 +111,17 @@ public class SignalOmemoKeyUtilTest extends SmackTestSuite {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void addressToDeviceTest() {
|
||||
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());
|
||||
}
|
||||
public void addressToDeviceTest() throws XmppStringprepException {
|
||||
SignalProtocolAddress address = new SignalProtocolAddress("test@server.tld", 1337);
|
||||
OmemoDevice device = keyUtil.addressAsOmemoDevice(address);
|
||||
assertEquals(device, new OmemoDevice(JidCreate.bareFrom("test@server.tld"), 1337));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deviceToAddressTest() {
|
||||
try {
|
||||
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());
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -293,6 +293,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
*/
|
||||
private final Set<StanzaFilter> requestAckPredicates = new LinkedHashSet<>();
|
||||
|
||||
@SuppressWarnings("HidingField")
|
||||
private final XMPPTCPConnectionConfiguration config;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue