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

Bump "Error Prone" to 2.3.2

and gradle-errorprone-plugin to 0.6.
This commit is contained in:
Florian Schmaus 2018-10-31 16:06:31 +01:00
parent ec7badfda0
commit b7ea226c56
65 changed files with 173 additions and 149 deletions

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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";

View file

@ -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";

View file

@ -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;
}

View file

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

View file

@ -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());
}
}