mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 22:02:06 +01:00
Bump "Error Prone" to 2.3.2
and gradle-errorprone-plugin to 0.6.
This commit is contained in:
parent
ec7badfda0
commit
b7ea226c56
65 changed files with 173 additions and 149 deletions
12
build.gradle
12
build.gradle
|
@ -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) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("chat-session".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "chat-session".equals(parser.getName())) {
|
||||
agentChatHistory.addChatSession(parseChatSetting(parser));
|
||||
|
||||
}
|
||||
|
@ -126,24 +126,24 @@ public class AgentChatHistory extends IQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("date".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "date".equals(parser.getName())) {
|
||||
String dateStr = parser.nextText();
|
||||
long l = Long.valueOf(dateStr).longValue();
|
||||
date = new Date(l);
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("duration".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "duration".equals(parser.getName())) {
|
||||
duration = Long.valueOf(parser.nextText()).longValue();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("visitorsName".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "visitorsName".equals(parser.getName())) {
|
||||
visitorsName = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("visitorsEmail".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "visitorsEmail".equals(parser.getName())) {
|
||||
visitorsEmail = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("sessionID".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "sessionID".equals(parser.getName())) {
|
||||
sessionID = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("question".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "question".equals(parser.getName())) {
|
||||
question = parser.nextText();
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG && "chat-session".equals(parser.getName())) {
|
||||
|
|
|
@ -127,7 +127,7 @@ public class AgentStatusRequest extends IQ {
|
|||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("agent".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "agent".equals(parser.getName())) {
|
||||
statusRequest.agents.add(parseAgent(parser));
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG &&
|
||||
|
@ -146,7 +146,7 @@ public class AgentStatusRequest extends IQ {
|
|||
String name = null;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("name".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "name".equals(parser.getName())) {
|
||||
name = parser.nextText();
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG &&
|
||||
|
|
|
@ -86,7 +86,7 @@ public class MonitorPacket extends IQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("isMonitor".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "isMonitor".equals(parser.getName())) {
|
||||
String value = parser.nextText();
|
||||
if ("false".equalsIgnoreCase(value)) {
|
||||
packet.setMonitor(false);
|
||||
|
|
|
@ -142,8 +142,8 @@ public class OccupantsInfo extends IQ {
|
|||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) &&
|
||||
("occupant".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG &&
|
||||
"occupant".equals(parser.getName())) {
|
||||
occupantsInfo.occupants.add(parseOccupantInfo(parser));
|
||||
} else if (eventType == XmlPullParser.END_TAG &&
|
||||
ELEMENT_NAME.equals(parser.getName())) {
|
||||
|
@ -161,13 +161,13 @@ public class OccupantsInfo extends IQ {
|
|||
Date joined = null;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("jid".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "jid".equals(parser.getName())) {
|
||||
jid = parser.nextText();
|
||||
} else if ((eventType == XmlPullParser.START_TAG) &&
|
||||
("nickname".equals(parser.getName()))) {
|
||||
} else if (eventType == XmlPullParser.START_TAG &&
|
||||
"nickname".equals(parser.getName())) {
|
||||
nickname = parser.nextText();
|
||||
} else if ((eventType == XmlPullParser.START_TAG) &&
|
||||
("joined".equals(parser.getName()))) {
|
||||
} else if (eventType == XmlPullParser.START_TAG &&
|
||||
"joined".equals(parser.getName())) {
|
||||
try {
|
||||
synchronized (UTC_FORMAT) {
|
||||
joined = UTC_FORMAT.parse(parser.nextText());
|
||||
|
|
|
@ -168,8 +168,8 @@ public final class QueueDetails implements ExtensionElement {
|
|||
}
|
||||
|
||||
eventType = parser.next();
|
||||
while ((eventType != XmlPullParser.END_TAG)
|
||||
|| (!"user".equals(parser.getName()))) {
|
||||
while (eventType != XmlPullParser.END_TAG
|
||||
|| !"user".equals(parser.getName())) {
|
||||
if ("position".equals(parser.getName())) {
|
||||
position = Integer.parseInt(parser.nextText());
|
||||
}
|
||||
|
|
|
@ -133,8 +133,8 @@ public class QueueOverview implements ExtensionElement {
|
|||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
|
||||
|
||||
eventType = parser.next();
|
||||
while ((eventType != XmlPullParser.END_TAG)
|
||||
|| (!ELEMENT_NAME.equals(parser.getName()))) {
|
||||
while (eventType != XmlPullParser.END_TAG
|
||||
|| !ELEMENT_NAME.equals(parser.getName())) {
|
||||
if ("count".equals(parser.getName())) {
|
||||
queueOverview.setUserCount(Integer.parseInt(parser.nextText()));
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class QueueOverview implements ExtensionElement {
|
|||
}
|
||||
else if ("oldest".equals(parser.getName())) {
|
||||
try {
|
||||
queueOverview.setOldestEntry((dateFormat.parse(parser.nextText())));
|
||||
queueOverview.setOldestEntry(dateFormat.parse(parser.nextText()));
|
||||
} catch (ParseException e) {
|
||||
throw new SmackException(e);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ public class ChatSettings extends IQ {
|
|||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("chat-setting".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "chat-setting".equals(parser.getName())) {
|
||||
chatSettings.addSetting(parseChatSetting(parser));
|
||||
|
||||
}
|
||||
|
@ -156,13 +156,13 @@ public class ChatSettings extends IQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("key".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "key".equals(parser.getName())) {
|
||||
key = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("value".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "value".equals(parser.getName())) {
|
||||
value = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("type".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "type".equals(parser.getName())) {
|
||||
type = Integer.parseInt(parser.nextText());
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG && "chat-setting".equals(parser.getName())) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class GenericSettings extends IQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("entry".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "entry".equals(parser.getName())) {
|
||||
eventType = parser.next();
|
||||
String name = parser.nextText();
|
||||
eventType = parser.next();
|
||||
|
|
|
@ -118,16 +118,16 @@ public class OfflineSettings extends SimpleIQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("redirectPage".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "redirectPage".equals(parser.getName())) {
|
||||
redirectPage = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("subject".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "subject".equals(parser.getName())) {
|
||||
subject = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("offlineText".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "offlineText".equals(parser.getName())) {
|
||||
offlineText = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("emailAddress".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "emailAddress".equals(parser.getName())) {
|
||||
emailAddress = parser.nextText();
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG && "offline-settings".equals(parser.getName())) {
|
||||
|
|
|
@ -87,10 +87,10 @@ public class SearchSettings extends SimpleIQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("forums".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "forums".equals(parser.getName())) {
|
||||
forums = parser.nextText();
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("kb".equals(parser.getName()))) {
|
||||
else if ((eventType == XmlPullParser.START_TAG) && "kb".equals(parser.getName())) {
|
||||
kb = parser.nextText();
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG && "search-settings".equals(parser.getName())) {
|
||||
|
|
|
@ -76,10 +76,10 @@ public class SoundSettings extends SimpleIQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("outgoingSound".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "outgoingSound".equals(parser.getName())) {
|
||||
soundSettings.setOutgoingSound(parser.nextText());
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("incomingSound".equals(parser.getName()))) {
|
||||
else if ((eventType == XmlPullParser.START_TAG) && "incomingSound".equals(parser.getName())) {
|
||||
soundSettings.setIncomingSound(parser.nextText());
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG && "sound-settings".equals(parser.getName())) {
|
||||
|
|
|
@ -103,13 +103,13 @@ public class WorkgroupProperties extends IQ {
|
|||
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if ((eventType == XmlPullParser.START_TAG) && ("authRequired".equals(parser.getName()))) {
|
||||
if (eventType == XmlPullParser.START_TAG && "authRequired".equals(parser.getName())) {
|
||||
props.setAuthRequired(Boolean.valueOf(parser.nextText()).booleanValue());
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("email".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "email".equals(parser.getName())) {
|
||||
props.setEmail(parser.nextText());
|
||||
}
|
||||
else if ((eventType == XmlPullParser.START_TAG) && ("name".equals(parser.getName()))) {
|
||||
else if (eventType == XmlPullParser.START_TAG && "name".equals(parser.getName())) {
|
||||
props.setFullName(parser.nextText());
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG && "workgroup-properties".equals(parser.getName())) {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class MetaDataUtils {
|
|||
|
||||
// Keep parsing until we've gotten to end of meta-data.
|
||||
while ((eventType != XmlPullParser.END_TAG)
|
||||
|| (!parser.getName().equals(MetaData.ELEMENT_NAME))) {
|
||||
|| !parser.getName().equals(MetaData.ELEMENT_NAME)) {
|
||||
String name = parser.getAttributeValue(0);
|
||||
String value = parser.nextText();
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
|
|||
* @param <T_Bundle> Bundle class
|
||||
* @author Paul Schaub
|
||||
*/
|
||||
@SuppressWarnings("InconsistentCapitalization")
|
||||
public abstract class OmemoKeyUtil<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_ECPub, T_Bundle> {
|
||||
private static final Logger LOGGER = Logger.getLogger(OmemoKeyUtil.class.getName());
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
|||
byte[] body;
|
||||
byte[] ciphertext;
|
||||
|
||||
body = (message.getBytes(StringUtils.UTF8));
|
||||
body = message.getBytes(StringUtils.UTF8);
|
||||
ciphertext = cipher.doFinal(body);
|
||||
|
||||
byte[] clearKeyWithAuthTag = new byte[messageKey.length + 16];
|
||||
|
|
|
@ -150,7 +150,9 @@ public final class PublicKeysListElement implements ExtensionElement {
|
|||
return true;
|
||||
}
|
||||
|
||||
return hashCode() == o.hashCode();
|
||||
PubkeyMetadataElement otherPubkeyMetadataElement = (PubkeyMetadataElement) o;
|
||||
return this.getV4Fingerprint().equals(otherPubkeyMetadataElement.getV4Fingerprint()) &&
|
||||
this.getDate().equals(otherPubkeyMetadataElement.getDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ParseStreamManagementTest {
|
|||
|
||||
@Test
|
||||
public void testParseEnabledInvariant() throws XmlPullParserException, IOException {
|
||||
String enabledString = (new StreamManagement.Enabled("stream-id", false)).toXML(null).toString();
|
||||
String enabledString = new StreamManagement.Enabled("stream-id", false).toXML(null).toString();
|
||||
XmlPullParser parser = PacketParserUtils.getParserFor(enabledString);
|
||||
StreamManagement.Enabled enabled = ParseStreamManagement.enabled(parser);
|
||||
|
||||
|
|
Loading…
Reference in a new issue