Add checkstyle check for space(s) after tab(s)

This commit is contained in:
Florian Schmaus 2015-03-18 21:51:25 +01:00
parent 8878cf3773
commit 5188c6f934
11 changed files with 52 additions and 29 deletions

View File

@ -27,6 +27,12 @@
<property name="format" value="^ +\t+"/>
<property name="message" value="Line containing tab(s) after space"/>
</module>
<module name="RegexpSingleline">
<!-- We use {2,} instead of + here to address the typical case where a file was written
with tabs but javadoc is causing '\t *' -->
<property name="format" value="^\t+ {2,}"/>
<property name="message" value="Line containing space(s) after tab(s)"/>
</module>
<module name="RegexpSingleline">
<!--
Explaining the following Regex

View File

@ -92,13 +92,12 @@ public class ServerPingWithAlarmManager extends Manager {
super(connection);
}
/**
* If enabled, ServerPingWithAlarmManager will call
* {@link PingManager#pingServerIfNecessary()} for the connection of this
* instance every half hour.
*
* @param enabled
*/
/**
* If enabled, ServerPingWithAlarmManager will call {@link PingManager#pingServerIfNecessary()}
* for the connection of this instance every half hour.
*
* @param enabled
*/
public void setEnabled(boolean enabled) {
mEnabled = enabled;
}
@ -144,14 +143,13 @@ public class ServerPingWithAlarmManager extends Manager {
private static PendingIntent sPendingIntent;
private static AlarmManager sAlarmManager;
/**
* Register a pending intent with the AlarmManager to be broadcasted every
* half hour and register the alarm broadcast receiver to receive this
* intent. The receiver will check all known questions if a ping is
* Necessary when invoked by the alarm intent.
*
* @param context
*/
/**
* Register a pending intent with the AlarmManager to be broadcasted every half hour and
* register the alarm broadcast receiver to receive this intent. The receiver will check all
* known questions if a ping is Necessary when invoked by the alarm intent.
*
* @param context
*/
public static void onCreate(Context context) {
sContext = context;
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
@ -162,9 +160,9 @@ public class ServerPingWithAlarmManager extends Manager {
AlarmManager.INTERVAL_HALF_HOUR, sPendingIntent);
}
/**
* Unregister the alarm broadcast receiver and cancel the alarm.
*/
/**
* Unregister the alarm broadcast receiver and cancel the alarm.
*/
public static void onDestroy() {
sContext.unregisterReceiver(ALARM_BROADCAST_RECEIVER);
sAlarmManager.cancel(sPendingIntent);

View File

@ -61,10 +61,10 @@ public class PacketCollectorTest
assertNull(collector.nextResult(1000));
}
/**
* Although this doesn't guarentee anything due to the nature of threading, it can
* potentially catch problems.
*/
/**
* Although this doesn't guarentee anything due to the nature of threading, it can potentially
* catch problems.
*/
@Test
public void verifyThreadSafety()
{

View File

@ -68,7 +68,7 @@ public class StringUtilsTest {
}
public static void assertCharSequenceEquals(CharSequence expected, CharSequence actual) {
assertEquals(expected.toString(), actual.toString());
assertEquals(expected.toString(), actual.toString());
}
@Test

View File

@ -354,6 +354,7 @@ public class EnhancedDebugger implements SmackDebugger {
menu.add(menuItem1);
// Add listener to the text area so the popup menu can come up.
messageTextArea.addMouseListener(new PopupListener(menu));
// CHECKSTYLE:OFF
JPanel sublayout = new JPanel(new BorderLayout());
sublayout.add(new JScrollPane(messageTextArea), BorderLayout.CENTER);
@ -365,9 +366,9 @@ public class EnhancedDebugger implements SmackDebugger {
@Override
public void actionPerformed(ActionEvent e) {
messagesTable.setRowCount(0);
}
});
// CHECKSTYLE:ON
sublayout.add(clearb, BorderLayout.NORTH);
allPane.setBottomComponent(sublayout);

View File

@ -187,8 +187,10 @@ public abstract class FileTransfer {
protected void setStatus(Status status) {
synchronized (statusMonitor) {
// CHECKSTYLE:OFF
this.status = status;
}
// CHECKSTYLE:ON
}
protected boolean updateStatus(Status oldStatus, Status newStatus) {

View File

@ -87,7 +87,9 @@ public abstract class StreamNegotiator {
}
protected final IQ initiateIncomingStream(final XMPPConnection connection, StreamInitiation initiation)
// CHECKSTYLE:OFF
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// CHECKSTYLE:ON
final StreamInitiation response = createInitiationAccept(initiation,
getNamespaces());

View File

@ -304,7 +304,9 @@ abstract public class Node
*/
public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
// CHECKSTYLE:OFF
PubSub pubSub = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
// CHECKSTYLE:ON
PubSub reply = sendPubsubPacket(pubSub);
return reply.getExtension(PubSubElementType.SUBSCRIPTION);
}
@ -330,7 +332,9 @@ abstract public class Node
*/
public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
// CHECKSTYLE:OFF
PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
// CHECKSTYLE:ON
request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
PubSub reply = PubSubManager.sendPubsubPacket(con, request);
return reply.getExtension(PubSubElementType.SUBSCRIPTION);
@ -545,7 +549,9 @@ abstract public class Node
@SuppressWarnings({ "rawtypes", "unchecked" })
public void processPacket(Stanza packet)
{
// CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
// CHECKSTYLE:ON
ItemsExtension itemsElem = (ItemsExtension)event.getEvent();
ItemPublishEvent eventItems = new ItemPublishEvent(itemsElem.getNode(), (List<Item>)itemsElem.getItems(), getSubscriptionIds(packet), DelayInformationManager.getDelayTimestamp(packet));
listener.handlePublishedItems(eventItems);
@ -569,6 +575,7 @@ abstract public class Node
public void processPacket(Stanza packet)
{
// CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
List<ExtensionElement> extList = event.getExtensions();
@ -592,6 +599,7 @@ abstract public class Node
ItemDeleteEvent eventItems = new ItemDeleteEvent(itemsElem.getNode(), items, getSubscriptionIds(packet));
listener.handleDeletedItems(eventItems);
}
// CHECKSTYLE:ON
}
}
@ -612,8 +620,10 @@ abstract public class Node
public void processPacket(Stanza packet)
{
// CHECKSTYLE:OFF
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
ConfigurationEvent config = (ConfigurationEvent)event.getEvent();
ConfigurationEvent config = (ConfigurationEvent)event.getEvent();
// CHECKSTYLE:ON
listener.handleNodeConfiguration(config);
}

View File

@ -321,10 +321,12 @@ final public class PubSubManager
static PubSub sendPubsubPacket(XMPPConnection con, Jid to, Type type, List<ExtensionElement> extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
// CHECKSTYLE:OFF
PubSub pubSub = new PubSub(to, type, ns);
for (ExtensionElement pe : extList) {
pubSub.addExtension(pe);
}
// CHECKSTYLE:ON
return sendPubsubPacket(con ,pubSub);
}

View File

@ -36,6 +36,8 @@ public class EventProvider extends EmbeddedExtensionProvider<EventElement>
@Override
protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends ExtensionElement> content)
{
// CHECKSTYLE:OFF
return new EventElement(EventElementType.valueOf(content.get(0).getElementName()), (NodeExtension)content.get(0));
// CHECKSTYLE:ON
}
}

View File

@ -63,10 +63,10 @@ public class Base64
public final static int URL_SAFE = 16;
/**
* Encode using the special "ordered" dialect of Base64 described here:
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
*/
/**
* Encode using the special "ordered" dialect of Base64 described here:
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
*/
public final static int ORDERED = 32;