mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 02:27:58 +01:00
More checkstyle whitespace related checks
This commit is contained in:
parent
847890b037
commit
ce1cddc722
140 changed files with 583 additions and 512 deletions
|
@ -267,6 +267,7 @@ subprojects {
|
|||
|
||||
checkstyle {
|
||||
configFile = new File(rootConfigDir, 'checkstyle.xml')
|
||||
toolVersion = '7.7'
|
||||
}
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
|
|
|
@ -117,5 +117,75 @@
|
|||
, INDEX_OP
|
||||
"/>
|
||||
</module>
|
||||
<module name="WhitespaceAfter">
|
||||
<property name="tokens" value="TYPECAST
|
||||
, LITERAL_IF
|
||||
, LITERAL_ELSE
|
||||
, LITERAL_WHILE
|
||||
, LITERAL_DO
|
||||
, LITERAL_FOR
|
||||
, DO_WHILE
|
||||
"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property
|
||||
name="ignoreEnhancedForColon"
|
||||
value="false"
|
||||
/>
|
||||
<!-- Currently disabled tokens: LCURLY, RCURLY, WILDCARD_TYPE, GENERIC_START, GENERIC_END -->
|
||||
<property
|
||||
name="tokens"
|
||||
value="ASSIGN
|
||||
, ARRAY_INIT
|
||||
, BAND
|
||||
, BAND_ASSIGN
|
||||
, BOR
|
||||
, BOR_ASSIGN
|
||||
, BSR
|
||||
, BSR_ASSIGN
|
||||
, BXOR
|
||||
, BXOR_ASSIGN
|
||||
, COLON
|
||||
, DIV
|
||||
, DIV_ASSIGN
|
||||
, DO_WHILE
|
||||
, EQUAL
|
||||
, GE
|
||||
, GT
|
||||
, LAMBDA
|
||||
, LAND
|
||||
, LE
|
||||
, LITERAL_CATCH
|
||||
, LITERAL_DO
|
||||
, LITERAL_ELSE
|
||||
, LITERAL_FINALLY
|
||||
, LITERAL_FOR
|
||||
, LITERAL_IF
|
||||
, LITERAL_RETURN
|
||||
, LITERAL_SWITCH
|
||||
, LITERAL_SYNCHRONIZED
|
||||
, LITERAL_TRY
|
||||
, LITERAL_WHILE
|
||||
, LOR
|
||||
, LT
|
||||
, MINUS
|
||||
, MINUS_ASSIGN
|
||||
, MOD
|
||||
, MOD_ASSIGN
|
||||
, NOT_EQUAL
|
||||
, PLUS
|
||||
, PLUS_ASSIGN
|
||||
, QUESTION
|
||||
, SL
|
||||
, SLIST
|
||||
, SL_ASSIGN
|
||||
, SR
|
||||
, SR_ASSIGN
|
||||
, STAR
|
||||
, STAR_ASSIGN
|
||||
, LITERAL_ASSERT
|
||||
, TYPE_EXTENSION_AND
|
||||
"/>
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
|
|
|
@ -325,7 +325,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
|||
writer = new Writer() {
|
||||
@Override
|
||||
public void write(char[] cbuf, int off, int len) {
|
||||
/* ignore */}
|
||||
/* ignore */ }
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
|
|
@ -627,7 +627,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
hostAddresses = DNSUtil.resolveXMPPServiceDomain(config.getXMPPServiceDomain().toString(), failedAddresses, config.getDnssecMode());
|
||||
}
|
||||
// Either the populated host addresses are not empty *or* there must be at least one failed address.
|
||||
assert(!hostAddresses.isEmpty() || !failedAddresses.isEmpty());
|
||||
assert (!hostAddresses.isEmpty() || !failedAddresses.isEmpty());
|
||||
return failedAddresses;
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
@Override
|
||||
public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
|
||||
Objects.requireNonNull(stanza, "Stanza must not be null");
|
||||
assert(stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ);
|
||||
assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ);
|
||||
|
||||
throwNotConnectedExceptionIfAppropriate();
|
||||
switch (fromMode) {
|
||||
|
@ -895,7 +895,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1069,7 +1070,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
protected void processStanza(final Stanza stanza) throws InterruptedException {
|
||||
assert(stanza != null);
|
||||
assert (stanza != null);
|
||||
lastStanzaReceived = System.currentTimeMillis();
|
||||
// Deliver the incoming packet to listeners.
|
||||
executorService.executeBlocking(new Runnable() {
|
||||
|
@ -1202,7 +1203,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
// Loop through all collectors and notify the appropriate ones.
|
||||
for (StanzaCollector collector: collectors) {
|
||||
for (StanzaCollector collector : collectors) {
|
||||
collector.processStanza(packet);
|
||||
}
|
||||
|
||||
|
@ -1224,7 +1225,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
for (StanzaListener listener : listenersToNotify) {
|
||||
try {
|
||||
listener.processStanza(packet);
|
||||
} catch(NotConnectedException e) {
|
||||
} catch (NotConnectedException e) {
|
||||
LOGGER.log(Level.WARNING, "Got not connected exception, aborting", e);
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -162,7 +162,7 @@ public abstract class ConnectionConfiguration {
|
|||
enabledSaslMechanisms = builder.enabledSaslMechanisms;
|
||||
|
||||
// If the enabledSaslmechanisms are set, then they must not be empty
|
||||
assert(enabledSaslMechanisms != null ? !enabledSaslMechanisms.isEmpty() : true);
|
||||
assert (enabledSaslMechanisms != null ? !enabledSaslMechanisms.isEmpty() : true);
|
||||
|
||||
if (dnssecMode != DnssecMode.disabled && customSSLContext != null) {
|
||||
throw new IllegalStateException("You can not use a custom SSL context with DNSSEC enabled");
|
||||
|
|
|
@ -132,13 +132,13 @@ public final class SASLAuthentication {
|
|||
}
|
||||
|
||||
public static boolean blacklistSASLMechanism(String mechansim) {
|
||||
synchronized(BLACKLISTED_MECHANISMS) {
|
||||
synchronized (BLACKLISTED_MECHANISMS) {
|
||||
return BLACKLISTED_MECHANISMS.add(mechansim);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean unBlacklistSASLMechanism(String mechanism) {
|
||||
synchronized(BLACKLISTED_MECHANISMS) {
|
||||
synchronized (BLACKLISTED_MECHANISMS) {
|
||||
return BLACKLISTED_MECHANISMS.remove(mechanism);
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public final class SASLAuthentication {
|
|||
}
|
||||
}
|
||||
|
||||
if (saslException != null){
|
||||
if (saslException != null) {
|
||||
if (saslException instanceof SmackException) {
|
||||
throw (SmackException) saslException;
|
||||
} else if (saslException instanceof SASLErrorException) {
|
||||
|
|
|
@ -174,7 +174,7 @@ public final class SmackConfiguration {
|
|||
* @param mech the SASL mechanism to be added
|
||||
*/
|
||||
public static void addSaslMech(String mech) {
|
||||
if(!defaultMechs.contains(mech)) {
|
||||
if (!defaultMechs.contains(mech)) {
|
||||
defaultMechs.add(mech);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public final class SmackConfiguration {
|
|||
* @param mechs the Collection of SASL mechanisms to be added
|
||||
*/
|
||||
public static void addSaslMechs(Collection<String> mechs) {
|
||||
for(String mech : mechs) {
|
||||
for (String mech : mechs) {
|
||||
addSaslMech(mech);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public final class SmackInitialization {
|
|||
} catch (IOException e) {
|
||||
LOGGER.log(Level.WARNING, "IOException closing stream", e);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.SEVERE, "Could not determine Smack version", e);
|
||||
smackVersion = "unkown";
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class SynchronizationPoint<E extends Exception> {
|
|||
if (request instanceof Stanza) {
|
||||
connection.sendStanza((Stanza) request);
|
||||
}
|
||||
else if (request instanceof Nonza){
|
||||
else if (request instanceof Nonza) {
|
||||
connection.sendNonza((Nonza) request);
|
||||
} else {
|
||||
throw new IllegalStateException("Unsupported element type");
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract class AbstractListFilter implements StanzaFilter {
|
|||
*/
|
||||
protected AbstractListFilter(StanzaFilter... filters) {
|
||||
Objects.requireNonNull(filters, "Parameter must not be null.");
|
||||
for(StanzaFilter filter : filters) {
|
||||
for (StanzaFilter filter : filters) {
|
||||
Objects.requireNonNull(filter, "Parameter must not be null.");
|
||||
}
|
||||
this.filters = new ArrayList<StanzaFilter>(Arrays.asList(filters));
|
||||
|
|
|
@ -68,7 +68,7 @@ public class AbstractError {
|
|||
String descriptiveText = getDescriptiveText(defaultLocale);
|
||||
if (descriptiveText == null) {
|
||||
descriptiveText = getDescriptiveText("en");
|
||||
if(descriptiveText == null) {
|
||||
if (descriptiveText == null) {
|
||||
descriptiveText = getDescriptiveText("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
// Add the subject in other languages
|
||||
for (Subject subject : getSubjects()) {
|
||||
// Skip the default language
|
||||
if(subject.equals(defaultSubject))
|
||||
if (subject.equals(defaultSubject))
|
||||
continue;
|
||||
buf.halfOpenElement("subject").xmllangAttribute(subject.language).rightAngleBracket();
|
||||
buf.escape(subject.subject);
|
||||
|
@ -502,7 +502,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
// Add the bodies in other languages
|
||||
for (Body body : getBodies()) {
|
||||
// Skip the default language
|
||||
if(body.equals(defaultBody))
|
||||
if (body.equals(defaultBody))
|
||||
continue;
|
||||
buf.halfOpenElement(BODY).xmllangAttribute(body.getLanguage()).rightAngleBracket();
|
||||
buf.escape(body.getMessage());
|
||||
|
|
|
@ -120,7 +120,7 @@ public final class StandardExtensionElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
public List<StandardExtensionElement> getElements() {
|
||||
if (elements == null){
|
||||
if (elements == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return elements.values();
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
|
||||
public abstract class Provider<E extends Element> {
|
||||
|
||||
public final E parse(XmlPullParser parser) throws Exception{
|
||||
public final E parse(XmlPullParser parser) throws Exception {
|
||||
// XPP3 calling convention assert: Parser should be at start tag
|
||||
ParserUtils.assertAtStartTag(parser);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class ProviderFileLoader implements ProviderLoader {
|
|||
}
|
||||
while (eventType != XmlPullParser.END_DOCUMENT);
|
||||
}
|
||||
catch (Exception e){
|
||||
catch (Exception e) {
|
||||
LOGGER.log(Level.SEVERE, "Unknown error occurred while parsing provider file", e);
|
||||
exceptions.add(e);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ProxyException extends IOException {
|
|||
|
||||
public ProxyException(ProxyInfo.ProxyType type, String ex)
|
||||
{
|
||||
super("Proxy Exception " + type.toString() + " : "+ex);
|
||||
super("Proxy Exception " + type.toString() + " : " + ex);
|
||||
}
|
||||
|
||||
public ProxyException(ProxyInfo.ProxyType type)
|
||||
|
|
|
@ -50,12 +50,12 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
|||
try
|
||||
{
|
||||
socket.connect(new InetSocketAddress(proxy_host, proxy_port), timeout);
|
||||
in=socket.getInputStream();
|
||||
out=socket.getOutputStream();
|
||||
in = socket.getInputStream();
|
||||
out = socket.getOutputStream();
|
||||
socket.setTcpNoDelay(true);
|
||||
|
||||
byte[] buf=new byte[1024];
|
||||
int index=0;
|
||||
byte[] buf = new byte[1024];
|
||||
int index = 0;
|
||||
|
||||
/*
|
||||
1) CONNECT
|
||||
|
@ -75,27 +75,27 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
|||
of all zero bits.
|
||||
*/
|
||||
|
||||
index=0;
|
||||
buf[index++]=4;
|
||||
buf[index++]=1;
|
||||
index = 0;
|
||||
buf[index++] = 4;
|
||||
buf[index++] = 1;
|
||||
|
||||
buf[index++]=(byte)(port>>>8);
|
||||
buf[index++]=(byte)(port&0xff);
|
||||
buf[index++] = (byte) (port >>> 8);
|
||||
buf[index++] = (byte) (port & 0xff);
|
||||
|
||||
InetAddress inetAddress = InetAddress.getByName(proxy_host);
|
||||
byte[] byteAddress = inetAddress.getAddress();
|
||||
for (int i = 0; i < byteAddress.length; i++)
|
||||
{
|
||||
buf[index++]=byteAddress[i];
|
||||
buf[index++] = byteAddress[i];
|
||||
}
|
||||
|
||||
if(user!=null)
|
||||
if (user != null)
|
||||
{
|
||||
byte[] userBytes = user.getBytes(StringUtils.UTF8);
|
||||
System.arraycopy(userBytes, 0, buf, index, user.length());
|
||||
index+=user.length();
|
||||
index += user.length();
|
||||
}
|
||||
buf[index++]=0;
|
||||
buf[index++] = 0;
|
||||
out.write(buf, 0, index);
|
||||
|
||||
/*
|
||||
|
@ -125,49 +125,49 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
|||
The remaining fields are ignored.
|
||||
*/
|
||||
|
||||
int len=6;
|
||||
int s=0;
|
||||
while(s<len)
|
||||
int len = 6;
|
||||
int s = 0;
|
||||
while (s < len)
|
||||
{
|
||||
int i=in.read(buf, s, len-s);
|
||||
if(i<=0)
|
||||
int i = in.read(buf, s, len - s);
|
||||
if (i <= 0)
|
||||
{
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,
|
||||
"stream is closed");
|
||||
}
|
||||
s+=i;
|
||||
s += i;
|
||||
}
|
||||
if(buf[0]!=0)
|
||||
if (buf[0] != 0)
|
||||
{
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,
|
||||
"server returns VN "+buf[0]);
|
||||
"server returns VN " + buf[0]);
|
||||
}
|
||||
if(buf[1]!=90)
|
||||
if (buf[1] != 90)
|
||||
{
|
||||
try
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
catch(Exception eee)
|
||||
catch (Exception eee)
|
||||
{
|
||||
}
|
||||
String message="ProxySOCKS4: server returns CD "+buf[1];
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4,message);
|
||||
String message = "ProxySOCKS4: server returns CD " + buf[1];
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4, message);
|
||||
}
|
||||
byte[] temp = new byte[2];
|
||||
in.read(temp, 0, 2);
|
||||
}
|
||||
catch(RuntimeException e)
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
try
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
catch(Exception eee)
|
||||
catch (Exception eee)
|
||||
{
|
||||
}
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS4, e.toString());
|
||||
|
|
|
@ -50,13 +50,13 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
try
|
||||
{
|
||||
socket.connect(new InetSocketAddress(proxy_host, proxy_port), timeout);
|
||||
in=socket.getInputStream();
|
||||
out=socket.getOutputStream();
|
||||
in = socket.getInputStream();
|
||||
out = socket.getOutputStream();
|
||||
|
||||
socket.setTcpNoDelay(true);
|
||||
|
||||
byte[] buf=new byte[1024];
|
||||
int index=0;
|
||||
byte[] buf = new byte[1024];
|
||||
int index = 0;
|
||||
|
||||
/*
|
||||
+----+----------+----------+
|
||||
|
@ -79,11 +79,11 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
o X'FF' NO ACCEPTABLE METHODS
|
||||
*/
|
||||
|
||||
buf[index++]=5;
|
||||
buf[index++] = 5;
|
||||
|
||||
buf[index++]=2;
|
||||
buf[index++]=0; // NO AUTHENTICATION REQUIRED
|
||||
buf[index++]=2; // USERNAME/PASSWORD
|
||||
buf[index++] = 2;
|
||||
buf[index++] = 0; // NO AUTHENTICATION REQUIRED
|
||||
buf[index++] = 2; // USERNAME/PASSWORD
|
||||
|
||||
out.write(buf, 0, index);
|
||||
|
||||
|
@ -100,14 +100,14 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
//in.read(buf, 0, 2);
|
||||
fill(in, buf, 2);
|
||||
|
||||
boolean check=false;
|
||||
switch((buf[1])&0xff)
|
||||
boolean check = false;
|
||||
switch ((buf[1]) & 0xff)
|
||||
{
|
||||
case 0: // NO AUTHENTICATION REQUIRED
|
||||
check=true;
|
||||
check = true;
|
||||
break;
|
||||
case 2: // USERNAME/PASSWORD
|
||||
if(user==null || passwd==null)
|
||||
if (user == null || passwd == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -131,18 +131,18 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
PASSWD field that follows. The PASSWD field contains the password
|
||||
association with the given UNAME.
|
||||
*/
|
||||
index=0;
|
||||
buf[index++]=1;
|
||||
buf[index++]=(byte)(user.length());
|
||||
index = 0;
|
||||
buf[index++] = 1;
|
||||
buf[index++] = (byte) (user.length());
|
||||
byte[] userBytes = user.getBytes(StringUtils.UTF8);
|
||||
System.arraycopy(userBytes, 0, buf, index,
|
||||
user.length());
|
||||
index+=user.length();
|
||||
index += user.length();
|
||||
byte[] passwordBytes = user.getBytes(StringUtils.UTF8);
|
||||
buf[index++]=(byte)(passwordBytes.length);
|
||||
buf[index++] = (byte) (passwordBytes.length);
|
||||
System.arraycopy(passwordBytes, 0, buf, index,
|
||||
passwd.length());
|
||||
index+=passwd.length();
|
||||
index += passwd.length();
|
||||
|
||||
out.write(buf, 0, index);
|
||||
|
||||
|
@ -162,21 +162,21 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
*/
|
||||
//in.read(buf, 0, 2);
|
||||
fill(in, buf, 2);
|
||||
if(buf[1]==0)
|
||||
if (buf[1] == 0)
|
||||
{
|
||||
check=true;
|
||||
check = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if(!check)
|
||||
if (!check)
|
||||
{
|
||||
try
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
catch(Exception eee)
|
||||
catch (Exception eee)
|
||||
{
|
||||
}
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS5,
|
||||
|
@ -209,19 +209,19 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
order
|
||||
*/
|
||||
|
||||
index=0;
|
||||
buf[index++]=5;
|
||||
buf[index++]=1; // CONNECT
|
||||
buf[index++]=0;
|
||||
index = 0;
|
||||
buf[index++] = 5;
|
||||
buf[index++] = 1; // CONNECT
|
||||
buf[index++] = 0;
|
||||
|
||||
byte[] hostb= host.getBytes(StringUtils.UTF8);
|
||||
int len=hostb.length;
|
||||
buf[index++]=3; // DOMAINNAME
|
||||
buf[index++]=(byte)(len);
|
||||
byte[] hostb = host.getBytes(StringUtils.UTF8);
|
||||
int len = hostb.length;
|
||||
buf[index++] = 3; // DOMAINNAME
|
||||
buf[index++] = (byte) (len);
|
||||
System.arraycopy(hostb, 0, buf, index, len);
|
||||
index+=len;
|
||||
buf[index++]=(byte)(port>>>8);
|
||||
buf[index++]=(byte)(port&0xff);
|
||||
index += len;
|
||||
buf[index++] = (byte) (port >>> 8);
|
||||
buf[index++] = (byte) (port & 0xff);
|
||||
|
||||
out.write(buf, 0, index);
|
||||
|
||||
|
@ -263,20 +263,20 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
//in.read(buf, 0, 4);
|
||||
fill(in, buf, 4);
|
||||
|
||||
if(buf[1]!=0)
|
||||
if (buf[1] != 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
catch(Exception eee)
|
||||
catch (Exception eee)
|
||||
{
|
||||
}
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS5,
|
||||
"server returns "+buf[1]);
|
||||
"server returns " + buf[1]);
|
||||
}
|
||||
|
||||
switch(buf[3]&0xff)
|
||||
switch (buf[3] & 0xff)
|
||||
{
|
||||
case 1:
|
||||
//in.read(buf, 0, 6);
|
||||
|
@ -286,7 +286,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
//in.read(buf, 0, 1);
|
||||
fill(in, buf, 1);
|
||||
//in.read(buf, 0, buf[0]+2);
|
||||
fill(in, buf, (buf[0]&0xff)+2);
|
||||
fill(in, buf, (buf[0] & 0xff) + 2);
|
||||
break;
|
||||
case 4:
|
||||
//in.read(buf, 0, 18);
|
||||
|
@ -295,17 +295,17 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
default:
|
||||
}
|
||||
}
|
||||
catch(RuntimeException e)
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
try
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
catch(Exception eee)
|
||||
catch (Exception eee)
|
||||
{
|
||||
}
|
||||
// TODO convert to IOException(e) when minimum Android API level is 9 or higher
|
||||
|
@ -316,16 +316,16 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
|
|||
private static void fill(InputStream in, byte[] buf, int len)
|
||||
throws IOException
|
||||
{
|
||||
int s=0;
|
||||
while(s<len)
|
||||
int s = 0;
|
||||
while (s < len)
|
||||
{
|
||||
int i=in.read(buf, s, len-s);
|
||||
if(i<=0)
|
||||
int i = in.read(buf, s, len - s);
|
||||
if (i <= 0)
|
||||
{
|
||||
throw new ProxyException(ProxyInfo.ProxyType.SOCKS5, "stream " +
|
||||
"is closed");
|
||||
}
|
||||
s+=i;
|
||||
s += i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
|||
this.password = password;
|
||||
this.authorizationId = authzid;
|
||||
this.sslSession = sslSession;
|
||||
assert(authorizationId == null || authzidSupported());
|
||||
assert (authorizationId == null || authzidSupported());
|
||||
authenticateInternal();
|
||||
authenticate();
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
|||
this.serviceName = serviceName;
|
||||
this.authorizationId = authzid;
|
||||
this.sslSession = sslSession;
|
||||
assert(authorizationId == null || authzidSupported());
|
||||
assert (authorizationId == null || authzidSupported());
|
||||
authenticateInternal(cbh);
|
||||
authenticate();
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ public abstract class ScramMechanism extends SASLMechanism {
|
|||
}
|
||||
|
||||
String cbName = getChannelBindingName();
|
||||
assert(StringUtils.isNotEmpty(cbName));
|
||||
assert (StringUtils.isNotEmpty(cbName));
|
||||
|
||||
return cbName + ',' + authzidPortion + ",";
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class EventManger<K, R, E extends Exception> {
|
|||
return false;
|
||||
}
|
||||
reference.eventResult = eventResult;
|
||||
synchronized(reference) {
|
||||
synchronized (reference) {
|
||||
reference.notifyAll();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -143,7 +143,7 @@ public class MultiMap<K,V> {
|
|||
if (res == null) {
|
||||
return null;
|
||||
}
|
||||
assert(!res.isEmpty());
|
||||
assert (!res.isEmpty());
|
||||
return res.iterator().next();
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public class PacketParserUtils {
|
|||
public static Message parseMessage(XmlPullParser parser)
|
||||
throws Exception {
|
||||
ParserUtils.assertAtStartTag(parser);
|
||||
assert(parser.getName().equals(Message.ELEMENT));
|
||||
assert (parser.getName().equals(Message.ELEMENT));
|
||||
|
||||
final int initialDepth = parser.getDepth();
|
||||
Message message = new Message();
|
||||
|
@ -247,7 +247,7 @@ public class PacketParserUtils {
|
|||
case XmlPullParser.START_TAG:
|
||||
String elementName = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
switch(elementName) {
|
||||
switch (elementName) {
|
||||
case "subject":
|
||||
String xmlLangSubject = getLanguageAttribute(parser);
|
||||
if (xmlLangSubject == null) {
|
||||
|
@ -385,7 +385,7 @@ public class PacketParserUtils {
|
|||
*/
|
||||
public static CharSequence parseContent(XmlPullParser parser)
|
||||
throws XmlPullParserException, IOException {
|
||||
assert(parser.getEventType() == XmlPullParser.START_TAG);
|
||||
assert (parser.getEventType() == XmlPullParser.START_TAG);
|
||||
if (parser.isEmptyElementTag()) {
|
||||
return "";
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ public class PacketParserUtils {
|
|||
case XmlPullParser.START_TAG:
|
||||
String elementName = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
switch(elementName) {
|
||||
switch (elementName) {
|
||||
case "status":
|
||||
presence.setStatus(parser.nextText());
|
||||
break;
|
||||
|
@ -620,7 +620,7 @@ public class PacketParserUtils {
|
|||
case XmlPullParser.START_TAG:
|
||||
String elementName = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
switch(elementName) {
|
||||
switch (elementName) {
|
||||
case "error":
|
||||
error = PacketParserUtils.parseError(parser);
|
||||
break;
|
||||
|
@ -775,7 +775,7 @@ public class PacketParserUtils {
|
|||
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
||||
}
|
||||
else {
|
||||
assert(condition == null);
|
||||
assert (condition == null);
|
||||
condition = parser.getName();
|
||||
}
|
||||
break;
|
||||
|
@ -945,7 +945,7 @@ public class PacketParserUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
assert(parser.getEventType() == XmlPullParser.END_TAG);
|
||||
assert (parser.getEventType() == XmlPullParser.END_TAG);
|
||||
return new StartTls(required);
|
||||
}
|
||||
|
||||
|
@ -954,7 +954,7 @@ public class PacketParserUtils {
|
|||
final int initialDepth = parser.getDepth();
|
||||
boolean optional = false;
|
||||
if (!parser.isEmptyElementTag()) {
|
||||
outerloop: while(true) {
|
||||
outerloop: while (true) {
|
||||
int event = parser.next();
|
||||
switch (event) {
|
||||
case XmlPullParser.START_TAG:
|
||||
|
@ -1022,7 +1022,7 @@ public class PacketParserUtils {
|
|||
}
|
||||
|
||||
public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName,
|
||||
String namespace) throws Exception{
|
||||
String namespace) throws Exception {
|
||||
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser);
|
||||
packet.addExtension(packetExtension);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ParserUtils {
|
|||
public static final String JID = "jid";
|
||||
|
||||
public static void assertAtStartTag(XmlPullParser parser) throws XmlPullParserException {
|
||||
assert(parser.getEventType() == XmlPullParser.START_TAG);
|
||||
assert (parser.getEventType() == XmlPullParser.START_TAG);
|
||||
}
|
||||
|
||||
public static void assertAtStartTag(XmlPullParser parser, String name) throws XmlPullParserException {
|
||||
|
@ -52,7 +52,7 @@ public class ParserUtils {
|
|||
}
|
||||
|
||||
public static void assertAtEndTag(XmlPullParser parser) throws XmlPullParserException {
|
||||
assert(parser.getEventType() == XmlPullParser.END_TAG);
|
||||
assert (parser.getEventType() == XmlPullParser.END_TAG);
|
||||
}
|
||||
|
||||
public static void forwardToEndTagOfDepth(XmlPullParser parser, int depth)
|
||||
|
|
|
@ -121,7 +121,7 @@ public class StringUtils {
|
|||
return null;
|
||||
}
|
||||
final int len = input.length();
|
||||
final StringBuilder out = new StringBuilder((int)(len*1.3));
|
||||
final StringBuilder out = new StringBuilder((int) (len * 1.3));
|
||||
CharSequence toAppend;
|
||||
char ch;
|
||||
int last = 0;
|
||||
|
@ -153,7 +153,7 @@ public class StringUtils {
|
|||
break;
|
||||
case forAttribute:
|
||||
// No need to escape '>' for attributes.
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case '<':
|
||||
toAppend = LT_ENCODE;
|
||||
break;
|
||||
|
@ -172,7 +172,7 @@ public class StringUtils {
|
|||
break;
|
||||
case forAttributeApos:
|
||||
// No need to escape '>' and '"' for attributes using '\'' as quote.
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case '<':
|
||||
toAppend = LT_ENCODE;
|
||||
break;
|
||||
|
@ -188,7 +188,7 @@ public class StringUtils {
|
|||
break;
|
||||
case forText:
|
||||
// No need to escape '"', '\'', and '>' for text.
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case '<':
|
||||
toAppend = LT_ENCODE;
|
||||
break;
|
||||
|
@ -308,7 +308,7 @@ public class StringUtils {
|
|||
final Random random = randGen.get();
|
||||
// Create a char buffer to put random letters and numbers in.
|
||||
char[] randBuffer = new char[length];
|
||||
for (int i=0; i<randBuffer.length; i++) {
|
||||
for (int i = 0; i < randBuffer.length; i++) {
|
||||
randBuffer[i] = numbersAndLetters[random.nextInt(numbersAndLetters.length)];
|
||||
}
|
||||
return new String(randBuffer);
|
||||
|
@ -336,7 +336,7 @@ public class StringUtils {
|
|||
}
|
||||
|
||||
private static char getPrintableChar(byte indexByte) {
|
||||
assert(numbersAndLetters.length < Byte.MAX_VALUE * 2);
|
||||
assert (numbersAndLetters.length < Byte.MAX_VALUE * 2);
|
||||
|
||||
// Convert indexByte as it where an unsigned byte by promoting it to int
|
||||
// and masking it with 0xff. Yields results from 0 - 254.
|
||||
|
|
|
@ -172,7 +172,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
}
|
||||
|
||||
public XmlStringBuilder halfOpenElement(String name) {
|
||||
assert(StringUtils.isNotEmpty(name));
|
||||
assert (StringUtils.isNotEmpty(name));
|
||||
sb.append('<').append(name);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class HostAddress {
|
|||
|
||||
public void setException(InetAddress inetAddress, Exception exception) {
|
||||
Exception old = exceptions.put(inetAddress, exception);
|
||||
assert(old == null);
|
||||
assert (old == null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ public class StanzaCollectorTest
|
|||
{
|
||||
TestStanzaCollector collector = new TestStanzaCollector(null, new OKEverything(), 5);
|
||||
|
||||
for (int i=0; i<6; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Stanza testPacket = new TestPacket(i);
|
||||
collector.processStanza(testPacket);
|
||||
|
@ -45,7 +45,7 @@ public class StanzaCollectorTest
|
|||
assertEquals("5", collector.pollResult().getStanzaId());
|
||||
assertNull(collector.pollResult());
|
||||
|
||||
for (int i=10; i<15; i++)
|
||||
for (int i = 10; i < 15; i++)
|
||||
{
|
||||
Stanza testPacket = new TestPacket(i);
|
||||
collector.processStanza(testPacket);
|
||||
|
@ -156,7 +156,7 @@ public class StanzaCollectorTest
|
|||
consumer2.start();
|
||||
consumer3.start();
|
||||
|
||||
for(int i=0; i<insertCount; i++)
|
||||
for (int i = 0; i < insertCount; i++)
|
||||
{
|
||||
collector.processStanza(new TestPacket(i));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class FilterToStringTest {
|
|||
andFilter.addFilter(new ThreadFilter("42"));
|
||||
andFilter.addFilter(MessageWithBodiesFilter.INSTANCE);
|
||||
|
||||
final String res =andFilter.toString();
|
||||
final String res = andFilter.toString();
|
||||
assertEquals("AndFilter: (StanzaIdFilter: id=foo, ThreadFilter: thread=42, MessageWithBodiesFilter)", res);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MessageTest {
|
|||
assertXMLEqual(control, messageTypeSet.toXML().toString());
|
||||
}
|
||||
|
||||
@Test(expected=NullPointerException.class)
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void setNullMessageBodyTest() {
|
||||
Message message = getNewMessage();
|
||||
message.addBody(null, null);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class PresenceTest {
|
|||
assertXMLEqual(control, presenceTypeSet.toXML().toString());
|
||||
}
|
||||
|
||||
@Test(expected=NullPointerException.class)
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void setNullPresenceTypeTest() {
|
||||
getNewPresence().setType(null);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class PresenceTest {
|
|||
assertXMLEqual(control, presence.toXML().toString());
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void setIllegalPriorityTest() {
|
||||
getNewPresence().setPriority(Integer.MIN_VALUE);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ProviderConfigTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void addClasspathFileLoaderProvider() throws Exception{
|
||||
public void addClasspathFileLoaderProvider() throws Exception {
|
||||
ProviderManager.addLoader(new ProviderFileLoader(FileUtils.getStreamForUrl("classpath:test.providers", null)));
|
||||
Assert.assertNotNull(ProviderManager.getIQProvider("provider", "test:file_provider"));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ProviderManagerTest {
|
|||
* This test should be run in a clean (e.g. forked) VM
|
||||
*/
|
||||
@Test
|
||||
public void shouldInitializeSmackTest() throws Exception{
|
||||
public void shouldInitializeSmackTest() throws Exception {
|
||||
ProviderManager.addIQProvider("foo", "bar", new TestIQProvider());
|
||||
assertTrue(SmackConfiguration.isSmackInitialized());
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smack.sasl;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
|
@ -57,7 +58,7 @@ public class DigestMd5SaslTest extends AbstractSaslTest {
|
|||
if (useAuthzid) {
|
||||
assertMapValue("authzid", "shazbat@xmpp.org", responsePairs);
|
||||
} else {
|
||||
assert(!responsePairs.containsKey("authzid"));
|
||||
assertTrue (!responsePairs.containsKey("authzid"));
|
||||
}
|
||||
assertMapValue("username", "florian", responsePairs);
|
||||
assertMapValue("realm", "xmpp.org", responsePairs);
|
||||
|
|
|
@ -664,7 +664,7 @@ public class PacketParserUtilsTest {
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(expected=XmlPullParserException.class)
|
||||
@Test(expected = XmlPullParserException.class)
|
||||
public void invalidMessageBodyContainingTagTest() throws Exception {
|
||||
String control = XMLBuilder.create("message")
|
||||
.a("from", "romeo@montague.lit/orchard")
|
||||
|
@ -701,7 +701,7 @@ public class PacketParserUtilsTest {
|
|||
try {
|
||||
PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl));
|
||||
fail("Exception should be thrown");
|
||||
} catch(XmlPullParserException e) {
|
||||
} catch (XmlPullParserException e) {
|
||||
assertTrue(e.getMessage().contains("end tag name </span>"));
|
||||
}
|
||||
|
||||
|
@ -710,7 +710,7 @@ public class PacketParserUtilsTest {
|
|||
try {
|
||||
PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl));
|
||||
fail("Exception should be thrown");
|
||||
} catch(XmlPullParserException e) {
|
||||
} catch (XmlPullParserException e) {
|
||||
assertTrue(e.getMessage().contains("end tag name </body>"));
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class PacketParserUtilsTest {
|
|||
try {
|
||||
PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl));
|
||||
fail("Exception should be thrown");
|
||||
} catch(XmlPullParserException e) {
|
||||
} catch (XmlPullParserException e) {
|
||||
assertTrue(e.getMessage().contains("end tag name </message>"));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SHA1Test {
|
|||
*/
|
||||
private boolean isValidHash(String result) {
|
||||
boolean valid = true;
|
||||
for (int i=0; i<result.length(); i++) {
|
||||
for (int i = 0; i < result.length(); i++) {
|
||||
char c = result.charAt(i);
|
||||
if (HASH_CHARS.indexOf(c) < 0) {
|
||||
valid = false;
|
||||
|
|
|
@ -263,7 +263,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
|
||||
}
|
||||
@Override
|
||||
public void reconnectingIn(final int seconds){
|
||||
public void reconnectingIn(final int seconds) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -301,7 +301,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
|
||||
messagesTable =
|
||||
new DefaultTableModel(
|
||||
new Object[]{"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
|
||||
new Object[] {"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
|
||||
0) {
|
||||
// CHECKSTYLE:OFF
|
||||
private static final long serialVersionUID = 8136121224474217264L;
|
||||
|
@ -735,9 +735,9 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
packetsPanel.setBorder(BorderFactory.createTitledBorder("Transmitted Packets"));
|
||||
|
||||
statisticsTable =
|
||||
new DefaultTableModel(new Object[][]{{"IQ", 0, 0}, {"Message", 0, 0},
|
||||
new DefaultTableModel(new Object[][] { {"IQ", 0, 0}, {"Message", 0, 0},
|
||||
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
|
||||
new Object[]{"Type", "Received", "Sent"}) {
|
||||
new Object[] {"Type", "Received", "Sent"}) {
|
||||
// CHECKSTYLE:OFF
|
||||
private static final long serialVersionUID = -6793886085109589269L;
|
||||
@Override
|
||||
|
@ -878,7 +878,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
}
|
||||
|
||||
messagesTable.addRow(
|
||||
new Object[]{
|
||||
new Object[] {
|
||||
formatXML(packet.toXML().toString()),
|
||||
dateFormatter.format(new Date()),
|
||||
packetReceivedIcon,
|
||||
|
@ -940,7 +940,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
|||
}
|
||||
|
||||
messagesTable.addRow(
|
||||
new Object[]{
|
||||
new Object[] {
|
||||
formatXML(packet.toXML().toString()),
|
||||
dateFormatter.format(new Date()),
|
||||
packetSentIcon,
|
||||
|
|
|
@ -289,8 +289,8 @@ public class LiteDebugger implements SmackDebugger {
|
|||
*/
|
||||
public void rootWindowClosing(WindowEvent evt) {
|
||||
connection.removeAsyncStanzaListener(listener);
|
||||
((ObservableReader)reader).removeReaderListener(readerListener);
|
||||
((ObservableWriter)writer).removeWriterListener(writerListener);
|
||||
((ObservableReader) reader).removeReaderListener(readerListener);
|
||||
((ObservableWriter) writer).removeWriterListener(writerListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -322,7 +322,7 @@ public class LiteDebugger implements SmackDebugger {
|
|||
|
||||
@Override
|
||||
public Reader newConnectionReader(Reader newReader) {
|
||||
((ObservableReader)reader).removeReaderListener(readerListener);
|
||||
((ObservableReader) reader).removeReaderListener(readerListener);
|
||||
ObservableReader debugReader = new ObservableReader(newReader);
|
||||
debugReader.addReaderListener(readerListener);
|
||||
reader = debugReader;
|
||||
|
@ -331,7 +331,7 @@ public class LiteDebugger implements SmackDebugger {
|
|||
|
||||
@Override
|
||||
public Writer newConnectionWriter(Writer newWriter) {
|
||||
((ObservableWriter)writer).removeWriterListener(writerListener);
|
||||
((ObservableWriter) writer).removeWriterListener(writerListener);
|
||||
ObservableWriter debugWriter = new ObservableWriter(newWriter);
|
||||
debugWriter.addWriterListener(writerListener);
|
||||
writer = debugWriter;
|
||||
|
|
|
@ -123,7 +123,7 @@ public final class CarbonManager extends Manager {
|
|||
// also reset here.
|
||||
enabled_state = false;
|
||||
boolean removed = connection().removeSyncStanzaListener(carbonsListener);
|
||||
assert(removed);
|
||||
assert (removed);
|
||||
}
|
||||
@Override
|
||||
public void authenticated(XMPPConnection connection, boolean resumed) {
|
||||
|
|
|
@ -121,7 +121,7 @@ public final class HttpFileUploadManager extends Manager {
|
|||
}
|
||||
|
||||
private static UploadService uploadServiceFrom(DiscoverInfo discoverInfo) {
|
||||
assert(containsHttpFileUploadNamespace(discoverInfo));
|
||||
assert (containsHttpFileUploadNamespace(discoverInfo));
|
||||
|
||||
UploadService.Version version;
|
||||
if (discoverInfo.containsFeature(NAMESPACE)) {
|
||||
|
|
|
@ -34,13 +34,13 @@ public class FileTooLargeErrorProvider extends ExtensionElementProvider<FileTooL
|
|||
final String namespace = parser.getNamespace();
|
||||
Long maxFileSize = null;
|
||||
|
||||
outerloop: while(true) {
|
||||
outerloop: while (true) {
|
||||
int event = parser.next();
|
||||
|
||||
switch (event) {
|
||||
case XmlPullParser.START_TAG:
|
||||
String name = parser.getName();
|
||||
switch(name) {
|
||||
switch (name) {
|
||||
case "max-file-size":
|
||||
maxFileSize = Long.valueOf(parser.nextText());
|
||||
break;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SlotProvider extends IQProvider<Slot> {
|
|||
switch (event) {
|
||||
case XmlPullParser.START_TAG:
|
||||
String name = parser.getName();
|
||||
switch(name) {
|
||||
switch (name) {
|
||||
case "put":
|
||||
putUrl = new URL(parser.nextText());
|
||||
break;
|
||||
|
|
|
@ -94,7 +94,7 @@ public class CarbonTest extends ExperimentalInitializerTest {
|
|||
assertEquals("received", parser.getName());
|
||||
}
|
||||
|
||||
@Test(expected=Exception.class)
|
||||
@Test(expected = Exception.class)
|
||||
public void carbonEmptyTest() throws Exception {
|
||||
XmlPullParser parser;
|
||||
String control;
|
||||
|
|
|
@ -27,7 +27,7 @@ public class MUCLightDestroyTest {
|
|||
+ "<query xmlns='urn:xmpp:muclight:0#destroy'/>" + "</iq>";
|
||||
|
||||
@Test
|
||||
public void checkDestroyMUCLightStanza() throws Exception{
|
||||
public void checkDestroyMUCLightStanza() throws Exception {
|
||||
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(JidCreate.from("coven@muclight.shakespeare.lit"));
|
||||
mucLightDestroyIQ.setStanzaId("destroy1");
|
||||
Assert.assertEquals(mucLightDestroyIQ.toXML().toString(), stanza);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ServiceAdministrationManager extends Manager {
|
|||
passwordVerifyField.addValue(password);
|
||||
|
||||
command.next(answerForm);
|
||||
assert(command.isCompleted());
|
||||
assert (command.isCompleted());
|
||||
}
|
||||
|
||||
public RemoteCommand deleteUser() {
|
||||
|
@ -112,6 +112,6 @@ public class ServiceAdministrationManager extends Manager {
|
|||
accountJids.addValues(JidUtil.toStringList(jidsToDelete));
|
||||
|
||||
command.next(answerForm);
|
||||
assert(command.isCompleted());
|
||||
assert (command.isCompleted());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ public class AMPExtension implements ExtensionElement {
|
|||
String getName();
|
||||
String getValue();
|
||||
|
||||
static final String ATTRIBUTE_NAME="condition";
|
||||
static final String ATTRIBUTE_NAME = "condition";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,7 +265,7 @@ public class AMPExtension implements ExtensionElement {
|
|||
*/
|
||||
notify;
|
||||
|
||||
public static final String ATTRIBUTE_NAME="action";
|
||||
public static final String ATTRIBUTE_NAME = "action";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,7 +82,7 @@ public class BoBData {
|
|||
|
||||
private void setContentBinaryIfRequired() {
|
||||
if (contentBinary == null) {
|
||||
assert(StringUtils.isNotEmpty(contentString));
|
||||
assert (StringUtils.isNotEmpty(contentString));
|
||||
contentBinary = Base64.decode(contentString);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,9 +118,9 @@ public final class BookmarkManager {
|
|||
BookmarkedConference bookmark
|
||||
= new BookmarkedConference(name, jid, isAutoJoin, nickname, password);
|
||||
List<BookmarkedConference> conferences = bookmarks.getBookmarkedConferences();
|
||||
if(conferences.contains(bookmark)) {
|
||||
if (conferences.contains(bookmark)) {
|
||||
BookmarkedConference oldConference = conferences.get(conferences.indexOf(bookmark));
|
||||
if(oldConference.isShared()) {
|
||||
if (oldConference.isShared()) {
|
||||
throw new IllegalArgumentException("Cannot modify shared bookmark");
|
||||
}
|
||||
oldConference.setAutoJoin(isAutoJoin);
|
||||
|
@ -149,10 +149,10 @@ public final class BookmarkManager {
|
|||
public void removeBookmarkedConference(EntityBareJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
Iterator<BookmarkedConference> it = bookmarks.getBookmarkedConferences().iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
BookmarkedConference conference = it.next();
|
||||
if(conference.getJid().equals(jid)) {
|
||||
if(conference.isShared()) {
|
||||
if (conference.getJid().equals(jid)) {
|
||||
if (conference.isShared()) {
|
||||
throw new IllegalArgumentException("Conference is shared and can't be removed");
|
||||
}
|
||||
it.remove();
|
||||
|
@ -192,9 +192,9 @@ public final class BookmarkManager {
|
|||
retrieveBookmarks();
|
||||
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
|
||||
List<BookmarkedURL> urls = bookmarks.getBookmarkedURLS();
|
||||
if(urls.contains(bookmark)) {
|
||||
if (urls.contains(bookmark)) {
|
||||
BookmarkedURL oldURL = urls.get(urls.indexOf(bookmark));
|
||||
if(oldURL.isShared()) {
|
||||
if (oldURL.isShared()) {
|
||||
throw new IllegalArgumentException("Cannot modify shared bookmarks");
|
||||
}
|
||||
oldURL.setName(name);
|
||||
|
@ -219,10 +219,10 @@ public final class BookmarkManager {
|
|||
public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
retrieveBookmarks();
|
||||
Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
BookmarkedURL bookmark = it.next();
|
||||
if(bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
|
||||
if(bookmark.isShared()) {
|
||||
if (bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
|
||||
if (bookmark.isShared()) {
|
||||
throw new IllegalArgumentException("Cannot delete a shared bookmark.");
|
||||
}
|
||||
it.remove();
|
||||
|
@ -249,8 +249,8 @@ public final class BookmarkManager {
|
|||
}
|
||||
|
||||
private Bookmarks retrieveBookmarks() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
synchronized(bookmarkLock) {
|
||||
if(bookmarks == null) {
|
||||
synchronized (bookmarkLock) {
|
||||
if (bookmarks == null) {
|
||||
bookmarks = (Bookmarks) privateDataManager.getPrivateData("storage",
|
||||
"storage:bookmarks");
|
||||
}
|
||||
|
|
|
@ -115,10 +115,10 @@ public class BookmarkedConference implements SharedBookmark {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj == null || !(obj instanceof BookmarkedConference)) {
|
||||
if (obj == null || !(obj instanceof BookmarkedConference)) {
|
||||
return false;
|
||||
}
|
||||
BookmarkedConference conference = (BookmarkedConference)obj;
|
||||
BookmarkedConference conference = (BookmarkedConference) obj;
|
||||
return conference.getJid().equals(jid);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,10 +86,10 @@ public class BookmarkedURL implements SharedBookmark {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof BookmarkedURL)) {
|
||||
if (!(obj instanceof BookmarkedURL)) {
|
||||
return false;
|
||||
}
|
||||
BookmarkedURL url = (BookmarkedURL)obj;
|
||||
BookmarkedURL url = (BookmarkedURL) obj;
|
||||
return url.getURL().equalsIgnoreCase(URL);
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ public class Bookmarks implements PrivateData {
|
|||
buf.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||
|
||||
for (BookmarkedURL urlStorage : getBookmarkedURLS()) {
|
||||
if(urlStorage.isShared()) {
|
||||
if (urlStorage.isShared()) {
|
||||
continue;
|
||||
}
|
||||
buf.halfOpenElement("url").attribute("name", urlStorage.getName()).attribute("url", urlStorage.getURL());
|
||||
|
@ -187,7 +187,7 @@ public class Bookmarks implements PrivateData {
|
|||
|
||||
// Add Conference additions
|
||||
for (BookmarkedConference conference : getBookmarkedConferences()) {
|
||||
if(conference.isShared()) {
|
||||
if (conference.isShared()) {
|
||||
continue;
|
||||
}
|
||||
buf.halfOpenElement("conference");
|
||||
|
@ -260,7 +260,7 @@ public class Bookmarks implements PrivateData {
|
|||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if(eventType == XmlPullParser.START_TAG
|
||||
if (eventType == XmlPullParser.START_TAG
|
||||
&& "shared_bookmark".equals(parser.getName())) {
|
||||
urlStore.setShared(true);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public class Bookmarks implements PrivateData {
|
|||
else if (eventType == XmlPullParser.START_TAG && "password".equals(parser.getName())) {
|
||||
conf.setPassword(parser.nextText());
|
||||
}
|
||||
else if(eventType == XmlPullParser.START_TAG
|
||||
else if (eventType == XmlPullParser.START_TAG
|
||||
&& "shared_bookmark".equals(parser.getName())) {
|
||||
conf.setShared(true);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class DataListener extends AbstractIqRequestHandler {
|
|||
ibbSession.processIQPacket(data);
|
||||
}
|
||||
}
|
||||
catch (NotConnectedException|InterruptedException e) {
|
||||
catch (NotConnectedException | InterruptedException e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -415,7 +415,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
*/
|
||||
@Override
|
||||
public Socks5BytestreamSession establishSession(Jid targetJID, String sessionID)
|
||||
throws IOException, InterruptedException, NoResponseException, SmackException, XMPPException{
|
||||
throws IOException, InterruptedException, NoResponseException, SmackException, XMPPException {
|
||||
XMPPConnection connection = connection();
|
||||
XMPPErrorException discoveryException = null;
|
||||
// check if target supports SOCKS5 Bytestream
|
||||
|
@ -556,7 +556,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
try {
|
||||
proxyInfo = serviceDiscoveryManager.discoverInfo(item.getEntityID());
|
||||
}
|
||||
catch (NoResponseException|XMPPErrorException e) {
|
||||
catch (NoResponseException | XMPPErrorException e) {
|
||||
// blacklist errornous server
|
||||
proxyBlacklist.add(item.getEntityID());
|
||||
continue;
|
||||
|
|
|
@ -280,7 +280,7 @@ public final class Socks5Proxy {
|
|||
* @return true if the address was removed.
|
||||
*/
|
||||
public boolean removeLocalAddress(String address) {
|
||||
synchronized(localAddresses) {
|
||||
synchronized (localAddresses) {
|
||||
return localAddresses.remove(address);
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public final class Socks5Proxy {
|
|||
if (addresses == null) {
|
||||
throw new IllegalArgumentException("list must not be null");
|
||||
}
|
||||
synchronized(localAddresses) {
|
||||
synchronized (localAddresses) {
|
||||
localAddresses.clear();
|
||||
localAddresses.addAll(addresses);
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
@Override
|
||||
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
|
||||
switch(getType()) {
|
||||
switch (getType()) {
|
||||
case set:
|
||||
xml.optAttribute("sid", getSessionID());
|
||||
xml.optAttribute("mode", getMode());
|
||||
|
|
|
@ -717,7 +717,7 @@ public final class EntityCapsManager extends Manager {
|
|||
throw new AssertionError(e);
|
||||
}
|
||||
byte[] digest;
|
||||
synchronized(md) {
|
||||
synchronized (md) {
|
||||
digest = md.digest(bytes);
|
||||
}
|
||||
String version = Base64.encodeToString(digest);
|
||||
|
|
|
@ -105,10 +105,10 @@ public final class ChatStateManager extends Manager {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
public void setCurrentState(ChatState newState, org.jivesoftware.smack.chat.Chat chat) throws NotConnectedException, InterruptedException {
|
||||
if(chat == null || newState == null) {
|
||||
if (chat == null || newState == null) {
|
||||
throw new IllegalArgumentException("Arguments cannot be null.");
|
||||
}
|
||||
if(!updateChatState(chat, newState)) {
|
||||
if (!updateChatState(chat, newState)) {
|
||||
return;
|
||||
}
|
||||
Message message = new Message();
|
||||
|
|
|
@ -140,7 +140,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
response.addItems(nodeInformationProvider.getNodeItems());
|
||||
// Add packet extensions
|
||||
response.addExtensions(nodeInformationProvider.getNodePacketExtensions());
|
||||
} else if(discoverItems.getNode() != null) {
|
||||
} else if (discoverItems.getNode() != null) {
|
||||
// Return <item-not-found/> error since client doesn't contain
|
||||
// the specified node
|
||||
response.setType(IQ.Type.error);
|
||||
|
@ -761,7 +761,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
try {
|
||||
// Get the disco items and send the disco packet to each server item
|
||||
items = discoverItems(serviceName);
|
||||
} catch(XMPPErrorException e) {
|
||||
} catch (XMPPErrorException e) {
|
||||
LOGGER.log(Level.WARNING, "Could not discover items about service", e);
|
||||
return serviceDiscoInfo;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
|
|||
if (parser.getName().equals("feature")) {
|
||||
// Create a new feature and add it to the discovered info.
|
||||
boolean notADuplicateFeature = discoverInfo.addFeature(variable);
|
||||
assert(notADuplicateFeature);
|
||||
assert (notADuplicateFeature);
|
||||
}
|
||||
if (parser.getName().equals("query")) {
|
||||
done = true;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
private StreamNegotiator determineNegotiator(Stanza streamInitiation) {
|
||||
if (streamInitiation instanceof Bytestream) {
|
||||
return primaryNegotiator;
|
||||
} else if (streamInitiation instanceof Open){
|
||||
} else if (streamInitiation instanceof Open) {
|
||||
return secondaryNegotiator;
|
||||
} else {
|
||||
throw new IllegalStateException("Unknown stream initation type");
|
||||
|
|
|
@ -308,7 +308,7 @@ public abstract class FileTransfer {
|
|||
* Return the length of bytes written out to the stream.
|
||||
* @return the amount in bytes written out.
|
||||
*/
|
||||
public long getAmountWritten(){
|
||||
public long getAmountWritten() {
|
||||
return amountWritten;
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
final long fileSize, final String description,
|
||||
final NegotiationProgress progress)
|
||||
{
|
||||
if(progress == null) {
|
||||
if (progress == null) {
|
||||
throw new IllegalArgumentException("Callback progress cannot be null.");
|
||||
}
|
||||
checkTransferThread();
|
||||
|
@ -295,7 +295,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
* @param fileSize the size of the file that is transferred
|
||||
* @param description a description for the file to transfer.
|
||||
*/
|
||||
public synchronized void sendStream(final InputStream in, final String fileName, final long fileSize, final String description){
|
||||
public synchronized void sendStream(final InputStream in, final String fileName, final long fileSize, final String description) {
|
||||
checkTransferThread();
|
||||
|
||||
setFileInfo(fileName, fileSize);
|
||||
|
@ -409,7 +409,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
@Override
|
||||
protected boolean updateStatus(Status oldStatus, Status newStatus) {
|
||||
boolean isUpdated = super.updateStatus(oldStatus, newStatus);
|
||||
if(callback != null && isUpdated) {
|
||||
if (callback != null && isUpdated) {
|
||||
callback.statusUpdated(oldStatus, newStatus);
|
||||
}
|
||||
return isUpdated;
|
||||
|
@ -419,7 +419,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
protected void setStatus(Status status) {
|
||||
Status oldStatus = getStatus();
|
||||
super.setStatus(status);
|
||||
if(callback != null) {
|
||||
if (callback != null) {
|
||||
callback.statusUpdated(oldStatus, status);
|
||||
}
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ public class OutgoingFileTransfer extends FileTransfer {
|
|||
@Override
|
||||
protected void setException(Exception exception) {
|
||||
super.setException(exception);
|
||||
if(callback != null) {
|
||||
if (callback != null) {
|
||||
callback.errorEstablishingStream(exception);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,10 +112,10 @@ public class Occupant {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof Occupant)) {
|
||||
if (!(obj instanceof Occupant)) {
|
||||
return false;
|
||||
}
|
||||
Occupant occupant = (Occupant)obj;
|
||||
Occupant occupant = (Occupant) obj;
|
||||
return jid.equals(occupant.jid);
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ public class MUCUser implements ExtensionElement {
|
|||
* @author Gaston Dombiak
|
||||
*/
|
||||
public static class Invite implements NamedElement {
|
||||
public static final String ELEMENT ="invite";
|
||||
public static final String ELEMENT = "invite";
|
||||
|
||||
private final String reason;
|
||||
|
||||
|
|
|
@ -95,9 +95,9 @@ public final class PEPManager extends Manager {
|
|||
public void processStanza(Stanza stanza) {
|
||||
Message message = (Message) stanza;
|
||||
EventElement event = EventElement.from(stanza);
|
||||
assert(event != null);
|
||||
assert (event != null);
|
||||
EntityBareJid from = message.getFrom().asEntityBareJidIfPossible();
|
||||
assert(from != null);
|
||||
assert (from != null);
|
||||
for (PEPListener listener : pepListeners) {
|
||||
listener.eventReceived(from, event, message);
|
||||
}
|
||||
|
|
|
@ -575,7 +575,7 @@ public final class PrivacyListManager extends Manager {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException{
|
||||
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(NAMESPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,11 +46,11 @@ public class Privacy extends IQ {
|
|||
public static final String NAMESPACE = "jabber:iq:privacy";
|
||||
|
||||
/** declineActiveList is true when the user declines the use of the active list **/
|
||||
private boolean declineActiveList=false;
|
||||
private boolean declineActiveList = false;
|
||||
/** activeName is the name associated with the active list set for the session **/
|
||||
private String activeName;
|
||||
/** declineDefaultList is true when the user declines the use of the default list **/
|
||||
private boolean declineDefaultList=false;
|
||||
private boolean declineDefaultList = false;
|
||||
/** defaultName is the name of the default list that applies to the user as a whole **/
|
||||
private String defaultName;
|
||||
/** itemLists holds the set of privacy items classified in lists. It is a map where the
|
||||
|
|
|
@ -139,7 +139,7 @@ public class Affiliation implements ExtensionElement
|
|||
*/
|
||||
public boolean isAffiliationModification() {
|
||||
if (jid != null && affiliation != null) {
|
||||
assert(node == null && namespace == PubSubNamespace.OWNER);
|
||||
assert (node == null && namespace == PubSubNamespace.OWNER);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -55,6 +55,6 @@ public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketE
|
|||
if (getConfiguration() == null)
|
||||
return Collections.emptyList();
|
||||
else
|
||||
return Arrays.asList(((ExtensionElement)getConfiguration().getDataFormToSend()));
|
||||
return Arrays.asList(((ExtensionElement) getConfiguration().getDataFormToSend()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class EventElement implements EmbeddedPacketExtension
|
|||
@Override
|
||||
public List<ExtensionElement> getExtensions()
|
||||
{
|
||||
return Arrays.asList(new ExtensionElement[]{getEvent()});
|
||||
return Arrays.asList(new ExtensionElement[] {getEvent()});
|
||||
}
|
||||
|
||||
public NodeExtension getEvent()
|
||||
|
|
|
@ -134,7 +134,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
@SuppressWarnings("unchecked")
|
||||
public List<ExtensionElement> getExtensions()
|
||||
{
|
||||
return (List<ExtensionElement>)getItems();
|
||||
return (List<ExtensionElement>) getItems();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -242,7 +242,7 @@ public class LeafNode extends Node
|
|||
public <T extends Item> void publish(T item) throws NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<T> items = new ArrayList<T>(1);
|
||||
items.add((T)(item == null ? new Item() : item));
|
||||
items.add((T) (item == null ? new Item() : item));
|
||||
publish(items);
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ public class LeafNode extends Node
|
|||
public <T extends Item> void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<T> items = new ArrayList<T>(1);
|
||||
items.add((item == null ? (T)new Item() : item));
|
||||
items.add((item == null ? (T) new Item() : item));
|
||||
send(items);
|
||||
}
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ abstract public class Node
|
|||
|
||||
private static List<String> getSubscriptionIds(Stanza packet)
|
||||
{
|
||||
HeadersExtension headers = (HeadersExtension)packet.getExtension("headers", "http://jabber.org/protocol/shim");
|
||||
HeadersExtension headers = (HeadersExtension) packet.getExtension("headers", "http://jabber.org/protocol/shim");
|
||||
List<String> values = null;
|
||||
|
||||
if (headers != null)
|
||||
|
@ -608,10 +608,8 @@ abstract public class Node
|
|||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
// CHECKSTYLE:OFF
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
// CHECKSTYLE:ON
|
||||
ItemsExtension itemsElem = (ItemsExtension)event.getEvent();
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
ItemsExtension itemsElem = (ItemsExtension) event.getEvent();
|
||||
ItemPublishEvent eventItems = new ItemPublishEvent(itemsElem.getNode(), itemsElem.getItems(), getSubscriptionIds(packet), DelayInformationManager.getDelayTimestamp(packet));
|
||||
listener.handlePublishedItems(eventItems);
|
||||
}
|
||||
|
@ -681,8 +679,8 @@ abstract public class Node
|
|||
@Override
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
ConfigurationEvent config = (ConfigurationEvent)event.getEvent();
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
ConfigurationEvent config = (ConfigurationEvent) event.getEvent();
|
||||
|
||||
listener.handleNodeConfiguration(config);
|
||||
}
|
||||
|
@ -735,7 +733,7 @@ abstract public class Node
|
|||
|
||||
if (embedEvent instanceof EmbeddedPacketExtension)
|
||||
{
|
||||
List<ExtensionElement> secondLevelList = ((EmbeddedPacketExtension)embedEvent).getExtensions();
|
||||
List<ExtensionElement> secondLevelList = ((EmbeddedPacketExtension) embedEvent).getExtensions();
|
||||
|
||||
// XEP-0060 allows no elements on second level for notifications. See schema or
|
||||
// for example § 4.3:
|
||||
|
|
|
@ -73,7 +73,7 @@ public enum PubSubElementType
|
|||
public static PubSubElementType valueOfFromElemName(String elemName, String namespace)
|
||||
{
|
||||
int index = namespace.lastIndexOf('#');
|
||||
String fragment = (index == -1 ? null : namespace.substring(index+1));
|
||||
String fragment = (index == -1 ? null : namespace.substring(index + 1));
|
||||
|
||||
if (fragment != null)
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ public enum PubSubNamespace
|
|||
|
||||
if (index != -1)
|
||||
{
|
||||
String suffix = ns.substring(ns.lastIndexOf('#')+1);
|
||||
String suffix = ns.substring(ns.lastIndexOf('#') + 1);
|
||||
return valueOf(suffix.toUpperCase(Locale.US));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.pubsub.AffiliationsExtension;
|
|||
@Override
|
||||
protected AffiliationsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new AffiliationsExtension((List<Affiliation>)content);
|
||||
return new AffiliationsExtension((List<Affiliation>) content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ public class ConfigEventProvider extends EmbeddedExtensionProvider<Configuration
|
|||
if (content.size() == 0)
|
||||
return new ConfigurationEvent(attMap.get("node"));
|
||||
else
|
||||
return new ConfigurationEvent(attMap.get("node"), new ConfigureForm((DataForm)content.iterator().next()));
|
||||
return new ConfigurationEvent(attMap.get("node"), new ConfigureForm((DataForm) content.iterator().next()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,6 @@ public class EventProvider extends EmbeddedExtensionProvider<EventElement>
|
|||
@Override
|
||||
protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new EventElement(EventElementType.valueOf(content.get(0).getElementName()), (NodeExtension)content.get(0));
|
||||
return new EventElement(EventElementType.valueOf(content.get(0).getElementName()), (NodeExtension) content.get(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,6 @@ public class FormNodeProvider extends EmbeddedExtensionProvider<FormNode>
|
|||
@Override
|
||||
protected FormNode createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm)content.iterator().next()));
|
||||
return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm) content.iterator().next()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class SubscriptionsProvider extends EmbeddedExtensionProvider<Subscriptio
|
|||
@Override
|
||||
protected SubscriptionsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
|
||||
return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>) content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ReportedData {
|
|||
}
|
||||
|
||||
|
||||
public ReportedData(){
|
||||
public ReportedData() {
|
||||
// Allow for model creation of ReportedData.
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class ReportedData {
|
|||
* Adds a new <code>Row</code>.
|
||||
* @param row the new row to add.
|
||||
*/
|
||||
public void addRow(Row row){
|
||||
public void addRow(Row row) {
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class ReportedData {
|
|||
* Adds a new <code>Column</code>.
|
||||
* @param column the column to add.
|
||||
*/
|
||||
public void addColumn(Column column){
|
||||
public void addColumn(Column column) {
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ public class ReportedData {
|
|||
* @return the values of the field whose variable matches the requested variable.
|
||||
*/
|
||||
public List<String> getValues(String variable) {
|
||||
for(Field field : getFields()) {
|
||||
for (Field field : getFields()) {
|
||||
if (variable.equalsIgnoreCase(field.getVariable())) {
|
||||
return field.getValues();
|
||||
}
|
||||
|
|
|
@ -172,16 +172,16 @@ public class UserSearch extends SimpleIQ {
|
|||
FormField field = new FormField(name);
|
||||
|
||||
// Handle hard coded values.
|
||||
if(name.equals("first")){
|
||||
if (name.equals("first")) {
|
||||
field.setLabel("First Name");
|
||||
}
|
||||
else if(name.equals("last")){
|
||||
else if (name.equals("last")) {
|
||||
field.setLabel("Last Name");
|
||||
}
|
||||
else if(name.equals("email")){
|
||||
else if (name.equals("email")) {
|
||||
field.setLabel("Email Address");
|
||||
}
|
||||
else if(name.equals("nick")){
|
||||
else if (name.equals("nick")) {
|
||||
field.setLabel("Nickname");
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class StreamInitiationProvider extends IQProvider<StreamInitiation> {
|
|||
done = true;
|
||||
} else if (elementName.equals("file")) {
|
||||
long fileSize = 0;
|
||||
if(size != null && size.trim().length() !=0){
|
||||
if (size != null && size.trim().length() != 0) {
|
||||
try {
|
||||
fileSize = Long.parseLong(size);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ public class Form {
|
|||
}
|
||||
|
||||
private static void validateThatFieldIsText(FormField field) {
|
||||
switch(field.getType()) {
|
||||
switch (field.getType()) {
|
||||
case text_multi:
|
||||
case text_private:
|
||||
case text_single:
|
||||
|
@ -444,7 +444,7 @@ public class Form {
|
|||
if (isSubmitType()) {
|
||||
// Create a new DataForm that contains only the answered fields
|
||||
DataForm dataFormToSend = new DataForm(getType());
|
||||
for(FormField field : getFields()) {
|
||||
for (FormField field : getFields()) {
|
||||
if (!field.getValues().isEmpty()) {
|
||||
dataFormToSend.addField(field);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
catch (FeatureNotSupportedException e) {
|
||||
assertTrue(e.getFeature().equals("SOCKS5 Bytestream"));
|
||||
assertTrue(e.getJid().equals(targetJID));
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class Socks5ProxyTest {
|
|||
proxy.addLocalAddress("same");
|
||||
|
||||
int sameCount = 0;
|
||||
for(String localAddress : proxy.getLocalAddresses()) {
|
||||
for (String localAddress : proxy.getLocalAddresses()) {
|
||||
if ("same".equals(localAddress)) {
|
||||
sameCount++;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ public final class Socks5TestProxy {
|
|||
*/
|
||||
@SuppressWarnings("WaitNotInLoop")
|
||||
public Socket getSocket(String digest) {
|
||||
synchronized(this) {
|
||||
synchronized (this) {
|
||||
if (!startupComplete) {
|
||||
try {
|
||||
wait(5000);
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ForwardedTest {
|
|||
assertEquals("forwarded", parser.getName());
|
||||
}
|
||||
|
||||
@Test(expected=Exception.class)
|
||||
@Test(expected = Exception.class)
|
||||
public void forwardedEmptyTest() throws Exception {
|
||||
XmlPullParser parser;
|
||||
String control;
|
||||
|
|
|
@ -75,32 +75,32 @@ public class GeoLocationTest extends InitExtensions {
|
|||
|
||||
// @formatter:off
|
||||
final String geoLocationMessageString = "<message from='portia@merchantofvenice.lit'"
|
||||
+" to='bassanio@merchantofvenice.lit'>"
|
||||
+"<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+"<accuracy>23</accuracy>"
|
||||
+"<alt>1000</alt>"
|
||||
+"<area>Delhi</area>"
|
||||
+"<bearing>10</bearing>"
|
||||
+"<building>Small Building</building>"
|
||||
+"<country>India</country>"
|
||||
+"<countrycode>IN</countrycode>"
|
||||
+"<description>My Description</description>"
|
||||
+"<error>90</error>"
|
||||
+"<floor>top</floor>"
|
||||
+"<lat>25.098345</lat>"
|
||||
+"<locality>awesome</locality>"
|
||||
+"<lon>77.992034</lon>"
|
||||
+"<postalcode>110085</postalcode>"
|
||||
+"<region>North</region>"
|
||||
+"<room>small</room>"
|
||||
+"<speed>250.0</speed>"
|
||||
+"<street>Wall Street</street>"
|
||||
+"<text>Unit Testing GeoLocation</text>"
|
||||
+"<timestamp>2004-02-19</timestamp>"
|
||||
+"<tzo>+5:30</tzo>"
|
||||
+"<uri>http://xmpp.org</uri>"
|
||||
+"</geoloc>"
|
||||
+"</message>";
|
||||
+ " to='bassanio@merchantofvenice.lit'>"
|
||||
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+ "<accuracy>23</accuracy>"
|
||||
+ "<alt>1000</alt>"
|
||||
+ "<area>Delhi</area>"
|
||||
+ "<bearing>10</bearing>"
|
||||
+ "<building>Small Building</building>"
|
||||
+ "<country>India</country>"
|
||||
+ "<countrycode>IN</countrycode>"
|
||||
+ "<description>My Description</description>"
|
||||
+ "<error>90</error>"
|
||||
+ "<floor>top</floor>"
|
||||
+ "<lat>25.098345</lat>"
|
||||
+ "<locality>awesome</locality>"
|
||||
+ "<lon>77.992034</lon>"
|
||||
+ "<postalcode>110085</postalcode>"
|
||||
+ "<region>North</region>"
|
||||
+ "<room>small</room>"
|
||||
+ "<speed>250.0</speed>"
|
||||
+ "<street>Wall Street</street>"
|
||||
+ "<text>Unit Testing GeoLocation</text>"
|
||||
+ "<timestamp>2004-02-19</timestamp>"
|
||||
+ "<tzo>+5:30</tzo>"
|
||||
+ "<uri>http://xmpp.org</uri>"
|
||||
+ "</geoloc>"
|
||||
+ "</message>";
|
||||
// @formatter:on
|
||||
|
||||
Message messageWithGeoLocation = (Message) PacketParserUtils.parseStanza(geoLocationMessageString);
|
||||
|
|
|
@ -35,32 +35,32 @@ public class GeoLocationProviderTest extends InitExtensions {
|
|||
public void testGeoLocationProviderWithNoDatumSet() throws Exception {
|
||||
// @formatter:off
|
||||
final String geoLocationString = "<message from='portia@merchantofvenice.lit'"
|
||||
+" to='bassanio@merchantofvenice.lit'>"
|
||||
+"<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+"<accuracy>23</accuracy>"
|
||||
+"<alt>1000</alt>"
|
||||
+"<area>Delhi</area>"
|
||||
+"<bearing>10</bearing>"
|
||||
+"<building>Small Building</building>"
|
||||
+"<country>India</country>"
|
||||
+"<countrycode>IN</countrycode>"
|
||||
+"<description>My Description</description>"
|
||||
+"<error>90</error>"
|
||||
+"<floor>top</floor>"
|
||||
+"<lat>25.098345</lat>"
|
||||
+"<locality>awesome</locality>"
|
||||
+"<lon>77.992034</lon>"
|
||||
+"<postalcode>110085</postalcode>"
|
||||
+"<region>North</region>"
|
||||
+"<room>small</room>"
|
||||
+"<speed>250.0</speed>"
|
||||
+"<street>Wall Street</street>"
|
||||
+"<text>Unit Testing GeoLocation</text>"
|
||||
+"<timestamp>2004-02-19</timestamp>"
|
||||
+"<tzo>+5:30</tzo>"
|
||||
+"<uri>http://xmpp.org</uri>"
|
||||
+"</geoloc>"
|
||||
+"</message>";
|
||||
+ " to='bassanio@merchantofvenice.lit'>"
|
||||
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+ "<accuracy>23</accuracy>"
|
||||
+ "<alt>1000</alt>"
|
||||
+ "<area>Delhi</area>"
|
||||
+ "<bearing>10</bearing>"
|
||||
+ "<building>Small Building</building>"
|
||||
+ "<country>India</country>"
|
||||
+ "<countrycode>IN</countrycode>"
|
||||
+ "<description>My Description</description>"
|
||||
+ "<error>90</error>"
|
||||
+ "<floor>top</floor>"
|
||||
+ "<lat>25.098345</lat>"
|
||||
+ "<locality>awesome</locality>"
|
||||
+ "<lon>77.992034</lon>"
|
||||
+ "<postalcode>110085</postalcode>"
|
||||
+ "<region>North</region>"
|
||||
+ "<room>small</room>"
|
||||
+ "<speed>250.0</speed>"
|
||||
+ "<street>Wall Street</street>"
|
||||
+ "<text>Unit Testing GeoLocation</text>"
|
||||
+ "<timestamp>2004-02-19</timestamp>"
|
||||
+ "<tzo>+5:30</tzo>"
|
||||
+ "<uri>http://xmpp.org</uri>"
|
||||
+ "</geoloc>"
|
||||
+ "</message>";
|
||||
// @formatter:on
|
||||
|
||||
Message messageWithGeoLocation = (Message) PacketParserUtils.parseStanza(geoLocationString);
|
||||
|
@ -101,33 +101,33 @@ public class GeoLocationProviderTest extends InitExtensions {
|
|||
|
||||
// @formatter:off
|
||||
final String geoLocationString = "<message from='portia@merchantofvenice.lit'"
|
||||
+" to='bassanio@merchantofvenice.lit'>"
|
||||
+"<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+"<accuracy>23</accuracy>"
|
||||
+"<alt>1000</alt>"
|
||||
+"<area>Delhi</area>"
|
||||
+"<bearing>10</bearing>"
|
||||
+"<building>Small Building</building>"
|
||||
+"<country>India</country>"
|
||||
+"<countrycode>IN</countrycode>"
|
||||
+"<datum>Test Datum</datum>"
|
||||
+"<description>My Description</description>"
|
||||
+"<error>90</error>"
|
||||
+"<floor>top</floor>"
|
||||
+"<lat>25.098345</lat>"
|
||||
+"<locality>awesome</locality>"
|
||||
+"<lon>77.992034</lon>"
|
||||
+"<postalcode>110085</postalcode>"
|
||||
+"<region>North</region>"
|
||||
+"<room>small</room>"
|
||||
+"<speed>250.0</speed>"
|
||||
+"<street>Wall Street</street>"
|
||||
+"<text>Unit Testing GeoLocation</text>"
|
||||
+"<timestamp>2004-02-19</timestamp>"
|
||||
+"<tzo>+5:30</tzo>"
|
||||
+"<uri>http://xmpp.org</uri>"
|
||||
+"</geoloc>"
|
||||
+"</message>";
|
||||
+ " to='bassanio@merchantofvenice.lit'>"
|
||||
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+ "<accuracy>23</accuracy>"
|
||||
+ "<alt>1000</alt>"
|
||||
+ "<area>Delhi</area>"
|
||||
+ "<bearing>10</bearing>"
|
||||
+ "<building>Small Building</building>"
|
||||
+ "<country>India</country>"
|
||||
+ "<countrycode>IN</countrycode>"
|
||||
+ "<datum>Test Datum</datum>"
|
||||
+ "<description>My Description</description>"
|
||||
+ "<error>90</error>"
|
||||
+ "<floor>top</floor>"
|
||||
+ "<lat>25.098345</lat>"
|
||||
+ "<locality>awesome</locality>"
|
||||
+ "<lon>77.992034</lon>"
|
||||
+ "<postalcode>110085</postalcode>"
|
||||
+ "<region>North</region>"
|
||||
+ "<room>small</room>"
|
||||
+ "<speed>250.0</speed>"
|
||||
+ "<street>Wall Street</street>"
|
||||
+ "<text>Unit Testing GeoLocation</text>"
|
||||
+ "<timestamp>2004-02-19</timestamp>"
|
||||
+ "<tzo>+5:30</tzo>"
|
||||
+ "<uri>http://xmpp.org</uri>"
|
||||
+ "</geoloc>"
|
||||
+ "</message>";
|
||||
// @formatter:on
|
||||
|
||||
Message messageWithGeoLocation = (Message) PacketParserUtils.parseStanza(geoLocationString);
|
||||
|
@ -168,11 +168,11 @@ public class GeoLocationProviderTest extends InitExtensions {
|
|||
|
||||
// @formatter:off
|
||||
final String geoLocationString = "<message from='portia@merchantofvenice.lit'"
|
||||
+" to='bassanio@merchantofvenice.lit'>"
|
||||
+"<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+"<error>90</error>"
|
||||
+"</geoloc>"
|
||||
+"</message>";
|
||||
+ " to='bassanio@merchantofvenice.lit'>"
|
||||
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+ "<error>90</error>"
|
||||
+ "</geoloc>"
|
||||
+ "</message>";
|
||||
// @formatter:on
|
||||
|
||||
Message messageWithGeoLocation = (Message) PacketParserUtils.parseStanza(geoLocationString);
|
||||
|
@ -188,11 +188,11 @@ public class GeoLocationProviderTest extends InitExtensions {
|
|||
|
||||
// @formatter:off
|
||||
final String geoLocationString = "<message from='portia@merchantofvenice.lit'"
|
||||
+" to='bassanio@merchantofvenice.lit'>"
|
||||
+"<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+"<accuracy>90</accuracy>"
|
||||
+"</geoloc>"
|
||||
+"</message>";
|
||||
+ " to='bassanio@merchantofvenice.lit'>"
|
||||
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+ "<accuracy>90</accuracy>"
|
||||
+ "</geoloc>"
|
||||
+ "</message>";
|
||||
// @formatter:on
|
||||
|
||||
Message messageWithGeoLocation = (Message) PacketParserUtils.parseStanza(geoLocationString);
|
||||
|
@ -208,12 +208,12 @@ public class GeoLocationProviderTest extends InitExtensions {
|
|||
|
||||
// @formatter:off
|
||||
final String geoLocationString = "<message from='portia@merchantofvenice.lit'"
|
||||
+" to='bassanio@merchantofvenice.lit'>"
|
||||
+"<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+"<accuracy>90</accuracy>"
|
||||
+"<error>100</error>"
|
||||
+"</geoloc>"
|
||||
+"</message>";
|
||||
+ " to='bassanio@merchantofvenice.lit'>"
|
||||
+ "<geoloc xmlns='http://jabber.org/protocol/geoloc'>"
|
||||
+ "<accuracy>90</accuracy>"
|
||||
+ "<error>100</error>"
|
||||
+ "</geoloc>"
|
||||
+ "</message>";
|
||||
// @formatter:on
|
||||
|
||||
Message messageWithGeoLocation = (Message) PacketParserUtils.parseStanza(geoLocationString);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ConfigureFormTest extends InitExtensions
|
|||
}
|
||||
}
|
||||
|
||||
@Test (expected=SmackException.class)
|
||||
@Test(expected = SmackException.class)
|
||||
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
|
|
|
@ -111,11 +111,11 @@ public class ItemValidationTest extends InitExtensions {
|
|||
assertEquals(EventElementType.items, event.getEventType());
|
||||
assertEquals(1, event.getExtensions().size());
|
||||
assertTrue(event.getExtensions().get(0) instanceof ItemsExtension);
|
||||
assertEquals(1, ((ItemsExtension)event.getExtensions().get(0)).items.size());
|
||||
assertEquals(1, ((ItemsExtension) event.getExtensions().get(0)).items.size());
|
||||
|
||||
ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
ExtensionElement itemExt = ((ItemsExtension) event.getExtensions().get(0)).items.get(0);
|
||||
assertTrue(itemExt instanceof Item);
|
||||
assertEquals("testid1", ((Item)itemExt).getId());
|
||||
assertEquals("testid1", ((Item) itemExt).getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -137,10 +137,10 @@ public class ItemValidationTest extends InitExtensions {
|
|||
Stanza message = PacketParserUtils.parseMessage(parser);
|
||||
ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = (EventElement) eventExt;
|
||||
ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
ExtensionElement itemExt = ((ItemsExtension) event.getExtensions().get(0)).items.get(0);
|
||||
|
||||
assertTrue(itemExt instanceof PayloadItem<?>);
|
||||
PayloadItem<?> item = (PayloadItem<?>)itemExt;
|
||||
PayloadItem<?> item = (PayloadItem<?>) itemExt;
|
||||
|
||||
assertEquals("testid1", item.getId());
|
||||
assertTrue(item.getPayload() instanceof SimplePayload);
|
||||
|
@ -184,10 +184,10 @@ public class ItemValidationTest extends InitExtensions {
|
|||
Stanza message = PacketParserUtils.parseMessage(parser);
|
||||
ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = (EventElement) eventExt;
|
||||
ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
ExtensionElement itemExt = ((ItemsExtension) event.getExtensions().get(0)).items.get(0);
|
||||
|
||||
assertTrue(itemExt instanceof PayloadItem<?>);
|
||||
PayloadItem<?> item = (PayloadItem<?>)itemExt;
|
||||
PayloadItem<?> item = (PayloadItem<?>) itemExt;
|
||||
|
||||
assertEquals("testid1", item.getId());
|
||||
assertTrue(item.getPayload() instanceof SimplePayload);
|
||||
|
@ -222,15 +222,15 @@ public class ItemValidationTest extends InitExtensions {
|
|||
assertEquals(EventElementType.items, event.getEventType());
|
||||
assertEquals(1, event.getExtensions().size());
|
||||
assertTrue(event.getExtensions().get(0) instanceof ItemsExtension);
|
||||
assertEquals(1, ((ItemsExtension)event.getExtensions().get(0)).items.size());
|
||||
assertEquals(1, ((ItemsExtension) event.getExtensions().get(0)).items.size());
|
||||
|
||||
ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
ExtensionElement itemExt = ((ItemsExtension) event.getExtensions().get(0)).items.get(0);
|
||||
assertTrue(itemExt instanceof PayloadItem<?>);
|
||||
PayloadItem<?> item = (PayloadItem<?>)itemExt;
|
||||
PayloadItem<?> item = (PayloadItem<?>) itemExt;
|
||||
|
||||
assertEquals("testid1", item.getId());
|
||||
assertTrue(item.getPayload() instanceof SimplePayload);
|
||||
|
||||
assertXMLEqual(itemContent, ((SimplePayload)item.getPayload()).toXML().toString());
|
||||
assertXMLEqual(itemContent, ((SimplePayload) item.getPayload()).toXML().toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class DeliveryReceiptTest extends InitExtensions {
|
|||
parser = PacketParserUtils.getParserFor(control);
|
||||
Message p = PacketParserUtils.parseMessage(parser);
|
||||
|
||||
DeliveryReceiptRequest drr = (DeliveryReceiptRequest)p.getExtension(
|
||||
DeliveryReceiptRequest drr = (DeliveryReceiptRequest) p.getExtension(
|
||||
DeliveryReceiptRequest.ELEMENT, DeliveryReceipt.NAMESPACE);
|
||||
assertNotNull(drr);
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class DataLayoutTest {
|
|||
assertEquals("Label - & \u00E9 \u00E1 ", layout.getLabel());
|
||||
section = (Section) layout.getPageLayout().get(1);
|
||||
assertEquals("section Label - & \u00E9 \u00E1 ", section.getLabel());
|
||||
Text text = (Text)layout.getPageLayout().get(2);
|
||||
Text text = (Text) layout.getPageLayout().get(2);
|
||||
assertEquals("PageText - & \u00E9 \u00E1 ", text.getText());
|
||||
section = (Section) layout.getPageLayout().get(3);
|
||||
assertEquals("<html>Number of Persons by<br/> Nationality and Status</html>", section.getLabel());
|
||||
|
@ -155,7 +155,7 @@ public class DataLayoutTest {
|
|||
assertEquals("Label - & \u00E9 \u00E1 ", layout.getLabel());
|
||||
Section section = (Section) layout.getPageLayout().get(1);
|
||||
assertEquals("section Label - & \u00E9 \u00E1 ", section.getLabel());
|
||||
Text text = (Text)layout.getPageLayout().get(2);
|
||||
Text text = (Text) layout.getPageLayout().get(2);
|
||||
assertEquals("PageText - & \u00E9 \u00E1 ", text.getText());
|
||||
section = (Section) layout.getPageLayout().get(3);
|
||||
assertEquals("<html>Number of Persons by<br/> Nationality and Status</html>", section.getLabel());
|
||||
|
|
|
@ -122,7 +122,7 @@ public class DataValidationTest {
|
|||
assertEquals(TEST_OUTPUT_RANGE2, output);
|
||||
}
|
||||
|
||||
@Test(expected=NumberFormatException.class)
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testRangeFailure() throws IOException, XmlPullParserException {
|
||||
XmlPullParser parser = getParser(TEST_OUTPUT_FAIL);
|
||||
DataValidationProvider.parse(parser);
|
||||
|
|
|
@ -126,7 +126,7 @@ public class Chat {
|
|||
* @param listener a stanza(/packet) listener.
|
||||
*/
|
||||
public void addMessageListener(ChatMessageListener listener) {
|
||||
if(listener == null) {
|
||||
if (listener == null) {
|
||||
return;
|
||||
}
|
||||
// TODO these references should be weak.
|
||||
|
@ -202,7 +202,7 @@ public class Chat {
|
|||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Chat
|
||||
&& threadID.equals(((Chat)obj).getThreadID())
|
||||
&& participant.equals(((Chat)obj).getParticipant());
|
||||
&& threadID.equals(((Chat) obj).getThreadID())
|
||||
&& participant.equals(((Chat) obj).getParticipant());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public final class ChatManager extends Manager{
|
|||
chat = getThreadChat(message.getThread());
|
||||
}
|
||||
|
||||
if(chat == null) {
|
||||
if (chat == null) {
|
||||
chat = createChat(message);
|
||||
}
|
||||
// The chat could not be created, abort here
|
||||
|
@ -248,7 +248,7 @@ public final class ChatManager extends Manager{
|
|||
thread = nextID();
|
||||
}
|
||||
Chat chat = threadChats.get(thread);
|
||||
if(chat != null) {
|
||||
if (chat != null) {
|
||||
throw new IllegalArgumentException("ThreadID is already used");
|
||||
}
|
||||
chat = createChat(userJID, thread, true);
|
||||
|
@ -262,7 +262,7 @@ public final class ChatManager extends Manager{
|
|||
jidChats.put(userJID, chat);
|
||||
baseJidChats.put(userJID.asEntityBareJid(), chat);
|
||||
|
||||
for(ChatManagerListener listener : chatManagerListeners) {
|
||||
for (ChatManagerListener listener : chatManagerListeners) {
|
||||
listener.chatCreated(chat, createdLocally);
|
||||
}
|
||||
|
||||
|
@ -293,11 +293,11 @@ public final class ChatManager extends Manager{
|
|||
|
||||
EntityJid userJID = from.asEntityJidIfPossible();
|
||||
if (userJID == null) {
|
||||
LOGGER.warning("Message from JID without localpart: '" +message.toXML() + "'");
|
||||
LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'");
|
||||
return null;
|
||||
}
|
||||
String threadID = message.getThread();
|
||||
if(threadID == null) {
|
||||
if (threadID == null) {
|
||||
threadID = nextID();
|
||||
}
|
||||
|
||||
|
@ -372,9 +372,9 @@ public final class ChatManager extends Manager{
|
|||
}
|
||||
|
||||
void sendMessage(Chat chat, Message message) throws NotConnectedException, InterruptedException {
|
||||
for(Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) {
|
||||
for (Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) {
|
||||
StanzaFilter filter = interceptor.getValue();
|
||||
if(filter != null && filter.accept(message)) {
|
||||
if (filter != null && filter.accept(message)) {
|
||||
interceptor.getKey().processMessage(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ public final class Roster extends Manager {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void reload() throws NotLoggedInException, NotConnectedException, InterruptedException{
|
||||
public void reload() throws NotLoggedInException, NotConnectedException, InterruptedException {
|
||||
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
||||
|
||||
RosterPacket packet = new RosterPacket();
|
||||
|
@ -1307,7 +1307,7 @@ public final class Roster extends Manager {
|
|||
|
||||
// Remove user from the remaining groups.
|
||||
List<String> oldGroupNames = new ArrayList<String>();
|
||||
for (RosterGroup group: getGroups()) {
|
||||
for (RosterGroup group : getGroups()) {
|
||||
oldGroupNames.add(group.getName());
|
||||
}
|
||||
oldGroupNames.removeAll(newGroupNames);
|
||||
|
@ -1329,7 +1329,7 @@ public final class Roster extends Manager {
|
|||
move(user, presenceMap, nonRosterPresenceMap);
|
||||
deletedEntries.add(user);
|
||||
|
||||
for (Entry<String,RosterGroup> e: groups.entrySet()) {
|
||||
for (Entry<String,RosterGroup> e : groups.entrySet()) {
|
||||
RosterGroup group = e.getValue();
|
||||
group.removeEntryLocal(entry);
|
||||
if (group.getEntryCount() == 0) {
|
||||
|
|
|
@ -123,7 +123,7 @@ public final class RosterEntry extends Manager {
|
|||
* @param subscriptionPending TODO
|
||||
*/
|
||||
void updateItem(RosterPacket.Item item) {
|
||||
assert(item != null);
|
||||
assert (item != null);
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public final class RosterEntry extends Manager {
|
|||
List<RosterGroup> results = new ArrayList<RosterGroup>();
|
||||
// Loop through all roster groups and find the ones that contain this
|
||||
// entry. This algorithm should be fine
|
||||
for (RosterGroup group: roster.getGroups()) {
|
||||
for (RosterGroup group : roster.getGroups()) {
|
||||
if (group.contains(this)) {
|
||||
results.add(group);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public final class RosterEntry extends Manager {
|
|||
return true;
|
||||
}
|
||||
if (object != null && object instanceof RosterEntry) {
|
||||
return getJid().equals(((RosterEntry)object).getJid());
|
||||
return getJid().equals(((RosterEntry) object).getJid());
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
switch(eventType) {
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
String startTag = parser.getName();
|
||||
switch (startTag) {
|
||||
|
@ -53,7 +53,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
String endTag = parser.getName();
|
||||
switch(endTag) {
|
||||
switch (endTag) {
|
||||
case IQ.QUERY_ELEMENT:
|
||||
if (parser.getDepth() == initialDepth) {
|
||||
break outerloop;
|
||||
|
@ -84,7 +84,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
boolean approved = ParserUtils.getBooleanAttribute(parser, "approved", false);
|
||||
item.setApproved(approved);
|
||||
|
||||
outerloop: while(true) {
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
|
@ -106,7 +106,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
}
|
||||
}
|
||||
ParserUtils.assertAtEndTag(parser);
|
||||
assert(item != null);
|
||||
assert (item != null);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue