diff --git a/config/checkstyle.xml b/config/checkstyle.xml
index ba33c807c..47e29b5f4 100644
--- a/config/checkstyle.xml
+++ b/config/checkstyle.xml
@@ -18,6 +18,10 @@
+
+
+
+
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java
index 750cd6c02..c02c46d01 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java
@@ -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();
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java
index 2347e1c62..f9afcf967 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java
@@ -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();
}
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java
index 0bb393901..7884e750b 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java
@@ -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 addresses) {
removeLatch.countDown();
}
-
+
@Override
public void entriesDeleted(Collection addresses) {}
-
+
@Override
public void entriesAdded(Collection 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 addresses) {
latch.countDown();
}
-
+
@Override
public void entriesDeleted(Collection addresses) {}
-
+
@Override
public void entriesAdded(Collection 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 addresses) {}
-
+
@Override
public void entriesDeleted(Collection addresses) {
removalLatch.countDown();
}
-
+
@Override
public void entriesAdded(Collection 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 addresses) {}
-
+
@Override
public void entriesDeleted(Collection addresses) {
latch.countDown();
}
-
+
@Override
public void entriesAdded(Collection addresses) {}
};
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyProviderTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyProviderTest.java
index c9c1c9d2d..8726c86fd 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyProviderTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyProviderTest.java
@@ -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;
}
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyTest.java
index cd185f5ee..26af1df83 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/packet/PrivacyTest.java
@@ -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 items = new ArrayList();
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 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 items = new ArrayList();
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 itemsList2 = new ArrayList();
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 items = new ArrayList();
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 items = new ArrayList();
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 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 items = new ArrayList();
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;
}
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java
index e43d01df7..50f959e71 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java
@@ -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 {
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/ConnectionUtils.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/ConnectionUtils.java
index a7a17e087..e02b72c84 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/ConnectionUtils.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/ConnectionUtils.java
@@ -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();
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java
index 2cc7c96c5..df9509e9e 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/DNSUtilTest.java
@@ -116,14 +116,14 @@ public class DNSUtilTest {
assertEquals(ha.getFQDN(), igniterealtimeXMPPServer);
assertEquals(ha.getPort(), igniterealtimeClientPort);
}
-
+
private void xmppServerDomainTest() {
List hostAddresses = DNSUtil.resolveXMPPServerDomain(igniterealtimeDomain);
HostAddress ha = hostAddresses.get(0);
assertEquals(ha.getFQDN(), igniterealtimeXMPPServer);
assertEquals(ha.getPort(), igniterealtimeServerPort);
}
-
+
private static List createSRVRecords() {
List records = new ArrayList();
// We create one record with priority 0 that should also be tried first
diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/XMPPErrorTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/XMPPErrorTest.java
index 6f62c1558..a375e0d81 100644
--- a/smack-core/src/integration-test/java/org/jivesoftware/smack/util/XMPPErrorTest.java
+++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/util/XMPPErrorTest.java
@@ -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 = "" +
"" +
@@ -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;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
index 7d70d8f43..db9bed25c 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
@@ -108,7 +108,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
protected static Collection 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 saslFeatureReceived = new SynchronizationPoint(
AbstractXMPPConnection.this);
-
+
/**
* The SASLAuthentication manager that is responsible for authenticating with the server.
*/
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
index 6d96ca6df..7130489f7 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
@@ -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 null if no packets are currently in the
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
index 9a22054bb..c30568f89 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
@@ -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.
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
index 5d05cb049..815bb3d53 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
@@ -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.
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnectionRegistry.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnectionRegistry.java
index c40c23b05..a45838c40 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnectionRegistry.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnectionRegistry.java
@@ -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);
}
-
+
/**
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java
index 7f40ae771..da5b746d2 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java
@@ -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.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java
index a7d3aa02f..2b4335373 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java
@@ -28,7 +28,7 @@ import org.jivesoftware.smack.util.Objects;
*
*/
public class IQTypeFilter extends FlexibleStanzaTypeFilter {
-
+
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);
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java
index aafcbeb5e..63f2f5511 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java
@@ -152,7 +152,7 @@ public final class Message extends Stanza implements TypedCloneable {
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 {
Subject subject = getMessageSubject(language);
return subject == null ? null : subject.subject;
}
-
+
private Subject getMessageSubject(String language) {
language = determineLanguage(language);
for (Subject subject : subjects) {
@@ -284,7 +284,7 @@ public final class Message extends Stanza implements TypedCloneable {
Body body = getMessageBody(language);
return body == null ? null : body.message;
}
-
+
private Body getMessageBody(String language) {
language = determineLanguage(language);
for (Body body : bodies) {
@@ -400,7 +400,7 @@ public final class Message extends Stanza implements TypedCloneable {
}
private String determineLanguage(String language) {
-
+
// empty string is passed by #setSubject() and #setBody() and is the same as null
language = "".equals(language) ? null : language;
@@ -414,7 +414,7 @@ public final class Message extends Stanza implements TypedCloneable {
else {
return language;
}
-
+
}
@Override
@@ -537,7 +537,7 @@ public final class Message extends Stanza implements TypedCloneable {
// simplified comparison because language and subject are always set
return this.language.equals(other.language) && this.subject.equals(other.subject);
}
-
+
}
/**
@@ -599,7 +599,7 @@ public final class Message extends Stanza implements TypedCloneable {
// simplified comparison because language and message are always set
return this.language.equals(other.language) && this.message.equals(other.message);
}
-
+
}
/**
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java
index 1bd82b14c..9ee34fe3d 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java
@@ -28,7 +28,7 @@ import java.util.logging.Logger;
*/
public class ExceptionLoggingCallback extends ParsingExceptionCallback {
private static final Logger LOGGER = Logger.getLogger(ExceptionLoggingCallback.class.getName());
-
+
@Override
public void handleUnparsablePacket(UnparsablePacket unparsed) throws Exception {
LOGGER.log(Level.SEVERE, "Smack message parsing exception: ", unparsed.getParsingException());
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProviderInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProviderInfo.java
index 7aa26172f..5041586e2 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProviderInfo.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/AbstractProviderInfo.java
@@ -20,13 +20,13 @@ abstract class AbstractProviderInfo {
private String element;
private String ns;
private Object provider;
-
+
AbstractProviderInfo(String elementName, String namespace, Object iqOrExtProvider) {
element = elementName;
ns = namespace;
provider = iqOrExtProvider;
}
-
+
public String getElementName() {
return element;
}
@@ -34,7 +34,7 @@ abstract class AbstractProviderInfo {
public String getNamespace() {
return ns;
}
-
+
Object getProvider() {
return provider;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/IQProviderInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/IQProviderInfo.java
index dc000038d..a08f31eb7 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/IQProviderInfo.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/IQProviderInfo.java
@@ -26,7 +26,7 @@ import org.jivesoftware.smack.packet.IQ;
*
*/
public final class IQProviderInfo extends AbstractProviderInfo {
-
+
/**
* Defines an IQ provider which implements the IQProvider
interface.
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
index 360d29f82..03f215feb 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
@@ -128,7 +128,7 @@ public final class ProviderManager {
addIQProvider(info.getElementName(), info.getNamespace(), info.getProvider());
}
}
-
+
if (loader.getExtensionProviderInfo() != null) {
for (ExtensionProviderInfo info : loader.getExtensionProviderInfo()) {
addExtensionProvider(info.getElementName(), info.getNamespace(), info.getProvider());
@@ -142,7 +142,7 @@ public final class ProviderManager {
}
}
}
-
+
/**
* Returns the IQ provider registered to the specified XML element name and namespace.
* For example, if a provider was registered to the element name "query" and the
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketFactory.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketFactory.java
index c6e37a3cf..3b9b3fa5c 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketFactory.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketFactory.java
@@ -65,7 +65,7 @@ class HTTPProxySocketFactory
throws IOException
{
return httpProxifiedSocket(host.getHostAddress(), port);
-
+
}
public Socket createSocket( InetAddress address, int port,
@@ -74,7 +74,7 @@ class HTTPProxySocketFactory
{
return httpProxifiedSocket(address.getHostAddress(), port);
}
-
+
private Socket httpProxifiedSocket(String host, int port)
throws IOException
{
@@ -96,11 +96,11 @@ class HTTPProxySocketFactory
}
socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: "
+ hostport + proxyLine + "\r\n\r\n").getBytes("UTF-8"));
-
+
InputStream in = socket.getInputStream();
StringBuilder got = new StringBuilder(100);
int nlchars = 0;
-
+
while (true)
{
char c = (char) in.read();
@@ -141,30 +141,30 @@ class HTTPProxySocketFactory
}
String gotstr = got.toString();
-
+
BufferedReader br = new BufferedReader(new StringReader(gotstr));
String response = br.readLine();
-
+
if (response == null)
{
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Empty proxy " +
"response from " + proxyhost + ", cancelling");
}
-
+
Matcher m = RESPONSE_PATTERN.matcher(response);
if (!m.matches())
{
throw new ProxyException(ProxyInfo.ProxyType.HTTP , "Unexpected " +
"proxy response from " + proxyhost + ": " + response);
}
-
+
int code = Integer.parseInt(m.group(1));
-
+
if (code != HttpURLConnection.HTTP_OK)
{
throw new ProxyException(ProxyInfo.ProxyType.HTTP);
}
-
+
return socket;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyException.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyException.java
index 595b13436..66be3b7b6 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyException.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyException.java
@@ -33,12 +33,12 @@ public class ProxyException extends IOException {
{
super("Proxy Exception " + type.toString() + " : "+ex+", "+cause);
}
-
+
public ProxyException(ProxyInfo.ProxyType type, String ex)
{
super("Proxy Exception " + type.toString() + " : "+ex);
}
-
+
public ProxyException(ProxyInfo.ProxyType type)
{
super("Proxy Exception " + type.toString() + " : " + "Unknown Error");
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
index 7c9af83ab..c1b0ad943 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
@@ -34,13 +34,13 @@ public class ProxyInfo
SOCKS4,
SOCKS5
}
-
+
private String proxyAddress;
private int proxyPort;
private String proxyUsername;
private String proxyPassword;
private ProxyType proxyType;
-
+
public ProxyInfo( ProxyType pType, String pHost, int pPort, String pUser,
String pPass)
{
@@ -50,60 +50,60 @@ public class ProxyInfo
this.proxyUsername = pUser;
this.proxyPassword = pPass;
}
-
+
public static ProxyInfo forHttpProxy(String pHost, int pPort, String pUser,
String pPass)
{
return new ProxyInfo(ProxyType.HTTP, pHost, pPort, pUser, pPass);
}
-
+
public static ProxyInfo forSocks4Proxy(String pHost, int pPort, String pUser,
String pPass)
{
return new ProxyInfo(ProxyType.SOCKS4, pHost, pPort, pUser, pPass);
}
-
+
public static ProxyInfo forSocks5Proxy(String pHost, int pPort, String pUser,
String pPass)
{
return new ProxyInfo(ProxyType.SOCKS5, pHost, pPort, pUser, pPass);
}
-
+
public static ProxyInfo forNoProxy()
{
return new ProxyInfo(ProxyType.NONE, null, 0, null, null);
}
-
+
public static ProxyInfo forDefaultProxy()
{
return new ProxyInfo(ProxyType.NONE, null, 0, null, null);
}
-
+
public ProxyType getProxyType()
{
return proxyType;
}
-
+
public String getProxyAddress()
{
return proxyAddress;
}
-
+
public int getProxyPort()
{
return proxyPort;
}
-
+
public String getProxyUsername()
{
return proxyUsername;
}
-
+
public String getProxyPassword()
{
return proxyPassword;
}
-
+
public SocketFactory getSocketFactory()
{
if(proxyType == ProxyType.NONE)
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketFactory.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketFactory.java
index a64f93929..e3613c953 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketFactory.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketFactory.java
@@ -34,7 +34,7 @@ public class Socks4ProxySocketFactory
extends SocketFactory
{
private ProxyInfo proxy;
-
+
public Socks4ProxySocketFactory(ProxyInfo proxy)
{
this.proxy = proxy;
@@ -44,7 +44,7 @@ public class Socks4ProxySocketFactory
throws IOException, UnknownHostException
{
return socks4ProxifiedSocket(host,port);
-
+
}
public Socket createSocket(String host ,int port, InetAddress localHost,
@@ -65,9 +65,9 @@ public class Socks4ProxySocketFactory
throws IOException
{
return socks4ProxifiedSocket(address.getHostAddress(),port);
-
+
}
-
+
@SuppressWarnings("resource")
private Socket socks4ProxifiedSocket(String host, int port)
throws IOException
@@ -85,7 +85,7 @@ public class Socks4ProxySocketFactory
in=socket.getInputStream();
out=socket.getOutputStream();
socket.setTcpNoDelay(true);
-
+
byte[] buf=new byte[1024];
int index=0;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketFactory.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketFactory.java
index 4bb2308d7..a93af3ec1 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketFactory.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketFactory.java
@@ -33,7 +33,7 @@ public class Socks5ProxySocketFactory
extends SocketFactory
{
private ProxyInfo proxy;
-
+
public Socks5ProxySocketFactory(ProxyInfo proxy)
{
this.proxy = proxy;
@@ -49,28 +49,28 @@ public class Socks5ProxySocketFactory
int localPort)
throws IOException, UnknownHostException
{
-
+
return socks5ProxifiedSocket(host,port);
-
+
}
public Socket createSocket(InetAddress host, int port)
throws IOException
{
-
+
return socks5ProxifiedSocket(host.getHostAddress(),port);
-
+
}
public Socket createSocket( InetAddress address, int port,
InetAddress localAddress, int localPort)
throws IOException
{
-
+
return socks5ProxifiedSocket(address.getHostAddress(),port);
-
+
}
-
+
private Socket socks5ProxifiedSocket(String host, int port)
throws IOException
{
@@ -81,7 +81,7 @@ public class Socks5ProxySocketFactory
int proxy_port = proxy.getProxyPort();
String user = proxy.getProxyUsername();
String passwd = proxy.getProxyPassword();
-
+
try
{
socket=new Socket(proxy_host, proxy_port);
@@ -241,7 +241,7 @@ public class Socks5ProxySocketFactory
o DST.PORT desired destination port in network octet
order
*/
-
+
index=0;
buf[index++]=5;
buf[index++]=1; // CONNECT
@@ -328,7 +328,7 @@ public class Socks5ProxySocketFactory
default:
}
return socket;
-
+
}
catch(RuntimeException e)
{
@@ -355,7 +355,7 @@ public class Socks5ProxySocketFactory
throw new IOException(message);
}
}
-
+
private void fill(InputStream in, byte[] buf, int len)
throws IOException
{
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ObservableReader.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ObservableReader.java
index ad83fa283..252d1c794 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/ObservableReader.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ObservableReader.java
@@ -36,7 +36,7 @@ public class ObservableReader extends Reader {
public ObservableReader(Reader wrappedReader) {
this.wrappedReader = wrappedReader;
}
-
+
public int read(char[] cbuf, int off, int len) throws IOException {
int count = wrappedReader.read(cbuf, off, len);
if (count > 0) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
index a9ad69295..c2fc7a49b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
@@ -226,7 +226,7 @@ public class PacketParserUtils {
message.setType(Message.Type.fromString(typeString));
}
String language = getLanguageAttribute(parser);
-
+
// determine message's default language
String defaultLanguage = null;
if (language != null && !"".equals(language.trim())) {
@@ -891,7 +891,7 @@ public class PacketParserUtils {
XmlPullParser parser) throws Exception {
return parseExtensionElement(elementName, namespace, parser);
}
-
+
/**
* Parses an extension element.
*
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ReaderListener.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ReaderListener.java
index d7e34f6ce..9fc4d081e 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/ReaderListener.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ReaderListener.java
@@ -34,5 +34,5 @@ public interface ReaderListener {
* @param str the read String
*/
public abstract void read(String str);
-
+
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
index 230ca58e4..2e970ca64 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
@@ -144,7 +144,7 @@ public class StringUtils {
throw new IllegalStateException("UTF-8 encoding not supported by platform", e);
}
}
-
+
/**
* Pseudo-random number generator object for use with randomString().
* The Random class is not considered to be cryptographically secure, so
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
index 437a54e2f..db0e1304e 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
@@ -111,7 +111,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
}
return this;
}
-
+
public XmlStringBuilder optElement(String name, Object object) {
if (object != null) {
element(name, object.toString());
@@ -272,7 +272,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
optAttribute("xml:lang", value);
return this;
}
-
+
public XmlStringBuilder escape(String text) {
assert text != null;
sb.append(StringUtils.escapeForXML(text));
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/dns/SRVRecord.java b/smack-core/src/main/java/org/jivesoftware/smack/util/dns/SRVRecord.java
index a4e61aa99..2d2707d26 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/dns/SRVRecord.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/dns/SRVRecord.java
@@ -23,10 +23,10 @@ package org.jivesoftware.smack.util.dns;
*
*/
public class SRVRecord extends HostAddress implements Comparable {
-
+
private int weight;
private int priority;
-
+
/**
* Create a new SRVRecord
*
@@ -52,11 +52,11 @@ public class SRVRecord extends HostAddress implements Comparable {
this.weight = weight;
}
-
+
public int getPriority() {
return priority;
}
-
+
public int getWeight() {
return weight;
}
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java b/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
index f7d8da946..b6354ff11 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
@@ -99,7 +99,7 @@ public class DummyConnection extends AbstractXMPPConnection {
protected void shutdown() {
user = null;
authenticated = false;
-
+
callConnectionClosedListener();
reconnect = true;
}
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java
index a4a19b16f..8f213a4cc 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java
@@ -30,13 +30,13 @@ public class PacketCollectorTest
public void verifyRollover() throws InterruptedException
{
TestPacketCollector collector = new TestPacketCollector(null, new OKEverything(), 5);
-
+
for (int i=0; i<6; i++)
{
Stanza testPacket = new TestPacket(i);
collector.processPacket(testPacket);
}
-
+
// Assert that '0' has rolled off
assertEquals("1", collector.nextResultBlockForever().getStanzaId());
assertEquals("2", collector.nextResultBlockForever().getStanzaId());
@@ -44,20 +44,20 @@ public class PacketCollectorTest
assertEquals("4", collector.nextResultBlockForever().getStanzaId());
assertEquals("5", collector.pollResult().getStanzaId());
assertNull(collector.pollResult());
-
+
for (int i=10; i<15; i++)
{
Stanza testPacket = new TestPacket(i);
collector.processPacket(testPacket);
}
-
+
assertEquals("10", collector.nextResultBlockForever().getStanzaId());
assertEquals("11", collector.nextResultBlockForever().getStanzaId());
assertEquals("12", collector.nextResultBlockForever().getStanzaId());
assertEquals("13", collector.nextResultBlockForever().getStanzaId());
assertEquals("14", collector.pollResult().getStanzaId());
assertNull(collector.pollResult());
-
+
assertNull(collector.nextResult(1000));
}
@@ -70,7 +70,7 @@ public class PacketCollectorTest
{
int insertCount = 500;
final TestPacketCollector collector = new TestPacketCollector(null, new OKEverything(), insertCount);
-
+
Thread consumer1 = new Thread(new Runnable()
{
@Override
@@ -105,7 +105,7 @@ public class PacketCollectorTest
public void run()
{
Stanza p = null;
-
+
do
{
try
@@ -134,7 +134,7 @@ public class PacketCollectorTest
public void run()
{
Stanza p = null;
-
+
do
{
try
@@ -155,7 +155,7 @@ public class PacketCollectorTest
consumer1.start();
consumer2.start();
consumer3.start();
-
+
for(int i=0; i getIQProviderInfo() {
ArrayList l = new ArrayList(1);
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
index 640dc81e7..d74cade34 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
@@ -51,19 +51,19 @@ import com.jamesmurty.utils.XMLBuilder;
*
*/
public class PacketParserUtilsTest {
-
+
private static Properties outputProperties = new Properties();
{
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
}
-
+
@Test
public void singleMessageBodyTest() throws Exception {
String defaultLanguage = Stanza.getDefaultLanguage();
String otherLanguage = determineNonDefaultLanguage();
String control;
-
+
// message has default language, body has no language
control = XMLBuilder.create("message")
.a("from", "romeo@montague.lit/orchard")
@@ -74,7 +74,7 @@ public class PacketParserUtilsTest {
.e("body")
.t(defaultLanguage)
.asString(outputProperties);
-
+
Message message = (Message) PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control));
@@ -102,7 +102,7 @@ public class PacketParserUtilsTest {
assertEquals(otherLanguage, message.getBody(otherLanguage));
assertNull(message.getBody(defaultLanguage));
assertXMLEqual(control, message.toXML().toString());
-
+
// message has no language, body has no language
control = XMLBuilder.create("message")
.a("from", "romeo@montague.lit/orchard")
@@ -112,7 +112,7 @@ public class PacketParserUtilsTest {
.e("body")
.t(defaultLanguage)
.asString(outputProperties);
-
+
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody());
@@ -212,7 +212,7 @@ public class PacketParserUtilsTest {
String otherLanguage = determineNonDefaultLanguage();
String control;
-
+
// message has default language, subject has no language
control = XMLBuilder.create("message")
.a("from", "romeo@montague.lit/orchard")
@@ -223,7 +223,7 @@ public class PacketParserUtilsTest {
.e("subject")
.t(defaultLanguage)
.asString(outputProperties);
-
+
Message message = (Message) PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control));
@@ -251,7 +251,7 @@ public class PacketParserUtilsTest {
assertEquals(otherLanguage, message.getSubject(otherLanguage));
assertNull(message.getSubject(defaultLanguage));
assertXMLEqual(control, message.toXML().toString());
-
+
// message has no language, subject has no language
control = XMLBuilder.create("message")
.a("from", "romeo@montague.lit/orchard")
@@ -261,7 +261,7 @@ public class PacketParserUtilsTest {
.e("subject")
.t(defaultLanguage)
.asString(outputProperties);
-
+
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject());
@@ -359,7 +359,7 @@ public class PacketParserUtilsTest {
public void multipleMessageBodiesTest() throws Exception {
String defaultLanguage = Stanza.getDefaultLanguage();
String otherLanguage = determineNonDefaultLanguage();
-
+
String control;
Message message;
@@ -512,7 +512,7 @@ public class PacketParserUtilsTest {
public void multipleMessageSubjectsTest() throws Exception {
String defaultLanguage = Stanza.getDefaultLanguage();
String otherLanguage = determineNonDefaultLanguage();
-
+
String control;
Message message;
@@ -700,7 +700,7 @@ public class PacketParserUtilsTest {
.asString(outputProperties);
String invalidControl = validControl.replace("Good Message Body", "Bad Body");
-
+
try {
PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl));
fail("Exception should be thrown");
@@ -709,7 +709,7 @@ public class PacketParserUtilsTest {
}
invalidControl = validControl.replace("Good Message Body", "Bad