Bump "Error Prone" to 2.3.2

and gradle-errorprone-plugin to 0.6.
fixDocuLinks
Florian Schmaus 4 years ago
parent ec7badfda0
commit b7ea226c56
  1. 12
      build.gradle
  2. 4
      smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
  3. 1
      smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java
  4. 6
      smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaIdFilter.java
  5. 3
      smack-core/src/main/java/org/jivesoftware/smack/parsing/StandardExtensionElementProvider.java
  6. 8
      smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java
  7. 2
      smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1Mechanism.java
  8. 2
      smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramSha1PlusMechanism.java
  9. 5
      smack-core/src/test/java/org/jivesoftware/smack/parsing/StandardExtensionElementParserTest.java
  10. 2
      smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
  11. 5
      smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/element/HashElement.java
  12. 1
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/Thing.java
  13. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/IoTDiscoveryManager.java
  14. 5
      smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Range.java
  15. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamQueryIQ.java
  16. 6
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamQueryIQProviderTest.java
  17. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/PagingTest.java
  18. 2
      smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java
  19. 2
      smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
  20. 26
      smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/packet/Bytestream.java
  21. 2
      smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/provider/BytestreamsProvider.java
  22. 4
      smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java
  23. 7
      smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java
  24. 8
      smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/element/JingleIBBTransport.java
  25. 2
      smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
  26. 2
      smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java
  27. 2
      smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java
  28. 24
      smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java
  29. 2
      smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java
  30. 4
      smack-extensions/src/test/java/org/jivesoftware/smackx/message_correct/MessageCorrectExtensionTest.java
  31. 6
      smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterPacket.java
  32. 2
      smack-im/src/test/java/org/jivesoftware/smack/im/InitSmackIm.java
  33. 5
      smack-im/src/test/java/org/jivesoftware/smack/roster/RosterVersioningTest.java
  34. 1
      smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/AbstractSmackIntTest.java
  35. 5
      smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
  36. 4
      smack-integration-test/src/main/java/org/jivesoftware/smackx/xdata/FormTest.java
  37. 3
      smack-java7/src/main/java/org/jivesoftware/smack/util/stringencoder/java7/Base64.java
  38. 4
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java
  39. 6
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
  40. 4
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java
  41. 2
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/ScreenShareSession.java
  42. 2
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedResolver.java
  43. 2
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java
  44. 10
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICEResolver.java
  45. 2
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java
  46. 6
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java
  47. 10
      smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
  48. 6
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java
  49. 14
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/history/AgentChatHistory.java
  50. 4
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest.java
  51. 2
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MonitorPacket.java
  52. 14
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java
  53. 4
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java
  54. 6
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java
  55. 8
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/ChatSettings.java
  56. 2
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java
  57. 8
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/OfflineSettings.java
  58. 4
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/SearchSettings.java
  59. 4
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/SoundSettings.java
  60. 6
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/WorkgroupProperties.java
  61. 2
      smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/MetaDataUtils.java
  62. 1
      smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java
  63. 2
      smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java
  64. 4
      smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PublicKeysListElement.java
  65. 2
      smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java

@ -10,12 +10,12 @@ 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.13'
}
}
plugins {
id 'ru.vyarus.animalsniffer' version '1.4.5'
id 'net.ltgt.errorprone' version '0.6'
}
apply plugin: 'org.kordamp.gradle.markdown'
@ -156,9 +156,8 @@ allprojects {
// e.g. JAVA7_HOME. See SMACK-651.
'-Xlint:-options',
'-Werror',
// Needed because since adding gradle-errorprone-plugin
// See https://github.com/tbroyer/gradle-errorprone-plugin/issues/15
'-Xlint:-path',
]
options.errorprone.errorproneArgs = [
// Disable errorprone checks
'-Xep:TypeParameterUnusedInFormals:OFF',
// Disable errorpone StringSplitter check, as it
@ -170,6 +169,8 @@ allprojects {
// TODO: change sinttest so that it has it's own
// BeforeClass and re-enable this check.
'-Xep:JUnit4ClassAnnotationNonStatic:OFF',
// Disabled but should be re-enabled at some point
//'-Xep:InconsistentCapitalization:OFF',
]
}
@ -211,7 +212,8 @@ allprojects {
}
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.2.0'
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
}
// Make all project's 'test' target depend on javadoc, so that

@ -1128,8 +1128,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// If the IQ stanza is of type "get" or "set" with no registered IQ request handler, then answer an
// IQ of type 'error' with condition 'service-unavailable'.
ErrorIQ errorIQ = IQ.createErrorResponse(iq, StanzaError.getBuilder((
replyCondition)));
ErrorIQ errorIQ = IQ.createErrorResponse(iq, StanzaError.getBuilder(
replyCondition));
try {
sendStanza(errorIQ);
}

@ -55,6 +55,7 @@ public class SynchronizationPoint<E extends Exception> {
/**
* Initialize (or reset) this synchronization point.
*/
@SuppressWarnings("LockNotBeforeTry")
public void init() {
connectionLock.lock();
state = State.Initial;

@ -41,10 +41,10 @@ public class StanzaIdFilter implements StanzaFilter {
/**
* Creates a new stanza ID filter using the specified stanza ID.
*
* @param stanzaID the stanza ID to filter for.
* @param stanzaId the stanza ID to filter for.
*/
public StanzaIdFilter(String stanzaID) {
this.stanzaId = StringUtils.requireNotNullNorEmpty(stanzaID, "Stanza ID must not be null nor empty.");
public StanzaIdFilter(String stanzaId) {
this.stanzaId = StringUtils.requireNotNullNorEmpty(stanzaId, "Stanza ID must not be null nor empty.");
}
@Override

@ -21,7 +21,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.packet.StandardExtensionElement.Builder;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.StringUtils;
@ -46,7 +45,7 @@ public class StandardExtensionElementProvider extends ExtensionElementProvider<S
// we are parsing here.
String name = parser.getName();
String namespace = parser.getNamespace();
Builder builder = StandardExtensionElement.builder(name, namespace);
StandardExtensionElement.Builder builder = StandardExtensionElement.builder(name, namespace);
final int namespaceCount = parser.getNamespaceCount(initialDepth);
final int attributeCount = parser.getAttributeCount();
final Map<String, String> attributes = new LinkedHashMap<>(namespaceCount + attributeCount);

@ -102,7 +102,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
fill(in, buf, 2);
boolean check = false;
switch ((buf[1]) & 0xff) {
switch (buf[1] & 0xff) {
case 0: // NO AUTHENTICATION REQUIRED
check = true;
break;
@ -132,13 +132,13 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
*/
index = 0;
buf[index++] = 1;
buf[index++] = (byte) (user.length());
buf[index++] = (byte) user.length();
byte[] userBytes = user.getBytes(StringUtils.UTF8);
System.arraycopy(userBytes, 0, buf, index,
user.length());
index += user.length();
byte[] passwordBytes = passwd.getBytes(StringUtils.UTF8);
buf[index++] = (byte) (passwordBytes.length);
buf[index++] = (byte) passwordBytes.length;
System.arraycopy(passwordBytes, 0, buf, index,
passwd.length());
index += passwd.length();
@ -207,7 +207,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
byte[] hostb = host.getBytes(StringUtils.UTF8);
int len = hostb.length;
buf[index++] = 3; // DOMAINNAME
buf[index++] = (byte) (len);
buf[index++] = (byte) len;
System.arraycopy(hostb, 0, buf, index, len);
index += len;
buf[index++] = (byte) (port >>> 8);

@ -36,7 +36,7 @@ public class SCRAMSHA1Mechanism extends ScramMechanism {
return MAC.hmacsha1(key, str);
}
};
NAME = (new SCRAMSHA1Mechanism()).getName();
NAME = new SCRAMSHA1Mechanism().getName();
}
public static final String NAME;

@ -21,7 +21,7 @@ import org.jivesoftware.smack.sasl.SASLMechanism;
public class ScramSha1PlusMechanism extends ScramPlusMechanism {
static {
NAME = (new ScramSha1PlusMechanism()).getName();
NAME = new ScramSha1PlusMechanism().getName();
}
public static final String NAME;

@ -20,7 +20,6 @@ import static org.jivesoftware.smack.util.PacketParserUtils.getParserFor;
import static org.junit.Assert.assertEquals;
import org.jivesoftware.smack.packet.StandardExtensionElement;
import org.jivesoftware.smack.packet.StandardExtensionElement.Builder;
import org.junit.Test;
@ -28,7 +27,7 @@ public class StandardExtensionElementParserTest {
@Test
public void buildAndParse() throws Exception {
Builder builder = StandardExtensionElement.builder("foo", "ns1");
StandardExtensionElement.Builder builder = StandardExtensionElement.builder("foo", "ns1");
builder.addAttribute("attr1", "attr1-value");
builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build());
builder.addElement("another-element", "another-element-text");
@ -53,7 +52,7 @@ public class StandardExtensionElementParserTest {
@Test
public void buildWithAttrNamespacesAndParse() throws Exception {
Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
StandardExtensionElement.Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
builder.addAttribute("xmlns:ns2", "ns2-value");
builder.addAttribute("ns2:bar", "bar-ns2-value");
final String elementString = builder.build().toXML(null).toString();

@ -813,7 +813,7 @@ public class PacketParserUtilsTest {
final String stanza = "<iq type='result' to='foo@bar.com' from='baz.com' id='42'/>";
XmlPullParser parser = TestUtils.getParser(stanza, "iq");
CharSequence content = PacketParserUtils.parseContent(parser);
assertEquals("", content);
assertEquals("", content.toString());
}
@Test

@ -112,7 +112,10 @@ public class HashElement implements ExtensionElement {
if (other == null || !(other instanceof HashElement)) {
return false;
}
return this.hashCode() == other.hashCode();
HashElement otherHashElement = (HashElement) other;
return this.getAlgorithm() == otherHashElement.getAlgorithm() &&
this.getHashB64().equals(otherHashElement.getHashB64());
}
@Override

@ -79,6 +79,7 @@ public final class Thing {
private String toStringCache;
@SuppressWarnings("ObjectToString")
@Override
public String toString() {
if (toStringCache == null) {

@ -149,6 +149,8 @@ public final class IoTDiscoveryManager extends Manager {
connection.registerIQRequestHandler(new AbstractIqRequestHandler(IoTDisowned.ELEMENT, IoTDisowned.NAMESPACE,
IQ.Type.set, Mode.sync) {
@SuppressWarnings("ObjectToString")
@Override
public IQ handleIQRequest(IQ iqRequest) {
if (!isRegistry(iqRequest.getFrom())) {

@ -125,7 +125,10 @@ public class Range implements NamedElement {
return false;
}
return this.hashCode() == other.hashCode();
Range otherRange = (Range) other;
return this.getOffset() == otherRange.getOffset() &&
this.getLength() == otherRange.getLength() &&
this.getHash().equals(otherRange.getHash());
}
@Override

@ -92,7 +92,7 @@ public class MamQueryIQ extends IQ {
if (field == null) {
throw new IllegalArgumentException("If a data form is given it must posses a hidden form type field");
}
if (!field.getValues().get(0).equals(MamElements.NAMESPACE)) {
if (!field.getValues().get(0).toString().equals(MamElements.NAMESPACE)) {
throw new IllegalArgumentException(
"Value of the hidden form type field must be '" + MamElements.NAMESPACE + "'");
}

@ -63,8 +63,8 @@ public class MamQueryIQProviderTest {
List<FormField> fields1 = dataForm1.getFields();
Assert.assertEquals(fields1.get(0).getType(), FormField.Type.hidden);
Assert.assertEquals(fields1.get(1).getType(), FormField.Type.text_single);
Assert.assertEquals(fields1.get(1).getValues().get(0), "Where arth thou, my Juliet?");
Assert.assertEquals(fields1.get(2).getValues().get(0), "{http://jabber.org/protocol/mood}mood/lonely");
Assert.assertEquals(fields1.get(1).getValues().get(0).toString(), "Where arth thou, my Juliet?");
Assert.assertEquals(fields1.get(2).getValues().get(0).toString(), "{http://jabber.org/protocol/mood}mood/lonely");
// example2
IQ iq2 = PacketParserUtils.parseStanza(exampleMamQueryIQ2);
@ -77,7 +77,7 @@ public class MamQueryIQProviderTest {
Assert.assertEquals(dataForm2.getType(), DataForm.Type.form);
List<FormField> fields2 = dataForm2.getFields();
Assert.assertEquals(fields2.get(0).getValues().get(0), "urn:xmpp:mam:1");
Assert.assertEquals(fields2.get(0).getValues().get(0).toString(), "urn:xmpp:mam:1");
Assert.assertTrue(fields2.get(0).getValues().size() == 1);
Assert.assertEquals(fields2.get(1).getType(), FormField.Type.jid_single);
Assert.assertEquals(fields2.get(2).getType(), FormField.Type.text_single);

@ -45,7 +45,7 @@ public class PagingTest extends MamTest {
mamQueryIQ.addExtension(rsmSet);
Assert.assertEquals(mamQueryIQ.getDataForm(), dataForm);
Assert.assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0), "urn:xmpp:mam:1");
Assert.assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0).toString(), "urn:xmpp:mam:1");
Assert.assertEquals(mamQueryIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), pagingStanza);
}

@ -490,7 +490,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
private static String getNextSessionID() {
StringBuilder buffer = new StringBuilder();
buffer.append(SESSION_ID_PREFIX);
buffer.append(Math.abs(randomGenerator.nextLong()));
buffer.append(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
return buffer.toString();
}

@ -732,7 +732,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
private static String getNextSessionID() {
StringBuilder buffer = new StringBuilder();
buffer.append(SESSION_ID_PREFIX);
buffer.append(Math.abs(randomGenerator.nextLong()));
buffer.append(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
return buffer.toString();
}

@ -269,9 +269,9 @@ public class Bytestream extends IQ {
public static String ELEMENTNAME = "streamhost";
private final Jid JID;
private final Jid jid;
private final String addy;
private final String address;
private final int port;
@ -282,13 +282,13 @@ public class Bytestream extends IQ {
/**
* Default constructor.
*
* @param JID The JID of the stream host.
* @param jid The JID of the stream host.
* @param address The internet address of the stream host.
* @param port port of the stream host.
*/
public StreamHost(final Jid JID, final String address, int port) {
this.JID = Objects.requireNonNull(JID, "StreamHost JID must not be null");
this.addy = StringUtils.requireNotNullNorEmpty(address, "StreamHost address must not be null");
public StreamHost(final Jid jid, final String address, int port) {
this.jid = Objects.requireNonNull(jid, "StreamHost JID must not be null");
this.address = StringUtils.requireNotNullNorEmpty(address, "StreamHost address must not be null");
this.port = port;
}
@ -298,7 +298,7 @@ public class Bytestream extends IQ {
* @return Returns the JID of the stream host.
*/
public Jid getJID() {
return JID;
return jid;
}
/**
@ -307,7 +307,7 @@ public class Bytestream extends IQ {
* @return Returns the internet address of the stream host.
*/
public String getAddress() {
return addy;
return address;
}
/**
@ -349,15 +349,15 @@ public class Bytestream extends IQ {
public static String ELEMENTNAME = "streamhost-used";
private final Jid JID;
private final Jid jid;
/**
* Default constructor.
*
* @param JID The JID of the selected stream host.
* @param jid The JID of the selected stream host.
*/
public StreamHostUsed(final Jid JID) {
this.JID = JID;
public StreamHostUsed(final Jid jid) {
this.jid = jid;
}
/**
@ -366,7 +366,7 @@ public class Bytestream extends IQ {
* @return Returns the JID of the selected stream host.
*/
public Jid getJID() {
return JID;
return jid;
}
@Override

@ -89,7 +89,7 @@ public class BytestreamsProvider extends IQProvider<Bytestream> {
if (mode == null) {
toReturn.setMode(Mode.tcp);
} else {
toReturn.setMode((Bytestream.Mode.fromName(mode)));
toReturn.setMode(Bytestream.Mode.fromName(mode));
}
toReturn.setSessionID(id);
return toReturn;

@ -268,7 +268,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
* attributes.
*
*/
public static class Identity implements Comparable<Identity>, TypedCloneable<Identity> {
public static final class Identity implements Comparable<Identity>, TypedCloneable<Identity> {
private final String category;
private final String type;
@ -482,7 +482,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
* as well as specific feature types of interest, if any (e.g., for the purpose of feature
* negotiation).
*/
public static class Feature implements TypedCloneable<Feature> {
public static final class Feature implements TypedCloneable<Feature> {
private final String variable;

@ -260,7 +260,7 @@ public final class FileTransferNegotiator extends Manager {
public static String getNextStreamID() {
StringBuilder buffer = new StringBuilder();
buffer.append(STREAM_INIT_PREFIX);
buffer.append(Math.abs(randomGenerator.nextLong()));
buffer.append(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
return buffer.toString();
}
@ -342,10 +342,11 @@ public final class FileTransferNegotiator extends Manager {
boolean isByteStream = false;
boolean isIBB = false;
for (CharSequence variable : field.getValues()) {
if (variable.equals(Bytestream.NAMESPACE) && !IBB_ONLY) {
String variableString = variable.toString();
if (variableString.equals(Bytestream.NAMESPACE) && !IBB_ONLY) {
isByteStream = true;
}
else if (variable.equals(DataPacketExtension.NAMESPACE)) {
else if (variableString.equals(DataPacketExtension.NAMESPACE)) {
isIBB = true;
}
}

@ -81,7 +81,13 @@ public class JingleIBBTransport extends JingleContentTransport {
return false;
}
return this == other || this.hashCode() == other.hashCode();
if (this == other) {
return true;
}
JingleIBBTransport otherTransport = (JingleIBBTransport) other;
return this.getSessionId().equals(otherTransport.getSessionId()) &&
this.getBlockSize() == otherTransport.getBlockSize();
}
@Override

@ -216,7 +216,7 @@ public final class PubSubManager extends Manager {
FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName());
if (nodeTypeField != null)
isLeafNode = nodeTypeField.getValues().get(0).equals(NodeType.leaf.toString());
isLeafNode = nodeTypeField.getValues().get(0).toString().equals(NodeType.leaf.toString());
}
// Errors will cause exceptions in getReply, so it only returns

@ -84,7 +84,7 @@ import org.jxmpp.jid.EntityBareJid;
*
* @author Kirill Maximov (kir@maxkir.com)
*/
public class VCard extends IQ {
public final class VCard extends IQ {
public static final String ELEMENT = "vCard";
public static final String NAMESPACE = "vcard-temp";

@ -480,7 +480,7 @@ public class FormField implements NamedElement {
*
* @author Gaston Dombiak
*/
public static class Option implements NamedElement {
public static final class Option implements NamedElement {
public static final String ELEMENT = "option";

@ -133,11 +133,11 @@ public abstract class ValidateElement implements ExtensionElement {
/**
* Basic validate element constructor.
* @param dataType
* @param datatype
* @see #getDatatype()
*/
public BasicValidateElement(String dataType) {
super(dataType);
public BasicValidateElement(String datatype) {
super(datatype);
}
@Override
@ -176,11 +176,11 @@ public abstract class ValidateElement implements ExtensionElement {
/**
* Open validate element constructor.
* @param dataType
* @param datatype
* @see #getDatatype()
*/
public OpenValidateElement(String dataType) {
super(dataType);
public OpenValidateElement(String datatype) {
super(datatype);
}
@Override
@ -218,14 +218,14 @@ public abstract class ValidateElement implements ExtensionElement {
/**
* Range validate element constructor.
* @param dataType
* @param datatype
* @param min the minimum allowable value. This attribute is OPTIONAL. The value depends on the datatype in use.
* @param max the maximum allowable value. This attribute is OPTIONAL. The value depends on the datatype in use.
* @see #getDatatype()
*
*/
public RangeValidateElement(String dataType, String min, String max) {
super(dataType);
public RangeValidateElement(String datatype, String min, String max) {
super(datatype);
this.min = min;
this.max = max;
}
@ -283,12 +283,12 @@ public abstract class ValidateElement implements ExtensionElement {
/**
* Regex validate element.
* @param dataType
* @param datatype
* @param regex
* @see #getDatatype()
*/
public RegexValidateElement(String dataType, String regex) {
super(dataType);
public RegexValidateElement(String datatype, String regex) {
super(datatype);
this.regex = regex;
}

@ -22,7 +22,7 @@ import org.jivesoftware.smack.test.util.SmackTestSuite;
public class InitExtensions extends SmackTestSuite {
static {
(new ExtensionsInitializer()).initialize();
new ExtensionsInitializer().initialize();
}
}

@ -42,11 +42,11 @@ public class MessageCorrectExtensionTest {
Message initialMessage = PacketParserUtils.parseStanza(initialMessageXml);
MessageCorrectExtension messageCorrectExtension = new MessageCorrectExtension(idInitialMessage);
Assert.assertEquals(messageCorrectExtension.toXML(null).toString(), messageCorrectionXml);
Assert.assertEquals(messageCorrectExtension.toXML(null).toString(), messageCorrectionXml.toString());
initialMessage.addExtension(messageCorrectExtension);
Assert.assertEquals(initialMessage.toXML(null), expectedXml);
Assert.assertEquals(initialMessage.toXML(null), expectedXml.toString());
}
}

@ -39,7 +39,7 @@ import org.jxmpp.jid.BareJid;
* @author Matt Tucker
* @author Florian Schmaus
*/
public class RosterPacket extends IQ {
public final class RosterPacket extends IQ {
public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = "jabber:iq:roster";
@ -110,7 +110,7 @@ public class RosterPacket extends IQ {
* the groups the roster item belongs to.
*/
// TODO Make this class immutable.
public static class Item implements NamedElement {
public static final class Item implements NamedElement {
/**
* The constant value "{@value}".
@ -295,7 +295,7 @@ public class RosterPacket extends IQ {
final int prime = 31;
int result = 1;
result = prime * result + ((groupNames == null) ? 0 : groupNames.hashCode());
result = prime * result + ((subscriptionPending) ? 0 : 1);
result = prime * result + (subscriptionPending ? 0 : 1);
result = prime * result + ((itemType == null) ? 0 : itemType.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((jid == null) ? 0 : jid.hashCode());

@ -19,7 +19,7 @@ package org.jivesoftware.smack.im;
public class InitSmackIm {
static {
(new SmackImInitializer()).initialize();
new SmackImInitializer().initialize();
}
}

@ -26,7 +26,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
import org.jivesoftware.smack.ConnectionConfiguration.Builder;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
@ -71,7 +71,7 @@ public class RosterVersioningTest {
DirectoryRosterStore store = DirectoryRosterStore.init(tmpFolder.newFolder("store"));
populateStore(store);
Builder<?, ?> builder = DummyConnection.getDummyConfigurationBuilder();
ConnectionConfiguration.Builder<?, ?> builder = DummyConnection.getDummyConfigurationBuilder();
connection = new DummyConnection(builder.build());
connection.connect();
connection.login();
@ -175,6 +175,7 @@ public class RosterVersioningTest {
/**
* Test roster versioning with roster pushes.
*/
@SuppressWarnings("UndefinedEquals")
@Test(timeout = 5000)
public void testRosterVersioningWithCachedRosterAndPushes() throws Throwable {
answerWithEmptyRosterResult();

@ -66,6 +66,7 @@ public abstract class AbstractSmackIntTest {
}
}
@SuppressWarnings("ThreadPriorityCheck")
protected void waitUntilTrue(Condition condition) throws TimeoutException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final long deadline = System.currentTimeMillis() + timeout;
do {

@ -51,7 +51,6 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.debugger.ConsoleDebugger;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration.Builder;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.debugger.EnhancedDebugger;
@ -221,7 +220,7 @@ public class SmackIntegrationTestFramework {
continue;
}
Class<?> retClass = method.getReturnType();
if (!(retClass.equals(Void.TYPE))) {
if (!retClass.equals(Void.TYPE)) {
LOGGER.warning("SmackIntegrationTest annotation on method that does not return void");
continue;
}
@ -560,7 +559,7 @@ public class SmackIntegrationTestFramework {
accountPassword = StringUtils.insecureRandomString(16);
}
Builder builder = getConnectionConfigurationBuilder(config);
XMPPTCPConnectionConfiguration.Builder builder = getConnectionConfigurationBuilder(config);
builder.setUsernameAndPassword(accountUsername, accountPassword)
.setResource(middlefix + '-' + testRunResult.testRunId);

@ -148,11 +148,11 @@ public class FormTest extends AbstractSmackIntegrationTest {
assertNotNull(completedForm.getField("name"));
assertNotNull(completedForm.getField("description"));
assertEquals(
completedForm.getField("name").getValues().get(0),
completedForm.getField("name").getValues().get(0).toString(),
"Credit card number invalid");
assertNotNull(completedForm.getField("time"));
assertNotNull(completedForm.getField("age"));
assertEquals("The age is bad", "20", completedForm.getField("age").getValues().get(0));
assertEquals("The age is bad", "20", completedForm.getField("age").getValues().get(0).toString());
}
finally {

@ -375,6 +375,7 @@ public final class Base64
* @return the <var>destination</var> array
* @since 1.3
*/
@SuppressWarnings("UnnecessaryParentheses")
private static byte[] encode3to4(
byte[] source, int srcOffset, int numSigBytes,
byte[] destination, int destOffset, int options )
@ -600,6 +601,7 @@ public final class Base64
* @see Base64#DONT_BREAK_LINES
* @since 2.0
*/
@SuppressWarnings("UnnecessaryParentheses")
public static String encodeBytes( byte[] source, int off, int len, int options )
{
// Isolate options
@ -727,6 +729,7 @@ public final class Base64
* @return the number of decoded bytes converted
* @since 1.3
*/
@SuppressWarnings("UnnecessaryParentheses")
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options )
{
byte[] DECODABET = getDecodabet( options );

@ -230,12 +230,12 @@ public class ContentNegotiator extends JingleNegotiator {
boolean result = true;
MediaNegotiator mediaNeg = getMediaNegotiator();
if ((mediaNeg == null) || (!mediaNeg.isFullyEstablished())) {
if ((mediaNeg == null) || !mediaNeg.isFullyEstablished()) {
result = false;
}
TransportNegotiator transNeg = getTransportNegotiator();
if ((transNeg == null) || (!transNeg.isFullyEstablished())) {
if ((transNeg == null) || !transNeg.isFullyEstablished()) {
result = false;
}

@ -62,7 +62,7 @@ import org.jxmpp.jid.Jid;
* @author Alvaro Saurin
* @author Jeff Williams
*/
public class JingleSession extends JingleNegotiator implements MediaReceivedListener {
public final class JingleSession extends JingleNegotiator implements MediaReceivedListener {
private static final Logger LOGGER = Logger.getLogger(JingleSession.class.getName());
@ -235,7 +235,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
* Generate a unique session ID.
*/
protected static String generateSessionId() {
return String.valueOf(Math.abs(randomGenerator.nextLong()));
return String.valueOf(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
}
/**
@ -478,7 +478,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// The the packet.
// CHECKSTYLE:OFF
if ((getConnection() != null) && (getConnection().isConnected()))
if ((getConnection() != null) && getConnection().isConnected())
getConnection().sendStanza(jout);
// CHECKSTYLE:ON
}

@ -172,7 +172,7 @@ public class PayloadType {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof PayloadType)) {
return false;
}
final PayloadType other = (PayloadType) obj;
@ -244,7 +244,7 @@ public class PayloadType {
/**
* Audio payload type.
*/
public static class Audio extends PayloadType {
public static final class Audio extends PayloadType {
private int clockRate;

@ -78,7 +78,7 @@ public class ScreenShareSession extends JingleMediaSession {
public void initialize() {
JingleSession session = getJingleSession();
if ((session != null) && (session.getInitiator().equals(session.getConnection().getUser()))) {
if (session != null && session.getInitiator().equals(session.getConnection().getUser())) {
// If the initiator of the jingle session is us then we transmit a screen share.
try {
InetAddress remote = InetAddress.getByName(getRemote().getIp());

@ -73,7 +73,7 @@ public class BridgedResolver extends TransportResolver {
clearCandidates();
sid = Math.abs(random.nextLong());
sid = random.nextInt(Integer.MAX_VALUE);
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));

@ -30,7 +30,7 @@ import java.util.logging.Logger;
*
* @author Thiago Camargo
*/
public class ICECandidate extends TransportCandidate implements Comparable<ICECandidate> {
public final class ICECandidate extends TransportCandidate implements Comparable<ICECandidate> {
private static final Logger LOGGER = Logger.getLogger(ICECandidate.class.getName());

@ -145,7 +145,7 @@ public class ICEResolver extends TransportResolver {
LOGGER.log(Level.WARNING, "exeption", e1);
}
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(Math.abs(random.nextLong())), candidate.getPort(), "1", candidate.getPriority(), iceType);
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(random.nextInt(Integer.MAX_VALUE)), candidate.getPort(), "1", candidate.getPriority(), iceType);
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
transportCandidate.setPort(getFreePort());
try {
@ -186,16 +186,16 @@ public class ICEResolver extends TransportResolver {
network = 0;
}
sid = Math.abs(random.nextLong());
sid = random.nextInt(Integer.MAX_VALUE);
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
TransportCandidate localCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(Math.abs(random.nextLong())), rtpBridge.getPortA(), "1", 0, ICECandidate.Type.relay);
rtpBridge.getIp(), 1, network, String.valueOf(random.nextInt(Integer.MAX_VALUE)), rtpBridge.getPortA(), "1", 0, ICECandidate.Type.relay);
localCandidate.setLocalIp(localIp);
TransportCandidate remoteCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(Math.abs(random.nextLong())), rtpBridge.getPortB(), "1", 0, ICECandidate.Type.relay);
rtpBridge.getIp(), 1, network, String.valueOf(random.nextInt(Integer.MAX_VALUE)), rtpBridge.getPortB(), "1", 0, ICECandidate.Type.relay);
remoteCandidate.setLocalIp(localIp);
localCandidate.setSymmetric(remoteCandidate);
@ -260,7 +260,7 @@ public class ICEResolver extends TransportResolver {
if (!found) {
try {
TransportCandidate publicCandidate = new ICECandidate(
publicIp, 1, 0, String.valueOf(Math.abs(random.nextLong())), getFreePort(), "1", 0, ICECandidate.Type.srflx);
publicIp, 1, 0, String.valueOf(random.nextInt(Integer.MAX_VALUE)), getFreePort(), "1", 0, ICECandidate.Type.srflx);
publicCandidate.setLocalIp(InetAddress.getLocalHost().getHostAddress());
try {

@ -447,7 +447,7 @@ public class RTPBridge extends IQ {
DiscoverInfo discoInfo = disco.discoverInfo(connection.getXMPPServiceDomain());
for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) {
if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {
if (identity.getName() != null && identity.getName().startsWith("rtpbridge")) {
return true;
}
}

@ -309,7 +309,7 @@ public abstract class TransportCandidate {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof TransportCandidate)) {
return false;
}
final TransportCandidate other = (TransportCandidate) obj;
@ -447,7 +447,7 @@ public abstract class TransportCandidate {
/**
* Type-safe enum for the transportElement protocol.
*/
public static class Protocol {
public static final class Protocol {
public static final Protocol UDP = new Protocol("udp");
@ -584,7 +584,7 @@ public abstract class TransportCandidate {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof Channel)) {
return false;
}
final Channel other = (Channel) obj;

@ -317,8 +317,8 @@ public abstract class TransportNegotiator extends JingleNegotiator {
TransportCandidate bestRemote = getBestRemoteCandidate();
// State state = getState();
if ((bestRemote != null)
&& ((getNegotiatorState() == JingleNegotiatorState.PENDING))) {
if (bestRemote != null
&& getNegotiatorState() == JingleNegotiatorState.PENDING) {
// Accepting the remote candidate
if (!acceptedRemoteCandidates.contains(bestRemote)) {
Jingle jout = new Jingle(JingleActionEnum.CONTENT_ACCEPT);
@ -335,7 +335,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
}
acceptedRemoteCandidates.add(bestRemote);
}
if ((isEstablished()) && (getNegotiatorState() == JingleNegotiatorState.PENDING)) {
if (isEstablished() && getNegotiatorState() == JingleNegotiatorState.PENDING) {
setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
try {
triggerTransportEstablished(getAcceptedLocalCandidate(), bestRemote);
@ -409,8 +409,8 @@ public abstract class TransportNegotiator extends JingleNegotiator {
bestRemote = getBestRemoteCandidate();
// State state = getState();
if ((bestRemote != null)
&& ((getNegotiatorState() == JingleNegotiatorState.PENDING))) {
if (bestRemote != null
&& getNegotiatorState() == JingleNegotiatorState.PENDING) {
if (!acceptedRemoteCandidates.contains(bestRemote)) {
Jingle jout = new Jingle(JingleActionEnum.CONTENT_ACCEPT);
JingleContent content = parentNegotiator.getJingleContent();

@ -276,7 +276,7 @@ public class AgentSession {
synchronized (this.metaData) {
List<String> oldVals = metaData.get(key);
if ((oldVals == null) || (!oldVals.get(0).equals(val))) {
if (oldVals == null || !oldVals.get(0).equals(val)) {
oldVals.set(0, val);
setStatus(presenceMode, maxChats);
@ -635,7 +635,7 @@ public class AgentSession {
}
public Iterator<WorkgroupQueue> getQueues() {
return Collections.unmodifiableMap((new HashMap<>(queues))).values().iterator();
return Collections.unmodifiableMap(new HashMap<>(queues)).values().iterator();
}
public void addQueueUsersListener(QueueUsersListener listener) {
@ -703,7 +703,7 @@ public class AgentSession {
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) {
Offer offer = new Offer(this.connection, this, requestPacket.getUserID(),
requestPacket.getUserJID(), this.getWorkgroupJID(),
new Date((new Date()).getTime() + (requestPacket.getTimeout() * 1000)),
new Date(new Date().getTime() + (requestPacket.getTimeout() * 1000)),
requestPacket.getSessionID(), requestPacket.getMetaData(), requestPacket.getContent());
synchronized (offerListeners) {

@ -103,7 +103,7 @@ public class AgentChatHistory extends IQ {
boolean done = false;
while (!done) {