's;^\s+$;;' on all source files
And add checkstyle test for lines containing only whitespace characters.filetransferTypos
parent
05c97c494b
commit
0fde39fa45
|
@ -18,6 +18,10 @@
|
|||
<property name="format" value="MXParser"/>
|
||||
<property name="message" value="Must not use MXParser, use XmlPullParserFactory instead"/>
|
||||
</module>
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="^\s+$"/>
|
||||
<property name="message" value="Line containing only whitespace character(s)"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
|
|
|
@ -113,7 +113,7 @@ public class LoginTest extends SmackTestCase {
|
|||
config.setSASLAuthenticationEnabled(false);
|
||||
XMPPTCPConnection conn2 = new XMPPConnection(config);
|
||||
conn2.connect();
|
||||
|
||||
|
||||
try {
|
||||
// Try to login anonymously
|
||||
conn1.loginAnonymously();
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smackx.ping.PingManager;
|
|||
public class ReconnectionTest extends SmackTestCase {
|
||||
|
||||
private static final long MIN_RECONNECT_WAIT = 17; // Seconds
|
||||
|
||||
|
||||
public ReconnectionTest(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
// Simulates an error in the connection
|
||||
connection.notifyConnectionError(new Exception("Simulated Error"));
|
||||
latch.await(MIN_RECONNECT_WAIT, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
// After 10 seconds, the reconnection manager must reestablishes the connection
|
||||
assertEquals("The ConnectionListener.connectionStablished() notification was not fired", true, listener.reconnected);
|
||||
assertTrue("The ReconnectionManager algorithm has reconnected without waiting at least 5 seconds", listener.attemptsNotifications > 0);
|
||||
|
@ -81,7 +81,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
// Simulates an error in the connection
|
||||
connection.notifyConnectionError(new Exception("Simulated Error"));
|
||||
latch.await(MIN_RECONNECT_WAIT, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
// After 10 seconds, the reconnection manager must reestablishes the connection
|
||||
assertEquals("The ConnectionListener.connectionEstablished() notification was not fired", true, listener.reconnected);
|
||||
assertTrue("The ReconnectionManager algorithm has reconnected without waiting at least 5 seconds", listener.attemptsNotifications > 0);
|
||||
|
@ -106,7 +106,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
"An error occurs but the ConnectionListener.connectionClosedOnError(e) was not notified",
|
||||
true, listener.connectionClosedOnError);
|
||||
// Thread.sleep(1000);
|
||||
|
||||
|
||||
// Cancels the automatic reconnection
|
||||
connection.getConfiguration().setReconnectionAllowed(false);
|
||||
// Waits for a reconnection that must not happened.
|
||||
|
@ -218,7 +218,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
*/
|
||||
public void connectionClosed() {
|
||||
connectionClosed = true;
|
||||
|
||||
|
||||
if (countDownLatch != null)
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1. Create entries in roster groups
|
||||
* 2. Iterate on the groups and remove the entry from each group
|
||||
|
@ -57,29 +57,29 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
|
||||
CountDownLatch latch = new CountDownLatch(2);
|
||||
setupCountdown(latch, roster);
|
||||
|
||||
|
||||
roster.createEntry(getBareJID(1), "gato11", new String[] { "Friends", "Family" });
|
||||
roster.createEntry(getBareJID(2), "gato12", new String[] { "Family" });
|
||||
|
||||
|
||||
waitForCountdown(latch, roster, 2);
|
||||
|
||||
final CountDownLatch removeLatch = new CountDownLatch(3);
|
||||
RosterListener latchCounter = new RosterListener() {
|
||||
@Override
|
||||
public void presenceChanged(Presence presence) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesUpdated(Collection<String> addresses) {
|
||||
removeLatch.countDown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesDeleted(Collection<String> addresses) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesAdded(Collection<String> addresses) {}
|
||||
};
|
||||
|
||||
|
||||
roster.addRosterListener(latchCounter);
|
||||
|
||||
for (RosterEntry entry : roster.getEntries()) {
|
||||
|
@ -87,10 +87,10 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
rosterGroup.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
removeLatch.await(5, TimeUnit.SECONDS);
|
||||
roster.removeRosterListener(latchCounter);
|
||||
|
||||
|
||||
assertEquals("The number of entries in connection 1 should be 1", 1, getConnection(1).getRoster().getEntryCount());
|
||||
assertEquals("The number of groups in connection 1 should be 0", 0, getConnection(1).getRoster().getGroupCount());
|
||||
assertEquals("The number of entries in connection 2 should be 1", 1, getConnection(2).getRoster().getEntryCount());
|
||||
|
@ -105,18 +105,18 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
|
||||
private void setupCountdown(final CountDownLatch latch, Roster roster) {
|
||||
roster.addRosterListener(new RosterListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void presenceChanged(Presence presence) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesUpdated(Collection<String> addresses) {
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesDeleted(Collection<String> addresses) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesAdded(Collection<String> addresses) {}
|
||||
});
|
||||
|
@ -135,10 +135,10 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
public void testDeleteAllRosterEntries() throws Exception {
|
||||
// Add a new roster entry
|
||||
Roster roster = getConnection(0).getRoster();
|
||||
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(2);
|
||||
setupCountdown(latch, roster);
|
||||
|
||||
|
||||
roster.createEntry(getBareJID(1), "gato11", new String[] { "Friends" });
|
||||
roster.createEntry(getBareJID(2), "gato12", new String[] { "Family" });
|
||||
|
||||
|
@ -170,10 +170,10 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
try {
|
||||
// Add a new roster entry
|
||||
Roster roster = getConnection(0).getRoster();
|
||||
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(2);
|
||||
setupCountdown(latch, roster);
|
||||
|
||||
|
||||
roster.createEntry(getBareJID(1), "gato11", null);
|
||||
roster.createEntry(getBareJID(2), "gato12", null);
|
||||
|
||||
|
@ -212,9 +212,9 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
Roster roster = getConnection(0).getRoster();
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
setupCountdown(latch, roster);
|
||||
|
||||
|
||||
roster.createEntry(getBareJID(1), null, null);
|
||||
|
||||
|
||||
waitForCountdown(latch, roster, 1);
|
||||
|
||||
final CountDownLatch updateLatch = new CountDownLatch(2);
|
||||
|
@ -242,9 +242,9 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
}
|
||||
// Reload the roster and check the name again
|
||||
roster.reload();
|
||||
|
||||
|
||||
updateLatch.await(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
for (RosterEntry entry : roster.getEntries()) {
|
||||
assertEquals("gato11", entry.getName());
|
||||
}
|
||||
|
@ -588,22 +588,22 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
Roster roster = getConnection(i).getRoster();
|
||||
final CountDownLatch removalLatch = new CountDownLatch(roster.getEntryCount());
|
||||
roster.addRosterListener(new RosterListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void presenceChanged(Presence presence) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesUpdated(Collection<String> addresses) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesDeleted(Collection<String> addresses) {
|
||||
removalLatch.countDown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesAdded(Collection<String> addresses) {}
|
||||
});
|
||||
|
||||
|
||||
for (RosterEntry entry : roster.getEntries()) {
|
||||
try {
|
||||
roster.removeEntry(entry);
|
||||
|
@ -668,7 +668,7 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
assertEquals("Presence should be online after a connection reconnection",
|
||||
Presence.Type.available, presence.getType());
|
||||
}
|
||||
|
||||
|
||||
protected int getMaxConnections() {
|
||||
return 3;
|
||||
}
|
||||
|
@ -684,25 +684,25 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
cleanUpRoster();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
private class RemovalListener implements RosterListener {
|
||||
private CountDownLatch latch;
|
||||
|
||||
|
||||
private RemovalListener(CountDownLatch removalLatch) {
|
||||
latch = removalLatch;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void presenceChanged(Presence presence) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesUpdated(Collection<String> addresses) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesDeleted(Collection<String> addresses) {
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void entriesAdded(Collection<String> addresses) {}
|
||||
};
|
||||
|
|
|
@ -126,22 +126,22 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
Privacy packet = (Privacy) (new PrivacyProvider()).parse(parser);
|
||||
|
||||
|
||||
// check if it exist
|
||||
assertNotNull(packet);
|
||||
// assertEquals(xml, packet.getChildElementXML());
|
||||
|
||||
|
||||
// check the default and active names
|
||||
assertEquals("testFilter", packet.getActiveName());
|
||||
assertEquals("testSubscription", packet.getDefaultName());
|
||||
|
||||
|
||||
// check the list
|
||||
assertEquals(2, packet.getPrivacyList("testFilter").size());
|
||||
assertEquals(5, packet.getPrivacyList("testSubscription").size());
|
||||
assertEquals(4, packet.getPrivacyList("testJID").size());
|
||||
assertEquals(2, packet.getPrivacyList("testGroup").size());
|
||||
assertEquals(0, packet.getPrivacyList("testEmpty").size());
|
||||
|
||||
|
||||
// check each privacy item
|
||||
PrivacyItem item = packet.getItem("testGroup", 4);
|
||||
assertEquals("Enemies", item.getValue());
|
||||
|
@ -152,7 +152,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(false, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testFilter", 1);
|
||||
assertEquals("tybalt@example.com", item.getValue());
|
||||
assertEquals(PrivacyItem.Type.jid, item.getType());
|
||||
|
@ -162,7 +162,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testFilter", 2);
|
||||
assertEquals(null, item.getValue());
|
||||
assertEquals(null, item.getType());
|
||||
|
@ -193,7 +193,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testSubscription", 12);
|
||||
assertEquals("from", item.getValue());
|
||||
assertEquals(PrivacyItem.Type.subscription, item.getType());
|
||||
|
@ -203,7 +203,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testSubscription", 5);
|
||||
assertEquals("none", item.getValue());
|
||||
assertEquals(PrivacyItem.Type.subscription, item.getType());
|
||||
|
@ -213,7 +213,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(false, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testSubscription", 15);
|
||||
assertEquals(null, item.getValue());
|
||||
assertEquals(null, item.getType());
|
||||
|
@ -225,7 +225,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
// TEST THE testJID LIST
|
||||
|
||||
|
||||
item = packet.getItem("testJID", 6);
|
||||
assertEquals("juliet@example.com", item.getValue());
|
||||
assertEquals(PrivacyItem.Type.jid, item.getType());
|
||||
|
@ -235,7 +235,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testJID", 7);
|
||||
assertEquals("benvolio@example.org/palm", item.getValue());
|
||||
assertEquals(PrivacyItem.Type.jid, item.getType());
|
||||
|
@ -245,7 +245,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testJID", 42);
|
||||
assertEquals(null, item.getValue());
|
||||
assertEquals(PrivacyItem.Type.jid, item.getType());
|
||||
|
@ -255,7 +255,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testJID", 666);
|
||||
assertEquals(null, item.getValue());
|
||||
assertEquals(null, item.getType());
|
||||
|
@ -265,9 +265,9 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(true, item.isFilterEverything());
|
||||
|
||||
|
||||
// TEST THE testGroup LIST
|
||||
|
||||
|
||||
item = packet.getItem("testGroup", 4);
|
||||
assertEquals("Enemies", item.getValue());
|
||||
assertEquals(PrivacyItem.Type.group, item.getType());
|
||||
|
@ -277,7 +277,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
assertEquals(false, item.isFilterPresence_in());
|
||||
assertEquals(false, item.isFilterPresence_out());
|
||||
assertEquals(false, item.isFilterEverything());
|
||||
|
||||
|
||||
item = packet.getItem("testGroup", 666);
|
||||
assertEquals(null, item.getValue());
|
||||
assertEquals(null, item.getType());
|
||||
|
@ -293,8 +293,8 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check the parser with an xml with empty lists. It includes the active,
|
||||
* default and special list.
|
||||
|
@ -318,13 +318,13 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
Privacy packet = (Privacy) (new PrivacyProvider()).parse(parser);
|
||||
|
||||
|
||||
assertNotNull(packet);
|
||||
assertNotNull(packet.getChildElementXML());
|
||||
|
||||
|
||||
assertEquals("public", packet.getDefaultName());
|
||||
assertEquals(null, packet.getActiveName());
|
||||
|
||||
|
||||
assertEquals(0, packet.getPrivacyList("public").size());
|
||||
assertEquals(0, packet.getPrivacyList("private").size());
|
||||
assertEquals(0, packet.getPrivacyList("special").size());
|
||||
|
@ -336,7 +336,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the parser with an xml with empty lists. It includes the active,
|
||||
* default and special list.
|
||||
|
@ -357,12 +357,12 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
Privacy packet = (Privacy) (new PrivacyProvider()).parse(parser);
|
||||
|
||||
|
||||
assertNotNull(packet);
|
||||
|
||||
|
||||
assertEquals(null, packet.getDefaultName());
|
||||
assertEquals(null, packet.getActiveName());
|
||||
|
||||
|
||||
assertEquals(true, packet.isDeclineActiveList());
|
||||
assertEquals(true, packet.isDeclineDefaultList());
|
||||
} catch (Exception e) {
|
||||
|
@ -370,14 +370,14 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private XmlPullParser getParserFromXML(String xml) throws XmlPullParserException {
|
||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||
parser.setInput(new StringReader(xml));
|
||||
return parser;
|
||||
}
|
||||
|
||||
|
||||
protected int getMaxConnections() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,33 +30,33 @@ public class PrivacyTest extends SmackTestCase {
|
|||
public PrivacyTest(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check when a client set a new active list.
|
||||
*/
|
||||
public void testCreateActiveList() {
|
||||
try {
|
||||
String listName = "testCreateActiveList";
|
||||
|
||||
|
||||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
// Add the list that will be set as the active
|
||||
ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
|
||||
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.name(), true, 1);
|
||||
item.setValue(getConnection(0).getUser());
|
||||
items.add(item);
|
||||
privacyManager.createPrivacyList(listName, items);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Set the active list
|
||||
privacyManager.setActiveListName(listName);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Assert the list composition.
|
||||
assertEquals(listName, privacyManager.getActiveList().toString());
|
||||
List<PrivacyItem> privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
|
@ -67,7 +67,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
assertEquals(1, receivedItem.getOrder());
|
||||
assertEquals(PrivacyItem.Type.jid, receivedItem.getType());
|
||||
assertEquals(true, receivedItem.isAllow());
|
||||
|
||||
|
||||
privacyManager.deletePrivacyList(listName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -83,20 +83,20 @@ public class PrivacyTest extends SmackTestCase {
|
|||
String listName1 = "1testCreateTwoLists";
|
||||
String listName2 = "2testCreateTwoLists";
|
||||
String groupName = "testCreateTwoListsGroup";
|
||||
|
||||
|
||||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
// Add a list
|
||||
ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
|
||||
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.name(), true, 1);
|
||||
item.setValue(getConnection(0).getUser());
|
||||
items.add(item);
|
||||
privacyManager.createPrivacyList(listName1, items);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Add the another list
|
||||
ArrayList<PrivacyItem> itemsList2 = new ArrayList<PrivacyItem>();
|
||||
item = new PrivacyItem(PrivacyItem.Type.group.name(), false, 2);
|
||||
|
@ -104,9 +104,9 @@ public class PrivacyTest extends SmackTestCase {
|
|||
item.setFilterMessage(true);
|
||||
itemsList2.add(item);
|
||||
privacyManager.createPrivacyList(listName2, itemsList2);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Assert the list composition.
|
||||
PrivacyList[] privacyLists = privacyManager.getPrivacyLists();
|
||||
PrivacyList receivedList1 = null;
|
||||
|
@ -119,8 +119,8 @@ public class PrivacyTest extends SmackTestCase {
|
|||
receivedList2 = privacyList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PrivacyItem receivedItem;
|
||||
// Assert on the list 1
|
||||
assertNotNull(receivedList1);
|
||||
|
@ -130,7 +130,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
assertEquals(PrivacyItem.Type.jid, receivedItem.getType());
|
||||
assertEquals(true, receivedItem.isAllow());
|
||||
assertEquals(getConnection(0).getUser(), receivedItem.getValue());
|
||||
|
||||
|
||||
// Assert on the list 2
|
||||
assertNotNull(receivedList2);
|
||||
assertEquals(1, receivedList2.getItems().size());
|
||||
|
@ -144,7 +144,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
assertEquals(true, receivedItem.isFilterMessage());
|
||||
assertEquals(false, receivedItem.isFilterPresence_in());
|
||||
assertEquals(false, receivedItem.isFilterPresence_out());
|
||||
|
||||
|
||||
privacyManager.deletePrivacyList(listName1);
|
||||
privacyManager.deletePrivacyList(listName2);
|
||||
} catch (Exception e) {
|
||||
|
@ -152,7 +152,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check when a client set a new list and then update its content.
|
||||
*/
|
||||
|
@ -160,20 +160,20 @@ public class PrivacyTest extends SmackTestCase {
|
|||
try {
|
||||
String listName = "testCreateAndUpdateList";
|
||||
String user = "tybalt@example.com";
|
||||
|
||||
|
||||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
// Add the list that will be set as the active
|
||||
ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
|
||||
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.name(), true, 1);
|
||||
item.setValue(getConnection(0).getUser());
|
||||
items.add(item);
|
||||
privacyManager.createPrivacyList(listName, items);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Remove the existing item and add a new one.
|
||||
items.remove(item);
|
||||
item = new PrivacyItem(PrivacyItem.Type.jid.name(), false, 2);
|
||||
|
@ -182,12 +182,12 @@ public class PrivacyTest extends SmackTestCase {
|
|||
item.setFilterPresence_in(true);
|
||||
item.setFilterMessage(true);
|
||||
items.add(item);
|
||||
|
||||
|
||||
// Update the list on server
|
||||
privacyManager.updatePrivacyList(listName, items);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Assert the list composition.
|
||||
PrivacyList list = privacyManager.getPrivacyList(listName);
|
||||
assertEquals(1, list.getItems().size());
|
||||
|
@ -210,7 +210,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check when a client denies the use of a default list.
|
||||
*/
|
||||
|
@ -219,18 +219,18 @@ public class PrivacyTest extends SmackTestCase {
|
|||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
privacyManager.declineDefaultList();
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
try {
|
||||
// The list should not exist and an error will be raised
|
||||
privacyManager.getDefaultList();
|
||||
} catch (XMPPException xmppException) {
|
||||
assertEquals(404, xmppException.getXMPPError().getCode());
|
||||
}
|
||||
|
||||
|
||||
assertEquals(null, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -246,50 +246,50 @@ public class PrivacyTest extends SmackTestCase {
|
|||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
privacyManager.declineActiveList();
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
try {
|
||||
// The list should not exist and an error will be raised
|
||||
privacyManager.getActiveList();
|
||||
} catch (XMPPException xmppException) {
|
||||
assertEquals(404, xmppException.getXMPPError().getCode());
|
||||
}
|
||||
|
||||
|
||||
assertEquals(null, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check when a client set a new default list.
|
||||
*/
|
||||
public void testCreateDefaultList() {
|
||||
try {
|
||||
String listName = "testCreateDefaultList";
|
||||
|
||||
|
||||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
// Add the list that will be set as the Default
|
||||
ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
|
||||
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.name(), true, 1);
|
||||
item.setValue(getConnection(0).getUser());
|
||||
items.add(item);
|
||||
privacyManager.createPrivacyList(listName, items);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Set the Default list
|
||||
privacyManager.setDefaultListName(listName);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Assert the list composition.
|
||||
assertEquals(listName, privacyManager.getDefaultList().toString());
|
||||
List<PrivacyItem> privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
|
@ -300,7 +300,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
assertEquals(1, receivedItem.getOrder());
|
||||
assertEquals(PrivacyItem.Type.jid, receivedItem.getType());
|
||||
assertEquals(true, receivedItem.isAllow());
|
||||
|
||||
|
||||
privacyManager.deletePrivacyList(listName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -314,27 +314,27 @@ public class PrivacyTest extends SmackTestCase {
|
|||
public void testRemoveList() {
|
||||
try {
|
||||
String listName = "testRemoveList";
|
||||
|
||||
|
||||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
// Add the list that will be set as the Default
|
||||
ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
|
||||
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.name(), true, 1);
|
||||
item.setValue(getConnection(0).getUser());
|
||||
items.add(item);
|
||||
privacyManager.createPrivacyList(listName, items);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
|
||||
// Set the Default list
|
||||
privacyManager.setDefaultListName(listName);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
privacyManager.deletePrivacyList(listName);
|
||||
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
try {
|
||||
|
@ -357,14 +357,14 @@ public class PrivacyTest extends SmackTestCase {
|
|||
String listName = "testPrivacyItems";
|
||||
String user = "tybalt@example.com";
|
||||
String groupName = "enemies";
|
||||
|
||||
|
||||
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(getConnection(0));
|
||||
PrivacyClient client = new PrivacyClient(privacyManager);
|
||||
privacyManager.addListener(client);
|
||||
|
||||
|
||||
PrivacyItem[] originalPrivacyItems = new PrivacyItem[12];
|
||||
int i=0;
|
||||
|
||||
|
||||
// Items to test JID
|
||||
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.name(), true, i);
|
||||
item.setValue(i + "_" + user);
|
||||
|
@ -396,38 +396,38 @@ public class PrivacyTest extends SmackTestCase {
|
|||
item.setValue(PrivacyRule.SUBSCRIPTION_NONE);
|
||||
originalPrivacyItems[i] = item;
|
||||
i = i + 1;
|
||||
|
||||
|
||||
// Items to test Group
|
||||
item = new PrivacyItem(PrivacyItem.Type.group.name(), false, i);
|
||||
item.setValue(groupName);
|
||||
originalPrivacyItems[i] = item;
|
||||
i = i + 1;
|
||||
|
||||
|
||||
// Items to test messages
|
||||
item = new PrivacyItem(PrivacyItem.Type.group.name(), false, i);
|
||||
item.setValue(groupName);
|
||||
item.setFilterMessage(true);
|
||||
originalPrivacyItems[i] = item;
|
||||
i = i + 1;
|
||||
|
||||
|
||||
// Items to test presence notifications
|
||||
item = new PrivacyItem(PrivacyItem.Type.group.name(), false, i);
|
||||
item.setValue(groupName);
|
||||
item.setFilterMessage(true);
|
||||
originalPrivacyItems[i] = item;
|
||||
i = i + 1;
|
||||
|
||||
|
||||
item = new PrivacyItem(null, false, i);
|
||||
item.setFilterPresence_in(true);
|
||||
originalPrivacyItems[i] = item;
|
||||
i = i + 1;
|
||||
|
||||
|
||||
item = new PrivacyItem(PrivacyItem.Type.subscription.name(), false, i);
|
||||
item.setValue(PrivacyRule.SUBSCRIPTION_TO);
|
||||
item.setFilterPresence_out(true);
|
||||
originalPrivacyItems[i] = item;
|
||||
i = i + 1;
|
||||
|
||||
|
||||
item = new PrivacyItem(PrivacyItem.Type.jid.name(), false, i);
|
||||
item.setValue(i + "_" + user);
|
||||
item.setFilterPresence_out(true);
|
||||
|
@ -457,7 +457,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
index++;
|
||||
}
|
||||
originalItem = originalPrivacyItems[index];
|
||||
|
||||
|
||||
// Assert the items
|
||||
assertEquals(originalItem.getOrder(), receivedItem.getOrder());
|
||||
assertEquals(originalItem.getType(), receivedItem.getType());
|
||||
|
@ -469,14 +469,14 @@ public class PrivacyTest extends SmackTestCase {
|
|||
assertEquals(originalItem.isFilterPresence_in(), receivedItem.isFilterPresence_in());
|
||||
assertEquals(originalItem.isFilterPresence_out(), receivedItem.isFilterPresence_out());
|
||||
}
|
||||
|
||||
|
||||
privacyManager.deletePrivacyList(listName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected int getMaxConnections() {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
|
||||
private String[] usernames;
|
||||
private String[] passwords;
|
||||
|
||||
|
||||
private String chatDomain = "chat";
|
||||
private String mucDomain = "conference";
|
||||
|
||||
|
@ -118,7 +118,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
protected boolean createOfflineConnections() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the XMPPTCPConnection located at the requested position. Each test case holds a
|
||||
* pool of connections which is initialized while setting up the test case. The maximum
|
||||
|
@ -165,7 +165,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
protected String getUsername(int index) {
|
||||
return usernames[index];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the password of the user (e.g. johndoe) that is using the connection
|
||||
* located at the requested position.
|
||||
|
@ -238,7 +238,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
connections = new XMPPTCPConnection[getMaxConnections()];
|
||||
usernames = new String[getMaxConnections()];
|
||||
passwords = new String[getMaxConnections()];
|
||||
|
||||
|
||||
try {
|
||||
// Connect to the server
|
||||
for (int i = 0; i < getMaxConnections(); i++) {
|
||||
|
@ -260,19 +260,19 @@ public abstract class SmackTestCase extends TestCase {
|
|||
// that will not resolve as a network connection.
|
||||
host = connections[0].getHost();
|
||||
serviceName = connections[0].getServiceName();
|
||||
|
||||
|
||||
if (!createOfflineConnections()) {
|
||||
for (int i = 0; i < getMaxConnections(); i++) {
|
||||
String currentUser = usernames[i];
|
||||
String currentPassword = passwords[i];
|
||||
|
||||
|
||||
try {
|
||||
getConnection(i).login(currentUser, currentPassword, "Smack");
|
||||
} catch (XMPPException e) {
|
||||
// Create the test accounts
|
||||
if (!getConnection(0).getAccountManager().supportsAccountCreation())
|
||||
fail("Server does not support account creation");
|
||||
|
||||
|
||||
// Create the account and try logging in again as the
|
||||
// same user.
|
||||
try {
|
||||
|
@ -297,12 +297,12 @@ public abstract class SmackTestCase extends TestCase {
|
|||
protected void connectAndLogin(int connectionIndex) throws XMPPException
|
||||
{
|
||||
String password = usernamePrefix + (connectionIndex + 1);
|
||||
|
||||
|
||||
if (passwordPrefix != null)
|
||||
password = (samePassword ? passwordPrefix : passwordPrefix + (connectionIndex + 1));
|
||||
|
||||
TCPConnection con = getConnection(connectionIndex);
|
||||
|
||||
|
||||
if (!con.isConnected())
|
||||
con.connect();
|
||||
try {
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.jivesoftware.smack.XMPPException;
|
|||
public class ConnectionUtils {
|
||||
|
||||
private ConnectionUtils() {}
|
||||
|
||||
|
||||
public static void becomeFriends(XMPPConnection con0, XMPPConnection con1) throws XMPPException {
|
||||
Roster r0 = con0.getRoster();
|
||||
Roster r1 = con1.getRoster();
|
||||
|
|
|
@ -116,14 +116,14 @@ public class DNSUtilTest {
|
|||
assertEquals(ha.getFQDN(), igniterealtimeXMPPServer);
|
||||
assertEquals(ha.getPort(), igniterealtimeClientPort);
|
||||
}
|
||||
|
||||
|
||||
private void xmppServerDomainTest() {
|
||||
List<HostAddress> hostAddresses = DNSUtil.resolveXMPPServerDomain(igniterealtimeDomain);
|
||||
HostAddress ha = hostAddresses.get(0);
|
||||
assertEquals(ha.getFQDN(), igniterealtimeXMPPServer);
|
||||
assertEquals(ha.getPort(), igniterealtimeServerPort);
|
||||
}
|
||||
|
||||
|
||||
private static List<SRVRecord> createSRVRecords() {
|
||||
List<SRVRecord> records = new ArrayList<SRVRecord>();
|
||||
// We create one record with priority 0 that should also be tried first
|
||||
|
|
|
@ -29,7 +29,7 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
public XMPPErrorTest(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the creation of a new xmppError locally.
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
assertEquals(error.getType(), XMPPError.Type.CANCEL);
|
||||
assertNull(error.getMessage());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the creation of a new xmppError locally.
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
assertEquals(error.getType(), XMPPError.Type.CANCEL);
|
||||
assertEquals(error.getMessage(), message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the creation of a new xmppError locally where there is not a default defined.
|
||||
*/
|
||||
|
@ -70,7 +70,7 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
assertNull(error.getType());
|
||||
assertEquals(error.getMessage(), message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the parser with an xml with the 404 error.
|
||||
*/
|
||||
|
@ -84,14 +84,14 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
XMPPError packet = parseError(parser);
|
||||
|
||||
|
||||
assertNotNull(packet);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the parser with an xml with the 404 error.
|
||||
*/
|
||||
|
@ -105,14 +105,14 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
XMPPError error = parseError(parser);
|
||||
|
||||
|
||||
assertNotNull(error);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testMessageAndApplicationDefinedError() {
|
||||
String xml = "<error type='modify' code='404'>" +
|
||||
"<undefined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>" +
|
||||
|
@ -126,9 +126,9 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
XMPPError error = parseError(parser);
|
||||
|
||||
|
||||
String sendingXML = error.toXML();
|
||||
|
||||
|
||||
assertNotNull(error);
|
||||
assertNotNull(sendingXML);
|
||||
} catch (Exception e) {
|
||||
|
@ -152,14 +152,14 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
XMPPError error = parseError(parser);
|
||||
|
||||
|
||||
assertNotNull(error);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the parser with an xml with the 404 error.
|
||||
*/
|
||||
|
@ -177,26 +177,26 @@ public class XMPPErrorTest extends SmackTestCase {
|
|||
XmlPullParser parser = getParserFromXML(xml);
|
||||
// Create a packet from the xml
|
||||
XMPPError error = parseError(parser);
|
||||
|
||||
|
||||
assertNotNull(error);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private XMPPError parseError(XmlPullParser parser) throws Exception {
|
||||
parser.next();
|
||||
return PacketParserUtils.parseError(parser);
|
||||
}
|
||||
|
||||
|
||||
private XmlPullParser getParserFromXML(String xml) throws XmlPullParserException {
|
||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||
parser.setInput(new StringReader(xml));
|
||||
return parser;
|
||||
}
|
||||
|
||||
|
||||
protected int getMaxConnections() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
protected static Collection<ConnectionCreationListener> getConnectionCreationListeners() {
|
||||
return XMPPConnectionRegistry.getConnectionCreationListeners();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A collection of ConnectionListeners which listen for connection closing
|
||||
* and reconnection events.
|
||||
|
@ -208,7 +208,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
*/
|
||||
protected final SynchronizationPoint<SmackException> saslFeatureReceived = new SynchronizationPoint<SmackException>(
|
||||
AbstractXMPPConnection.this);
|
||||
|
||||
|
||||
/**
|
||||
* The SASLAuthentication manager that is responsible for authenticating with the server.
|
||||
*/
|
||||
|
|
|
@ -102,7 +102,7 @@ public class PacketCollector {
|
|||
public StanzaFilter getStanzaFilter() {
|
||||
return packetFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Polls to see if a packet is currently available and returns it, or
|
||||
* immediately returns <tt>null</tt> if no packets are currently in the
|
||||
|
|
|
@ -142,7 +142,7 @@ public final class SmackConfiguration {
|
|||
public static void setPacketCollectorSize(int collectorSize) {
|
||||
packetCollectorSize = collectorSize;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a SASL mechanism to the list to be used.
|
||||
*
|
||||
|
|
|
@ -384,7 +384,7 @@ public interface XMPPConnection {
|
|||
* @param packetFilter the packet filter to use.
|
||||
*/
|
||||
public void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);
|
||||
|
||||
|
||||
/**
|
||||
* Removes a packet interceptor.
|
||||
*
|
||||
|
|
|
@ -39,7 +39,7 @@ public class XMPPConnectionRegistry {
|
|||
ConnectionCreationListener connectionCreationListener) {
|
||||
connectionEstablishedListeners.add(connectionCreationListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a listener that was interested in connection creation events.
|
||||
*
|
||||
|
@ -49,7 +49,7 @@ public class XMPPConnectionRegistry {
|
|||
ConnectionCreationListener connectionCreationListener) {
|
||||
connectionEstablishedListeners.remove(connectionCreationListener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.jivesoftware.smack.packet.XMPPError;
|
|||
*/
|
||||
public abstract class XMPPException extends Exception {
|
||||
private static final long serialVersionUID = 6881651633890968625L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new XMPPException.
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smack.util.Objects;
|
|||
*
|
||||
*/
|
||||
public class IQTypeFilter extends FlexibleStanzaTypeFilter<IQ> {
|
||||
|
||||
|
||||
public static final StanzaFilter GET = new IQTypeFilter(Type.get);
|
||||
public static final StanzaFilter SET = new IQTypeFilter(Type.set);
|
||||
public static final StanzaFilter RESULT = new IQTypeFilter(Type.result);
|
||||
|
|
|
@ -152,7 +152,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
public String getSubject() {
|
||||
return getSubject(null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the subject corresponding to the language. If the language is null, the method result
|
||||
* will be the same as {@link #getSubject()}. Null will be returned if the language does not have
|
||||
|
@ -165,7 +165,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
Subject subject = getMessageSubject(language);
|
||||
return subject == null ? null : subject.subject;
|
||||
}
|
||||
|
||||
|
||||
private Subject getMessageSubject(String language) {
|
||||
language = determineLanguage(language);
|
||||
for (Subject subject : subjects) {
|
||||
|