1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

Add checkstyle check for trailing whitespace

This commit is contained in:
Florian Schmaus 2015-03-18 21:01:49 +01:00
parent b8f046706b
commit 8878cf3773
14 changed files with 35 additions and 22 deletions

View file

@ -27,12 +27,25 @@
<property name="format" value="^ +\t+"/> <property name="format" value="^ +\t+"/>
<property name="message" value="Line containing tab(s) after space"/> <property name="message" value="Line containing tab(s) after space"/>
</module> </module>
<!-- TODO enable this once eclilpse does no longer add javadoc with trailing whitespaces
<module name="RegexpSingleline"> <module name="RegexpSingleline">
<property name="format" value="^.*\S+\s+$"/> <!--
Explaining the following Regex
^ \s* [\S && [^ \*/]]+ \s+ $
| | | | | +- End of Line (6)
| | | | +- At least one whitespace (5)
| | | +- At least one or more of the previous character class (4)
| | +- All non-whitespace characters except '*' and '/' (to exclude javadoc) (3)
| +- Zero or more space characters (2)
+- Start of Line (1)
Rationale:
Matches trailing whitespace (5) in lines containing at least one (4) non-whitespace character
that is not one of the characters used by javadoc (3).
-->
<property name="format" value="^\s*[\S&amp;&amp;[^\*/]]+\s+$"/>
<property name="message" value="Line containing trailing whitespace character(s)"/> <property name="message" value="Line containing trailing whitespace character(s)"/>
</module> </module>
-->
<module name="TreeWalker"> <module name="TreeWalker">
<module name="FileContentsHolder"/> <module name="FileContentsHolder"/>
<module name="UnusedImports"> <module name="UnusedImports">

View file

@ -205,7 +205,7 @@ public class Socks4ProxySocketFactory
{ {
try try
{ {
if(socket!=null)socket.close(); if(socket!=null)socket.close();
} }
catch(Exception eee) catch(Exception eee)
{ {

View file

@ -340,7 +340,7 @@ public class Socks5ProxySocketFactory
{ {
if(socket!=null) if(socket!=null)
{ {
socket.close(); socket.close();
} }
} }
catch(Exception eee) catch(Exception eee)

View file

@ -254,7 +254,7 @@ public class DNSUtil {
} else { } else {
double rnd = Math.random() * running_total; double rnd = Math.random() * running_total;
selectedPos = bisect(totals, rnd); selectedPos = bisect(totals, rnd);
} }
// add the SRVRecord that was randomly chosen on it's weight // add the SRVRecord that was randomly chosen on it's weight
// to the start of the result list // to the start of the result list
SRVRecord chosenSRVRecord = bucket.remove(selectedPos); SRVRecord chosenSRVRecord = bucket.remove(selectedPos);

View file

@ -232,7 +232,7 @@ public class PacketParserUtils {
if (language != null && !"".equals(language.trim())) { if (language != null && !"".equals(language.trim())) {
message.setLanguage(language); message.setLanguage(language);
defaultLanguage = language; defaultLanguage = language;
} }
else { else {
defaultLanguage = Stanza.getDefaultLanguage(); defaultLanguage = Stanza.getDefaultLanguage();
} }

View file

@ -37,7 +37,7 @@ public class SmackConfigurationTest {
// As there is currently no annotation/way to run a testclass/single test in a separate VM, // As there is currently no annotation/way to run a testclass/single test in a separate VM,
// which is required for reliable results of this test, and we don't want to fork a VM for // which is required for reliable results of this test, and we don't want to fork a VM for
// *every* test, those tests are currently disabled. Hopefully this will change in the future. // *every* test, those tests are currently disabled. Hopefully this will change in the future.
@Ignore @Ignore
@Test @Test
public void smackConfigurationShouldNotCauseInitializationTest() { public void smackConfigurationShouldNotCauseInitializationTest() {
SmackConfiguration.getDefaultPacketReplyTimeout(); SmackConfiguration.getDefaultPacketReplyTimeout();
@ -49,7 +49,7 @@ public class SmackConfigurationTest {
// As there is currently no annotation/way to run a testclass/single test in a separate VM, // As there is currently no annotation/way to run a testclass/single test in a separate VM,
// which is required for reliable results of this test, and we don't want to fork a VM for // which is required for reliable results of this test, and we don't want to fork a VM for
// *every* test, those tests are currently disabled. Hopefully this will change in the future. // *every* test, those tests are currently disabled. Hopefully this will change in the future.
@Ignore @Ignore
@Test @Test
public void smackconfigurationVersionShouldInitialzieSmacktTest() { public void smackconfigurationVersionShouldInitialzieSmacktTest() {
SmackConfiguration.getVersion(); SmackConfiguration.getVersion();

View file

@ -475,7 +475,7 @@ public class MUCUser implements ExtensionElement {
if (other instanceof Status) { if (other instanceof Status) {
Status otherStatus = (Status) other; Status otherStatus = (Status) other;
return code.equals(otherStatus.getCode()); return code.equals(otherStatus.getCode());
} }
return false; return false;
} }

View file

@ -25,19 +25,19 @@ package org.jivesoftware.smackx.pubsub;
public enum EventElementType public enum EventElementType
{ {
/** A node has been associated or dissassociated with a collection node */ /** A node has been associated or dissassociated with a collection node */
collection, collection,
/** A node has had its configuration changed */ /** A node has had its configuration changed */
configuration, configuration,
/** A node has been deleted */ /** A node has been deleted */
delete, delete,
/** Items have been published to a node */ /** Items have been published to a node */
items, items,
/** All items have been purged from a node */ /** All items have been purged from a node */
purge, purge,
/** A node has been subscribed to */ /** A node has been subscribed to */
subscription subscription

View file

@ -39,7 +39,7 @@ import org.jivesoftware.smackx.xdata.packet.DataForm;
* @author Robin Collier * @author Robin Collier
*/ */
public class SubscribeForm extends Form public class SubscribeForm extends Form
{ {
public SubscribeForm(DataForm configDataForm) public SubscribeForm(DataForm configDataForm)
{ {
super(configDataForm); super(configDataForm);

View file

@ -48,7 +48,7 @@ public class ItemProvider extends ExtensionElementProvider<Item>
{ {
return new Item(id, node); return new Item(id, node);
} }
else else
{ {
String payloadElemName = parser.getName(); String payloadElemName = parser.getName();
String payloadNS = parser.getNamespace(); String payloadNS = parser.getNamespace();
@ -59,7 +59,7 @@ public class ItemProvider extends ExtensionElementProvider<Item>
CharSequence payloadText = PacketParserUtils.parseElement(parser, true); CharSequence payloadText = PacketParserUtils.parseElement(parser, true);
return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText)); return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText));
} }
else else
{ {
return new PayloadItem<ExtensionElement>(id, node, extensionProvider.parse(parser)); return new PayloadItem<ExtensionElement>(id, node, extensionProvider.parse(parser));
} }

View file

@ -100,7 +100,7 @@ public class ChatManager extends Manager{
* Will attempt to match on the JID in the from field, and then attempt the base JID if no match was found. * Will attempt to match on the JID in the from field, and then attempt the base JID if no match was found.
* This is the most lenient matching. * This is the most lenient matching.
*/ */
BARE_JID; BARE_JID;
} }
private final StanzaFilter packetFilter = new OrFilter(MessageTypeFilter.CHAT, new FlexibleStanzaTypeFilter<Message>() { private final StanzaFilter packetFilter = new OrFilter(MessageTypeFilter.CHAT, new FlexibleStanzaTypeFilter<Message>() {

View file

@ -102,7 +102,7 @@ public class OctTreeQuantizer implements Quantizer {
if (colors > reduceColors) if (colors > reduceColors)
reduceTree(reduceColors); reduceTree(reduceColors);
} }
} }
/** /**
* Get the color table index for a color. * Get the color table index for a color.

View file

@ -102,7 +102,7 @@ public class TcpUdpBridgeClient {
InputStream in = localTcpSocket.getInputStream(); InputStream in = localTcpSocket.getInputStream();
InetAddress remoteHost = InetAddress.getByName(remoteUdpHost); InetAddress remoteHost = InetAddress.getByName(remoteUdpHost);
process.start(); process.start();
while (true) { while (true) {
byte[] b = new byte[500]; byte[] b = new byte[500];

View file

@ -173,7 +173,7 @@ public class QueueDetails implements ExtensionElement {
eventType = parser.next(); eventType = parser.next();
while ((eventType != XmlPullParser.END_TAG) while ((eventType != XmlPullParser.END_TAG)
|| (! "user".equals(parser.getName()))) || (! "user".equals(parser.getName())))
{ {
if ("position".equals(parser.getName())) { if ("position".equals(parser.getName())) {
position = Integer.parseInt(parser.nextText()); position = Integer.parseInt(parser.nextText());
} }