1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 13:32:07 +01:00

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="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>
<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"> <module name="RegexpSingleline">
<!-- <!--
Explaining the following Regex Explaining the following Regex

View file

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

View file

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

View file

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

View file

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

View file

@ -187,8 +187,10 @@ public abstract class FileTransfer {
protected void setStatus(Status status) { protected void setStatus(Status status) {
synchronized (statusMonitor) { synchronized (statusMonitor) {
// CHECKSTYLE:OFF
this.status = status; this.status = status;
} }
// CHECKSTYLE:ON
} }
protected boolean updateStatus(Status oldStatus, Status newStatus) { 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) protected final IQ initiateIncomingStream(final XMPPConnection connection, StreamInitiation initiation)
// CHECKSTYLE:OFF
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// CHECKSTYLE:ON
final StreamInitiation response = createInitiationAccept(initiation, final StreamInitiation response = createInitiationAccept(initiation,
getNamespaces()); getNamespaces());

View file

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

View file

@ -36,6 +36,8 @@ public class EventProvider extends EmbeddedExtensionProvider<EventElement>
@Override @Override
protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends ExtensionElement> content) 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)); 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; public final static int URL_SAFE = 16;
/** /**
* Encode using the special "ordered" dialect of Base64 described here: * 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>. * <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; public final static int ORDERED = 32;