mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02:00
More checkstyle whitespace related checks
This commit is contained in:
parent
847890b037
commit
ce1cddc722
140 changed files with 583 additions and 512 deletions
|
@ -126,7 +126,7 @@ public class Chat {
|
|||
* @param listener a stanza(/packet) listener.
|
||||
*/
|
||||
public void addMessageListener(ChatMessageListener listener) {
|
||||
if(listener == null) {
|
||||
if (listener == null) {
|
||||
return;
|
||||
}
|
||||
// TODO these references should be weak.
|
||||
|
@ -202,7 +202,7 @@ public class Chat {
|
|||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Chat
|
||||
&& threadID.equals(((Chat)obj).getThreadID())
|
||||
&& participant.equals(((Chat)obj).getParticipant());
|
||||
&& threadID.equals(((Chat) obj).getThreadID())
|
||||
&& participant.equals(((Chat) obj).getParticipant());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public final class ChatManager extends Manager{
|
|||
chat = getThreadChat(message.getThread());
|
||||
}
|
||||
|
||||
if(chat == null) {
|
||||
if (chat == null) {
|
||||
chat = createChat(message);
|
||||
}
|
||||
// The chat could not be created, abort here
|
||||
|
@ -248,7 +248,7 @@ public final class ChatManager extends Manager{
|
|||
thread = nextID();
|
||||
}
|
||||
Chat chat = threadChats.get(thread);
|
||||
if(chat != null) {
|
||||
if (chat != null) {
|
||||
throw new IllegalArgumentException("ThreadID is already used");
|
||||
}
|
||||
chat = createChat(userJID, thread, true);
|
||||
|
@ -262,7 +262,7 @@ public final class ChatManager extends Manager{
|
|||
jidChats.put(userJID, chat);
|
||||
baseJidChats.put(userJID.asEntityBareJid(), chat);
|
||||
|
||||
for(ChatManagerListener listener : chatManagerListeners) {
|
||||
for (ChatManagerListener listener : chatManagerListeners) {
|
||||
listener.chatCreated(chat, createdLocally);
|
||||
}
|
||||
|
||||
|
@ -293,11 +293,11 @@ public final class ChatManager extends Manager{
|
|||
|
||||
EntityJid userJID = from.asEntityJidIfPossible();
|
||||
if (userJID == null) {
|
||||
LOGGER.warning("Message from JID without localpart: '" +message.toXML() + "'");
|
||||
LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'");
|
||||
return null;
|
||||
}
|
||||
String threadID = message.getThread();
|
||||
if(threadID == null) {
|
||||
if (threadID == null) {
|
||||
threadID = nextID();
|
||||
}
|
||||
|
||||
|
@ -372,9 +372,9 @@ public final class ChatManager extends Manager{
|
|||
}
|
||||
|
||||
void sendMessage(Chat chat, Message message) throws NotConnectedException, InterruptedException {
|
||||
for(Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) {
|
||||
for (Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) {
|
||||
StanzaFilter filter = interceptor.getValue();
|
||||
if(filter != null && filter.accept(message)) {
|
||||
if (filter != null && filter.accept(message)) {
|
||||
interceptor.getKey().processMessage(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ public final class Roster extends Manager {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void reload() throws NotLoggedInException, NotConnectedException, InterruptedException{
|
||||
public void reload() throws NotLoggedInException, NotConnectedException, InterruptedException {
|
||||
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
||||
|
||||
RosterPacket packet = new RosterPacket();
|
||||
|
@ -1307,7 +1307,7 @@ public final class Roster extends Manager {
|
|||
|
||||
// Remove user from the remaining groups.
|
||||
List<String> oldGroupNames = new ArrayList<String>();
|
||||
for (RosterGroup group: getGroups()) {
|
||||
for (RosterGroup group : getGroups()) {
|
||||
oldGroupNames.add(group.getName());
|
||||
}
|
||||
oldGroupNames.removeAll(newGroupNames);
|
||||
|
@ -1329,7 +1329,7 @@ public final class Roster extends Manager {
|
|||
move(user, presenceMap, nonRosterPresenceMap);
|
||||
deletedEntries.add(user);
|
||||
|
||||
for (Entry<String,RosterGroup> e: groups.entrySet()) {
|
||||
for (Entry<String,RosterGroup> e : groups.entrySet()) {
|
||||
RosterGroup group = e.getValue();
|
||||
group.removeEntryLocal(entry);
|
||||
if (group.getEntryCount() == 0) {
|
||||
|
|
|
@ -123,7 +123,7 @@ public final class RosterEntry extends Manager {
|
|||
* @param subscriptionPending TODO
|
||||
*/
|
||||
void updateItem(RosterPacket.Item item) {
|
||||
assert(item != null);
|
||||
assert (item != null);
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public final class RosterEntry extends Manager {
|
|||
List<RosterGroup> results = new ArrayList<RosterGroup>();
|
||||
// Loop through all roster groups and find the ones that contain this
|
||||
// entry. This algorithm should be fine
|
||||
for (RosterGroup group: roster.getGroups()) {
|
||||
for (RosterGroup group : roster.getGroups()) {
|
||||
if (group.contains(this)) {
|
||||
results.add(group);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public final class RosterEntry extends Manager {
|
|||
return true;
|
||||
}
|
||||
if (object != null && object instanceof RosterEntry) {
|
||||
return getJid().equals(((RosterEntry)object).getJid());
|
||||
return getJid().equals(((RosterEntry) object).getJid());
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
switch(eventType) {
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
String startTag = parser.getName();
|
||||
switch (startTag) {
|
||||
|
@ -53,7 +53,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
String endTag = parser.getName();
|
||||
switch(endTag) {
|
||||
switch (endTag) {
|
||||
case IQ.QUERY_ELEMENT:
|
||||
if (parser.getDepth() == initialDepth) {
|
||||
break outerloop;
|
||||
|
@ -84,7 +84,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
boolean approved = ParserUtils.getBooleanAttribute(parser, "approved", false);
|
||||
item.setApproved(approved);
|
||||
|
||||
outerloop: while(true) {
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
|
@ -106,7 +106,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
|
|||
}
|
||||
}
|
||||
ParserUtils.assertAtEndTag(parser);
|
||||
assert(item != null);
|
||||
assert (item != null);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,10 +227,10 @@ public class RosterTest extends InitSmackIm {
|
|||
contactName,
|
||||
item.getName());
|
||||
assertTrue("The updated contact doesn't belong to the requested groups ("
|
||||
+ contactGroups[0] +")!",
|
||||
+ contactGroups[0] + ")!",
|
||||
item.getGroupNames().contains(contactGroups[0]));
|
||||
assertTrue("The updated contact doesn't belong to the requested groups ("
|
||||
+ contactGroups[1] +")!",
|
||||
+ contactGroups[1] + ")!",
|
||||
item.getGroupNames().contains(contactGroups[1]));
|
||||
assertSame("The provided group number doesn't match the requested!",
|
||||
contactGroups.length,
|
||||
|
@ -257,10 +257,10 @@ public class RosterTest extends InitSmackIm {
|
|||
contactName,
|
||||
addedEntry.getName());
|
||||
assertTrue("The updated contact doesn't belong to the requested groups ("
|
||||
+ contactGroups[0] +")!",
|
||||
+ contactGroups[0] + ")!",
|
||||
roster.getGroup(contactGroups[0]).contains(addedEntry));
|
||||
assertTrue("The updated contact doesn't belong to the requested groups ("
|
||||
+ contactGroups[1] +")!",
|
||||
+ contactGroups[1] + ")!",
|
||||
roster.getGroup(contactGroups[1]).contains(addedEntry));
|
||||
assertSame("The updated contact should be member of two groups!",
|
||||
contactGroups.length,
|
||||
|
@ -399,7 +399,7 @@ public class RosterTest extends InitSmackIm {
|
|||
*
|
||||
* @see <a href="http://www.igniterealtime.org/issues/browse/SMACK-294">SMACK-294</a>
|
||||
*/
|
||||
@Test(timeout=5000)
|
||||
@Test(timeout = 5000)
|
||||
public void testAddEmptyGroupEntry() throws Throwable {
|
||||
// Constants for the new contact
|
||||
final BareJid contactJID = JidCreate.entityBareFrom("nurse@example.com");
|
||||
|
@ -516,9 +516,9 @@ public class RosterTest extends InitSmackIm {
|
|||
* @param roster the roster (or buddy list) which should be initialized.
|
||||
*/
|
||||
public static void removeAllRosterEntries(DummyConnection connection, Roster roster) {
|
||||
for(RosterEntry entry : roster.getEntries()) {
|
||||
for (RosterEntry entry : roster.getEntries()) {
|
||||
// prepare the roster push packet
|
||||
final RosterPacket rosterPush= new RosterPacket();
|
||||
final RosterPacket rosterPush = new RosterPacket();
|
||||
rosterPush.setType(Type.set);
|
||||
rosterPush.setTo(connection.getUser());
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public class RosterVersioningTest {
|
|||
// but a shortcut in the test implementation.
|
||||
Stanza sentPacket = connection.getSentPacket();
|
||||
if (sentPacket instanceof RosterPacket) {
|
||||
RosterPacket sentRP = (RosterPacket)sentPacket;
|
||||
RosterPacket sentRP = (RosterPacket) sentPacket;
|
||||
RosterPacket answer = new RosterPacket();
|
||||
answer.setStanzaId(sentRP.getStanzaId());
|
||||
answer.setType(Type.result);
|
||||
|
@ -254,7 +254,7 @@ public class RosterVersioningTest {
|
|||
// but a shortcut in the test implementation.
|
||||
Stanza sentPacket = connection.getSentPacket();
|
||||
if (sentPacket instanceof RosterPacket) {
|
||||
final IQ emptyIQ = IQ.createResultIQ((RosterPacket)sentPacket);
|
||||
final IQ emptyIQ = IQ.createResultIQ((RosterPacket) sentPacket);
|
||||
connection.processStanza(emptyIQ);
|
||||
} else {
|
||||
assertTrue("Expected to get a RosterPacket ", false);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SubscriptionPreApprovalTest extends InitSmackIm {
|
|||
connection = null;
|
||||
}
|
||||
|
||||
@Test(expected=FeatureNotSupportedException.class)
|
||||
@Test(expected = FeatureNotSupportedException.class)
|
||||
public void testPreApprovalNotSupported() throws Throwable {
|
||||
final Jid contactJID = JidCreate.from("preapproval@example.com");
|
||||
roster.preApprove(contactJID.asBareJid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue