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

Add more checkstyle tests

- Lines containing tab(s) after space
- Usage of printStackTrace
- Usage of println
- Add SupressionCommentFilter module

SuppressionCommentFilter can be enabled with
// CHECKSTYLE:OFF
and disabled with
// CHECKSTYLE:ON
This commit is contained in:
Florian Schmaus 2015-03-17 21:19:06 +01:00
parent 4f64bb1036
commit b2221d5483
59 changed files with 382 additions and 202 deletions

View file

@ -153,7 +153,9 @@ public class ChatManager extends Manager{
Message message = (Message) packet;
Chat chat;
if (message.getThread() == null) {
// CHECKSTYLE:OFF
chat = getUserChat(message.getFrom());
// CHECKSTYLE:ON
}
else {
chat = getThreadChat(message.getThread());

View file

@ -122,7 +122,7 @@ public class DirectoryRosterStore implements RosterStore {
for (File file : fileDir.listFiles(rosterDirFilter)) {
Item entry = readEntry(file);
if (entry == null) {
log("Roster store file '" + file + "' is invalid.");
LOGGER.severe("Roster store file '" + file + "' is invalid.");
}
else {
entries.add(entry);
@ -228,7 +228,7 @@ public class DirectoryRosterStore implements RosterStore {
groupNames.add(group);
}
else {
log("Invalid group entry in store entry file "
LOGGER.severe("Invalid group entry in store entry file "
+ file);
}
}
@ -245,9 +245,7 @@ public class DirectoryRosterStore implements RosterStore {
return null;
}
catch (XmlPullParserException e) {
log("Invalid group entry in store entry file "
+ file);
LOGGER.log(Level.SEVERE, "readEntry()", e);
LOGGER.log(Level.SEVERE, "Invalid group entry in store entry file", e);
return null;
}
@ -264,14 +262,14 @@ public class DirectoryRosterStore implements RosterStore {
item.setItemType(RosterPacket.ItemType.valueOf(type));
}
catch (IllegalArgumentException e) {
log("Invalid type in store entry file " + file);
LOGGER.log(Level.SEVERE, "Invalid type in store entry file " + file, e);
return null;
}
if (status != null) {
RosterPacket.ItemStatus itemStatus = RosterPacket.ItemStatus
.fromString(status);
if (itemStatus == null) {
log("Invalid status in store entry file " + file);
LOGGER.severe("Invalid status in store entry file " + file);
return null;
}
item.setItemStatus(itemStatus);
@ -304,8 +302,4 @@ public class DirectoryRosterStore implements RosterStore {
String encodedJid = Base32.encode(bareJid.toString());
return new File(fileDir, ENTRY_PREFIX + encodedJid);
}
private void log(String error) {
System.err.println(error);
}
}

View file

@ -31,7 +31,6 @@ import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.im.InitSmackIm;
@ -716,38 +715,20 @@ public class RosterTest extends InitSmackIm {
public synchronized void entriesAdded(Collection<Jid> addresses) {
addressesAdded.addAll(addresses);
if (SmackConfiguration.DEBUG) {
for (Jid address : addresses) {
System.out.println("Roster entry for " + address + " added.");
}
}
reportInvoked();
}
public synchronized void entriesDeleted(Collection<Jid> addresses) {
addressesDeleted.addAll(addresses);
if (SmackConfiguration.DEBUG) {
for (Jid address : addresses) {
System.out.println("Roster entry for " + address + " deleted.");
}
}
reportInvoked();
}
public synchronized void entriesUpdated(Collection<Jid> addresses) {
addressesUpdated.addAll(addresses);
if (SmackConfiguration.DEBUG) {
for (Jid address : addresses) {
System.out.println("Roster entry for " + address + " updated.");
}
}
reportInvoked();
}
public void presenceChanged(Presence presence) {
if (SmackConfiguration.DEBUG) {
System.out.println("Roster presence changed: " + presence.toXML());
}
reportInvoked();
}