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

More checkstyle whitespace related checks

This commit is contained in:
Florian Schmaus 2017-05-23 16:45:04 +02:00
parent 847890b037
commit ce1cddc722
140 changed files with 583 additions and 512 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -232,7 +232,7 @@ public abstract class ScramMechanism extends SASLMechanism {
}
String cbName = getChannelBindingName();
assert(StringUtils.isNotEmpty(cbName));
assert (StringUtils.isNotEmpty(cbName));
return cbName + ',' + authzidPortion + ",";
}

View file

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

View file

@ -143,7 +143,7 @@ public class MultiMap<K,V> {
if (res == null) {
return null;
}
assert(!res.isEmpty());
assert (!res.isEmpty());
return res.iterator().next();
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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