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 Body"); - + try { PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl)); fail("Exception should be thrown"); @@ -718,7 +718,7 @@ public class PacketParserUtilsTest { } invalidControl = validControl.replace("Good Message Body", "Bad Body"); - + try { PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(invalidControl)); fail("Exception should be thrown"); @@ -755,22 +755,22 @@ public class PacketParserUtilsTest { @Test public void validateSimplePresence() throws Exception { String stanza = ""; - + Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); - + assertXMLEqual(stanza, presence.toXML().toString()); } - + @Test public void validatePresenceProbe() throws Exception { String stanza = ""; - + Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); - + assertXMLEqual(stanza, presence.toXML().toString()); assertEquals(Presence.Type.unsubscribed, presence.getType()); } - + @Test public void validatePresenceOptionalElements() throws Exception { String stanza = "" @@ -778,7 +778,7 @@ public class PacketParserUtilsTest { + "Wooing Juliet" + "1" + ""; - + Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); assertXMLEqual(stanza, presence.toXML().toString()); assertEquals(Presence.Type.unsubscribed, presence.getType()); diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/StringUtilsTest.java b/smack-core/src/test/java/org/jivesoftware/smack/util/StringUtilsTest.java index 87ec18e19..e2f0eb440 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/util/StringUtilsTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/util/StringUtilsTest.java @@ -62,7 +62,7 @@ public class StringUtilsTest { input = "&"; assertCharSequenceEquals("&", StringUtils.escapeForXML(input)); - + input = "It's a good day today"; assertCharSequenceEquals("It's a good day today", StringUtils.escapeForXML(input)); } diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java index c5c052e0b..50aa52fd3 100644 --- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java +++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java @@ -99,7 +99,7 @@ import java.util.logging.Logger; public class EnhancedDebugger implements SmackDebugger { private static final Logger LOGGER = Logger.getLogger(EnhancedDebugger.class.getName()); - + private static final String NEWLINE = "\n"; private static ImageIcon packetReceivedIcon; @@ -354,22 +354,22 @@ public class EnhancedDebugger implements SmackDebugger { messageTextArea.addMouseListener(new PopupListener(menu)); JPanel sublayout = new JPanel(new BorderLayout()); sublayout.add(new JScrollPane(messageTextArea), BorderLayout.CENTER); - + JButton clearb = new JButton("Clear All Packets"); - + clearb.addActionListener(new AbstractAction() { private static final long serialVersionUID = -8576045822764763613L; @Override public void actionPerformed(ActionEvent e) { messagesTable.setRowCount(0); - + } }); sublayout.add(clearb, BorderLayout.NORTH); allPane.setBottomComponent(sublayout); - + allPane.setDividerLocation(150); tabbedPane.add("All Packets", allPane); diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java index 7c81930bd..6de6c7271 100644 --- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java +++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java @@ -197,7 +197,7 @@ public class EnhancedDebuggerWindow { getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane), connectionActiveIcon); } - + /** * Creates the main debug window that provides information about Smack and also shows * a tab panel for each connection that is being debugged. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java index 2343d2623..0b7141590 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java @@ -58,7 +58,7 @@ public class CarbonManager extends Manager { } }); } - + private volatile boolean enabled_state = false; private CarbonManager(XMPPConnection connection) { diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java index c0f9e3e07..256fac90d 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java @@ -45,24 +45,24 @@ public class CarbonTest extends ExperimentalInitializerTest { String control; CarbonExtension cc; Forwarded fwd; - + control = XMLBuilder.create("sent") .e("forwarded") .a("xmlns", "urn:xmpp:forwarded:0") .e("message") .a("from", "romeo@montague.com") .asString(outputProperties); - + parser = PacketParserUtils.getParserFor(control); cc = (CarbonExtension) new CarbonManagerProvider().parse(parser); fwd = cc.getForwarded(); // meta assertEquals(CarbonExtension.Direction.sent, cc.getDirection()); - + // no delay in packet assertEquals(null, fwd.getDelayInformation()); - + // check message assertThat("romeo@montague.com", equalsCharSequence(fwd.getForwardedPacket().getFrom())); @@ -76,19 +76,19 @@ public class CarbonTest extends ExperimentalInitializerTest { XmlPullParser parser; String control; CarbonExtension cc; - + control = XMLBuilder.create("received") .e("forwarded") .a("xmlns", "urn:xmpp:forwarded:0") .e("message") .a("from", "romeo@montague.com") .asString(outputProperties); - + parser = PacketParserUtils.getParserFor(control); cc = (CarbonExtension) new CarbonManagerProvider().parse(parser); assertEquals(CarbonExtension.Direction.received, cc.getDirection()); - + // check end of tag assertEquals(XmlPullParser.END_TAG, parser.getEventType()); assertEquals("received", parser.getName()); @@ -98,11 +98,11 @@ public class CarbonTest extends ExperimentalInitializerTest { public void carbonEmptyTest() throws Exception { XmlPullParser parser; String control; - + control = XMLBuilder.create("sent") .a("xmlns", "urn:xmpp:forwarded:0") .asString(outputProperties); - + parser = PacketParserUtils.getParserFor(control); new CarbonManagerProvider().parse(parser); } diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java index b6d58ed1b..230afcd17 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/ServiceDiscoveryManagerTest.java @@ -133,7 +133,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { itemToPublish.setNode("romeo/avatar"); itemToPublish.setAction(DiscoverItems.Item.UPDATE_ACTION); itemsToPublish.addItem(itemToPublish); - + try { ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getServiceName(), itemsToPublish); @@ -141,7 +141,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase { catch (Exception e) { fail(e.getMessage()); } - + }*/ protected int getMaxConnections() { diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamTest.java index fbbed78fa..da14f8f80 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamTest.java @@ -140,7 +140,7 @@ public class Socks5ByteStreamTest extends SmackTestCase { Socks5BytestreamSession session = initiatorByteStreamManager.establishSession( targetConnection.getUser()); OutputStream outputStream = session.getOutputStream(); - + assertTrue(session.isDirect()); // verify stream @@ -284,9 +284,9 @@ public class Socks5ByteStreamTest extends SmackTestCase { Socks5BytestreamManager initiatorByteStreamManager = Socks5BytestreamManager.getBytestreamManager(initiatorConnection); Socks5BytestreamSession session = initiatorByteStreamManager.establishSession(targetConnection.getUser()); - + assertTrue(session.isMediated()); - + // verify stream final byte[] receivedData = new byte[3]; final InputStream inputStream = session.getInputStream(); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/commands/AdHocCommandDiscoTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/commands/AdHocCommandDiscoTest.java index 3450a74ba..79e5b422e 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/commands/AdHocCommandDiscoTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/commands/AdHocCommandDiscoTest.java @@ -81,7 +81,7 @@ public class AdHocCommandDiscoTest extends SmackTestCase { }; } }); - + AdHocCommandManager manager2 = AdHocCommandManager.getAddHocCommandsManager(getConnection(1)); DiscoverItems items = manager2.discoverCommands(getFullJID(0)); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java index 4439062c5..4e39fec37 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java @@ -47,7 +47,7 @@ public class EntityCapsTest extends SmackTestCase { sdm1 = ServiceDiscoveryManager.getInstanceFor(con1); letsAllBeFriends(); } - + public void testLocalEntityCaps() throws InterruptedException { DiscoverInfo info = EntityCapsManager.getDiscoveryInfoByNodeVer(ecm1.getLocalNodeVer()); assertFalse(info.containsFeature(DISCOVER_TEST_FEATURE)); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtension.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtension.java index a0c0c66c4..db74663cc 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtension.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtension.java @@ -33,7 +33,7 @@ class CarExtension implements PacketExtension color = col; numTires = num; } - + public String getColor() { return color; @@ -59,5 +59,5 @@ class CarExtension implements PacketExtension return "<" + getElementName() + " xmlns='" + getNamespace() + "'>"; } - + } diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtensionProvider.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtensionProvider.java index e250fe874..f266a03e0 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtensionProvider.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/CarExtensionProvider.java @@ -32,11 +32,11 @@ public class CarExtensionProvider extends PacketExtensionProvider { String color = null; int numTires = 0; - + for (int i=0; i<2; i++) { while (parser.next() != XmlPullParser.START_TAG); - + if (parser.getName().equals("paint")) { color = parser.getAttributeValue(0); @@ -49,5 +49,5 @@ public class CarExtensionProvider extends PacketExtensionProvider while (parser.next() != XmlPullParser.END_TAG); return new CarExtension(color, numTires); } - + } diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/EntityUseCases.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/EntityUseCases.java index 43b495eea..d70379e24 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/EntityUseCases.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/EntityUseCases.java @@ -15,7 +15,7 @@ * limitations under the License. */ package org.jivesoftware.smackx.pubsub; - + import java.util.Iterator; import java.util.List; @@ -43,10 +43,10 @@ public class EntityUseCases extends SingleUserTestCase DiscoverInfo info = myNode.discoverInfo(); assertTrue(info.getIdentities().hasNext()); Identity ident = info.getIdentities().next(); - + assertEquals("leaf", ident.getType()); } - + public void testDiscoverNodeItems() throws Exception { LeafNode myNode = getRandomPubnode(getManager(), true, false); @@ -55,33 +55,33 @@ public class EntityUseCases extends SingleUserTestCase myNode.send(new Item()); myNode.send(new Item()); DiscoverItems items = myNode.discoverItems(); - + int count = 0; - + for(Iterator it = items.getItems(); it.hasNext(); it.next(),count++); - + assertEquals(4, count); } - + public void testDiscoverSubscriptions() throws Exception { getManager().getSubscriptions(); } - + public void testDiscoverNodeSubscriptions() throws Exception { LeafNode myNode = getRandomPubnode(getManager(), true, true); myNode.subscribe(getConnection(0).getUser()); List subscriptions = myNode.getSubscriptions(); - + assertTrue(subscriptions.size() < 3); - + for (Subscription subscription : subscriptions) { assertNull(subscription.getNode()); } } - + public void testRetrieveAffiliation() throws Exception { getManager().getAffiliations(); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/MultiUserSubscriptionUseCases.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/MultiUserSubscriptionUseCases.java index 3a4bb6caa..32c025ede 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/MultiUserSubscriptionUseCases.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/MultiUserSubscriptionUseCases.java @@ -45,7 +45,7 @@ public class MultiUserSubscriptionUseCases extends PubSubTestCase node.send((Item)null); node.send((Item)null); node.send((Item)null); - + LeafNode user2Node = (LeafNode) getManager(1).getNode(node.getId()); user2Node.subscribe(getBareJID(1)); @@ -61,7 +61,7 @@ public class MultiUserSubscriptionUseCases extends PubSubTestCase node.send((Item)null); node.send((Item)null); node.send((Item)null); - + LeafNode user2Node = (LeafNode) getManager(1).getNode(node.getId()); Subscription sub1 = user2Node.subscribe(getBareJID(1)); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/OwnerUseCases.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/OwnerUseCases.java index abf6c3f7a..5eef138cb 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/OwnerUseCases.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/OwnerUseCases.java @@ -15,7 +15,7 @@ * limitations under the License. */ package org.jivesoftware.smackx.pubsub; - + import java.util.Collection; import org.jivesoftware.smack.XMPPException; @@ -46,7 +46,7 @@ public class OwnerUseCases extends SingleUserTestCase { // Generate reasonably unique for multiple tests String id = "TestConfigNode" + System.currentTimeMillis(); - + // Create and configure a node ConfigureForm form = new ConfigureForm(FormType.submit); form.setAccessModel(AccessModel.open); @@ -56,7 +56,7 @@ public class OwnerUseCases extends SingleUserTestCase form.setPublishModel(PublishModel.open); LeafNode node = (LeafNode)getManager().createNode(id, form); - + ConfigureForm currentForm = node.getNodeConfiguration(); assertEquals(AccessModel.open, currentForm.getAccessModel()); assertFalse(currentForm.isDeliverPayloads()); @@ -69,7 +69,7 @@ public class OwnerUseCases extends SingleUserTestCase { // Generate reasonably unique for multiple tests String id = "TestConfigNode2" + System.currentTimeMillis(); - + // Create and configure a node ConfigureForm form = new ConfigureForm(FormType.submit); form.setAccessModel(AccessModel.open); @@ -77,16 +77,16 @@ public class OwnerUseCases extends SingleUserTestCase form.setNotifyRetract(true); form.setPersistentItems(true); form.setPublishModel(PublishModel.open); - + LeafNode myNode = (LeafNode)getManager().createNode(id, form); ConfigureForm config = myNode.getNodeConfiguration(); - + assertEquals(AccessModel.open, config.getAccessModel()); assertFalse(config.isDeliverPayloads()); assertTrue(config.isNotifyRetract()); assertTrue(config.isPersistItems()); assertEquals(PublishModel.open, config.getPublishModel()); - + ConfigureForm submitForm = new ConfigureForm(config.createAnswerForm()); submitForm.setAccessModel(AccessModel.whitelist); submitForm.setDeliverPayloads(true); @@ -108,14 +108,14 @@ public class OwnerUseCases extends SingleUserTestCase ConfigureForm form = getManager().getDefaultConfiguration(); assertNotNull(form); } - + public void testDeleteNode() throws Exception { LeafNode myNode = getManager().createNode(); assertNotNull(getManager().getNode(myNode.getId())); - + getManager(0).deleteNode(myNode.getId()); - + try { assertNull(getManager().getNode(myNode.getId())); @@ -125,23 +125,23 @@ public class OwnerUseCases extends SingleUserTestCase { } } - + public void testPurgeItems() throws XMPPException { LeafNode node = getRandomPubnode(getManager(), true, false); - + node.send(new Item()); node.send(new Item()); node.send(new Item()); node.send(new Item()); node.send(new Item()); - + Collection items = node.getItems(); assertTrue(items.size() == 5); node.deleteAllItems(); items = node.getItems(); - + // Pubsub service may keep the last notification (in spec), so 0 or 1 may be returned on get items. assertTrue(items.size() < 2); } diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/PublisherUseCases.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/PublisherUseCases.java index dd27005a0..744cbc7c1 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/PublisherUseCases.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/PublisherUseCases.java @@ -15,7 +15,7 @@ * limitations under the License. */ package org.jivesoftware.smackx.pubsub; - + import java.util.Collection; import java.util.List; @@ -126,39 +126,39 @@ public class PublisherUseCases extends SingleUserTestCase public void testDeleteItems() throws XMPPException { LeafNode node = getPubnode(true, false); - + node.send(new Item("1")); node.send(new Item("2")); node.send(new Item("3")); node.send(new Item("4")); - + node.deleteItem("1"); Collection items = node.getItems(); - + assertEquals(3, items.size()); } public void testPersistItems() throws XMPPException { LeafNode node = getPubnode(true, false); - + node.send(new Item("1")); node.send(new Item("2")); node.send(new Item("3")); node.send(new Item("4")); - + Collection items = node.getItems(); - + assertTrue(items.size() == 4); } - + public void testItemOverwritten() throws XMPPException { LeafNode node = getPubnode(true, false); - + node.send(new PayloadItem("1", new SimplePayload("test", null, ""))); node.send(new PayloadItem("1", new SimplePayload("test2", null, ""))); - + List items = node.getItems(); assertEquals(1, items.size()); assertEquals("1", items.get(0).getId()); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/SubscriberUseCases.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/SubscriberUseCases.java index 5464bb82e..d909a4e90 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/SubscriberUseCases.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/SubscriberUseCases.java @@ -15,7 +15,7 @@ * limitations under the License. */ package org.jivesoftware.smackx.pubsub; - + import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import java.util.ArrayList; @@ -40,7 +40,7 @@ public class SubscriberUseCases extends SingleUserTestCase { LeafNode node = getPubnode(false, false); Subscription sub = node.subscribe(getJid()); - + assertEquals(getJid(), sub.getJid()); assertNotNull(sub.getId()); assertEquals(node.getId(), sub.getNode()); @@ -50,7 +50,7 @@ public class SubscriberUseCases extends SingleUserTestCase public void testSubscribeBadJid() throws Exception { LeafNode node = getPubnode(false, false); - + try { node.subscribe("this@over.here"); @@ -71,12 +71,12 @@ public class SubscriberUseCases extends SingleUserTestCase LeafNode node = getPubnode(false, false); node.subscribe(getJid(), form); } - + public void testSubscribeConfigRequired() throws Exception { ConfigureForm form = new ConfigureForm(FormType.submit); form.setAccessModel(AccessModel.open); - + // Openfire specific field - nothing in the spec yet FormField required = new FormField("pubsub#subscription_required"); required.setType(FormField.TYPE_BOOLEAN); @@ -85,31 +85,31 @@ public class SubscriberUseCases extends SingleUserTestCase LeafNode node = (LeafNode)getManager().createNode("Pubnode" + System.currentTimeMillis(), form); Subscription sub = node.subscribe(getJid()); - + assertEquals(getJid(), sub.getJid()); assertNotNull(sub.getId()); assertEquals(node.getId(), sub.getNode()); assertEquals(true, sub.isConfigRequired()); } - + public void testUnsubscribe() throws Exception { LeafNode node = getPubnode(false, false); node.subscribe(getJid()); Collection subs = node.getSubscriptions(); - + node.unsubscribe(getJid()); Collection afterSubs = node.getSubscriptions(); assertEquals(subs.size()-1, afterSubs.size()); } - + public void testUnsubscribeWithMultipleNoSubId() throws Exception { LeafNode node = getPubnode(false, false); node.subscribe(getBareJID(0)); node.subscribe(getBareJID(0)); node.subscribe(getBareJID(0)); - + try { node.unsubscribe(getBareJID(0)); @@ -119,7 +119,7 @@ public class SubscriberUseCases extends SingleUserTestCase { } } - + public void testUnsubscribeWithMultipleWithSubId() throws Exception { LeafNode node = getPubnode(false, false); @@ -128,7 +128,7 @@ public class SubscriberUseCases extends SingleUserTestCase node.subscribe(getJid()); node.unsubscribe(getJid(), sub.getId()); } - + public void testGetOptions() throws Exception { LeafNode node = getPubnode(false, false); @@ -136,7 +136,7 @@ public class SubscriberUseCases extends SingleUserTestCase SubscribeForm form = node.getSubscriptionOptions(getJid(), sub.getId()); assertNotNull(form); } - + // public void testSubscribeWithConfig() throws Exception // { // LeafNode node = getPubnode(false, false); @@ -154,7 +154,7 @@ public class SubscriberUseCases extends SingleUserTestCase LeafNode node = getPubnode(true, false); runNodeTests(node); } - + private void runNodeTests(LeafNode node) throws Exception { node.send((Item)null); @@ -162,17 +162,17 @@ public class SubscriberUseCases extends SingleUserTestCase node.send((Item)null); node.send((Item)null); node.send((Item)null); - + Collection items = node.getItems(); assertTrue(items.size() == 5); - + long curTime = System.currentTimeMillis(); node.send(new Item("1-" + curTime)); node.send(new Item("2-" + curTime)); node.send(new Item("3-" + curTime)); node.send(new Item("4-" + curTime)); node.send(new Item("5-" + curTime)); - + items = node.getItems(); assertTrue(items.size() == 10); @@ -183,35 +183,35 @@ public class SubscriberUseCases extends SingleUserTestCase idPayload.put("7-" + curTime, ""); idPayload.put("8-" + curTime, "text"); idPayload.put("9-" + curTime, ""); - + for (Map.Entry payload : idPayload.entrySet()) { payloadNode.send(new PayloadItem(payload.getKey(), new SimplePayload("a", "pubsub:test", payload.getValue()))); } - + payloadNode.send(new PayloadItem("6-" + curTime, new SimplePayload("a", "pubsub:test", ""))); payloadNode.send(new PayloadItem("7-" + curTime, new SimplePayload("a", "pubsub:test", ""))); payloadNode.send(new PayloadItem("8-" + curTime, new SimplePayload("entity", "pubsub:test", "texta"))); payloadNode.send(new PayloadItem("9-" + curTime, new SimplePayload("entity", "pubsub:test", "b"))); - + List> payloadItems = payloadNode.getItems(); Map> idMap = new HashMap>(); - + for (PayloadItem payloadItem : payloadItems) { idMap.put(payloadItem.getId(), payloadItem); } - + assertEquals(4, payloadItems.size()); PayloadItem testItem = idMap.get("6-" + curTime); assertNotNull(testItem); assertXMLEqual("", testItem.getPayload().toXML()); - + testItem = idMap.get("7-" + curTime); assertNotNull(testItem); assertXMLEqual("", testItem.getPayload().toXML()); - + testItem = idMap.get("8-" + curTime); assertNotNull(testItem); assertXMLEqual("texta", testItem.getPayload().toXML()); @@ -224,13 +224,13 @@ public class SubscriberUseCases extends SingleUserTestCase public void testGetSpecifiedItems() throws Exception { LeafNode node = getPubnode(true, true); - + node.send(new PayloadItem("1", new SimplePayload("a", "pubsub:test", ""))); node.send(new PayloadItem("2", new SimplePayload("a", "pubsub:test", ""))); node.send(new PayloadItem("3", new SimplePayload("a", "pubsub:test", ""))); node.send(new PayloadItem("4", new SimplePayload("a", "pubsub:test", ""))); node.send(new PayloadItem("5", new SimplePayload("a", "pubsub:test", ""))); - + Collection ids = new ArrayList(3); ids.add("1"); ids.add("3"); @@ -249,13 +249,13 @@ public class SubscriberUseCases extends SingleUserTestCase public void testGetLastNItems() throws XMPPException { LeafNode node = getPubnode(true, false); - + node.send(new Item("1")); node.send(new Item("2")); node.send(new Item("3")); node.send(new Item("4")); node.send(new Item("5")); - + List items = node.getItems(2); assertEquals(2, items.size()); assertTrue(listContainsId("4", items)); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestAPI.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestAPI.java index cb71b10f9..c12d8f0f6 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestAPI.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestAPI.java @@ -15,7 +15,7 @@ * limitations under the License. */ package org.jivesoftware.smackx.pubsub; - + import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smackx.pubsub.test.SingleUserTestCase; diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java index 7d68d3c0a..e0eabfbf8 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestEvents.java @@ -59,7 +59,7 @@ public class TestEvents extends SmackTestCase { String nodeId = "MyTestNode"; PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); - + LeafNode creatorNode = null; try { @@ -72,10 +72,10 @@ public class TestEvents extends SmackTestCase else throw e; } - + PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); - + assertNotNull(subNode); } @@ -84,7 +84,7 @@ public class TestEvents extends SmackTestCase // Setup event source String nodeId = "TestNode" + System.currentTimeMillis(); PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); - + LeafNode creatorNode = getPubnode(creatorMgr, nodeId, false, true); BlockingQueue queue = new ArrayBlockingQueue(3); @@ -96,7 +96,7 @@ public class TestEvents extends SmackTestCase NodeConfigListener sub1Handler = new NodeConfigCoordinator(queue, "sub1"); subNode.subscribe(getConnection(1).getUser()); subNode.addConfigurationListener(sub1Handler); - + ConfigureForm currentConfig = creatorNode.getNodeConfiguration(); ConfigureForm form = new ConfigureForm(currentConfig.createAnswerForm()); form.setPersistentItems(true); @@ -107,7 +107,7 @@ public class TestEvents extends SmackTestCase ConfigurationEvent event = queue.poll(5, TimeUnit.SECONDS).event; assertEquals(nodeId, event.getNode()); assertNull(event.getConfiguration()); - + currentConfig = creatorNode.getNodeConfiguration(); form = new ConfigureForm(currentConfig.createAnswerForm()); form.setDeliverPayloads(true); @@ -128,7 +128,7 @@ public class TestEvents extends SmackTestCase LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, false); BlockingQueue> queue = new ArrayBlockingQueue>(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -136,16 +136,16 @@ public class TestEvents extends SmackTestCase ItemEventCoordinator sub1Handler = new ItemEventCoordinator(queue, "sub1"); subNode.addItemEventListener(sub1Handler); Subscription sub1 = subNode.subscribe(getConnection(1).getUser()); - + // Send event String itemId = String.valueOf(System.currentTimeMillis()); creatorNode.send(new Item(itemId)); - + ItemEventCoordinator coord = queue.poll(5, TimeUnit.SECONDS); assertEquals(1, coord.events.getItems().size()); assertEquals(itemId, coord.events.getItems().iterator().next().getId()); } - + public void testPublishAndReceiveNoPayload() throws Exception { // Setup event source @@ -154,7 +154,7 @@ public class TestEvents extends SmackTestCase LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, false); BlockingQueue> queue = new ArrayBlockingQueue>(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -162,11 +162,11 @@ public class TestEvents extends SmackTestCase ItemEventCoordinator sub1Handler = new ItemEventCoordinator(queue, "sub1"); subNode.addItemEventListener(sub1Handler); Subscription sub1 = subNode.subscribe(getConnection(1).getUser()); - + // Send event String itemId = String.valueOf(System.currentTimeMillis()); creatorNode.publish(new Item(itemId)); - + ItemEventCoordinator coord = queue.poll(5, TimeUnit.SECONDS); assertEquals(1, coord.events.getItems().size()); assertEquals(itemId, coord.events.getItems().get(0).getId()); @@ -180,7 +180,7 @@ public class TestEvents extends SmackTestCase LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, true); BlockingQueue>> queue = new ArrayBlockingQueue>>(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -188,12 +188,12 @@ public class TestEvents extends SmackTestCase ItemEventCoordinator> sub1Handler = new ItemEventCoordinator>(queue, "sub1"); subNode.addItemEventListener(sub1Handler); Subscription sub1 = subNode.subscribe(getConnection(1).getUser()); - + // Send event String itemId = String.valueOf(System.currentTimeMillis()); String payloadString = "Sir Arthur Conan Doyle"; creatorNode.send(new PayloadItem(itemId, new SimplePayload("book", "pubsub:test:book", payloadString))); - + ItemEventCoordinator> coord = queue.poll(5, TimeUnit.SECONDS); assertEquals(1, coord.events.getItems().size()); PayloadItem item = coord.events.getItems().get(0); @@ -221,7 +221,7 @@ public class TestEvents extends SmackTestCase LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, true); BlockingQueue>> queue = new ArrayBlockingQueue>>(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); Node subNode = subMgr.getNode(nodeId); @@ -229,12 +229,12 @@ public class TestEvents extends SmackTestCase ItemEventCoordinator> sub1Handler = new ItemEventCoordinator>(queue, "sub1"); subNode.addItemEventListener(sub1Handler); Subscription sub1 = subNode.subscribe(getConnection(1).getUser()); - + // Send event String itemId = String.valueOf(System.currentTimeMillis()); String payloadString = ""; creatorNode.send(new PayloadItem(itemId, new SimplePayload("car", "pubsub:test:vehicle", payloadString))); - + ItemEventCoordinator> coord = queue.take(); assertEquals(1, coord.events.getItems().size()); PayloadItem item = coord.events.getItems().get(0); @@ -246,7 +246,7 @@ public class TestEvents extends SmackTestCase assertEquals(4, car.getNumTires()); } */ - + public void testSendAndReceiveMultipleSubs() throws Exception { // Setup event source @@ -255,7 +255,7 @@ public class TestEvents extends SmackTestCase LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, false); BlockingQueue> queue = new ArrayBlockingQueue>(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -263,7 +263,7 @@ public class TestEvents extends SmackTestCase ItemEventCoordinator sub1Handler = new ItemEventCoordinator(queue, "sub1"); subNode.addItemEventListener(sub1Handler); Subscription sub1 = subNode.subscribe(getConnection(1).getUser()); - + ItemEventCoordinator sub2Handler = new ItemEventCoordinator(queue, "sub2"); subNode.addItemEventListener(sub2Handler); Subscription sub2 = subNode.subscribe(getConnection(1).getUser()); @@ -271,16 +271,16 @@ public class TestEvents extends SmackTestCase // Send event String itemId = String.valueOf(System.currentTimeMillis()); creatorNode.send(new Item(itemId)); - + for(int i=0; i<2; i++) { ItemEventCoordinator coord = queue.poll(10, TimeUnit.SECONDS); - + if (coord == null) fail(); assertEquals(1, coord.events.getItems().size()); assertEquals(itemId, coord.events.getItems().iterator().next().getId()); - + if (coord.id.equals("sub1") || coord.id.equals("sub2")) { assertEquals(2, coord.events.getSubscriptions().size()); @@ -293,14 +293,14 @@ public class TestEvents extends SmackTestCase // Setup event source String nodeId = "TestNode" + System.currentTimeMillis(); PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); - + LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, true); BlockingQueue>> queue = new ArrayBlockingQueue>>(3); ItemEventCoordinator> creatorHandler = new ItemEventCoordinator>(queue, "creator"); creatorNode.addItemEventListener(creatorHandler); creatorNode.subscribe(getConnection(0).getUser()); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -308,24 +308,24 @@ public class TestEvents extends SmackTestCase ItemEventCoordinator> sub1Handler = new ItemEventCoordinator>(queue, "sub1"); subNode.addItemEventListener(sub1Handler); Subscription sub1 = subNode.subscribe(getConnection(1).getUser()); - + ItemEventCoordinator> sub2Handler = new ItemEventCoordinator>(queue, "sub2"); subNode.addItemEventListener(sub2Handler); Subscription sub2 = subNode.subscribe(getConnection(1).getUser()); - + assertEquals(Subscription.State.subscribed, sub1.getState()); assertEquals(Subscription.State.subscribed, sub2.getState()); // Send event String itemId = String.valueOf(System.currentTimeMillis()); - + Collection> items = new ArrayList>(3); String ids[] = {"First-" + itemId, "Second-" + itemId, "Third-" + itemId}; items.add(new PayloadItem(ids[0], new SimplePayload("a", "pubsub:test", ""))); items.add(new PayloadItem(ids[1], new SimplePayload("a", "pubsub:test", ""))); items.add(new PayloadItem(ids[2], new SimplePayload("a", "pubsub:test", ""))); creatorNode.send(items); - + for(int i=0; i<3; i++) { ItemEventCoordinator> coord = queue.poll(5, TimeUnit.SECONDS); @@ -350,7 +350,7 @@ public class TestEvents extends SmackTestCase // Setup event source String nodeId = "TestNode" + System.currentTimeMillis(); PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); - + LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, false); // Send event @@ -380,11 +380,11 @@ public class TestEvents extends SmackTestCase // Setup event source String nodeId = "TestNode" + System.currentTimeMillis(); PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); - + LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, false); BlockingQueue queue = new ArrayBlockingQueue(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -395,7 +395,7 @@ public class TestEvents extends SmackTestCase // Send event String itemId = String.valueOf(System.currentTimeMillis()); - + Collection items = new ArrayList(3); String id1 = "First-" + itemId; String id2 = "Second-" + itemId; @@ -404,9 +404,9 @@ public class TestEvents extends SmackTestCase items.add(new Item(id2)); items.add(new Item(id3)); creatorNode.send(items); - + creatorNode.deleteItem(id1); - + ItemDeleteCoordinator coord = queue.poll(5, TimeUnit.SECONDS); assertEquals(1, coord.event.getItemIds().size()); assertEquals(id1, coord.event.getItemIds().get(0)); @@ -424,11 +424,11 @@ public class TestEvents extends SmackTestCase // Setup event source String nodeId = "TestNode" + System.currentTimeMillis(); PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); - + LeafNode creatorNode = getPubnode(creatorMgr, nodeId, true, false); BlockingQueue queue = new ArrayBlockingQueue(3); - + // Setup event receiver PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode = (LeafNode)subMgr.getNode(nodeId); @@ -439,7 +439,7 @@ public class TestEvents extends SmackTestCase // Send event String itemId = String.valueOf(System.currentTimeMillis()); - + Collection items = new ArrayList(3); String id1 = "First-" + itemId; String id2 = "Second-" + itemId; @@ -448,9 +448,9 @@ public class TestEvents extends SmackTestCase items.add(new Item(id2)); items.add(new Item(id3)); creatorNode.send(items); - + creatorNode.deleteAllItems(); - + ItemDeleteCoordinator coord = queue.poll(5, TimeUnit.SECONDS); assertNull(nodeId, coord.event); } @@ -461,31 +461,31 @@ public class TestEvents extends SmackTestCase String nodeId1 = "Node-1-" + System.currentTimeMillis(); PubSubManager creatorMgr = new PubSubManager(getConnection(0), getService()); String nodeId2 = "Node-2-" + System.currentTimeMillis(); - + LeafNode creatorNode1 = getPubnode(creatorMgr, nodeId1, true, false); LeafNode creatorNode2 = getPubnode(creatorMgr, nodeId2, true, false); BlockingQueue> queue = new ArrayBlockingQueue>(3); - + PubSubManager subMgr = new PubSubManager(getConnection(1), getService()); LeafNode subNode1 = (LeafNode)subMgr.getNode(nodeId1); LeafNode subNode2 = (LeafNode)subMgr.getNode(nodeId2); - + subNode1.addItemEventListener(new ItemEventCoordinator(queue, "sub1")); subNode2.addItemEventListener(new ItemEventCoordinator(queue, "sub2")); - + subNode1.subscribe(getConnection(1).getUser()); subNode2.subscribe(getConnection(1).getUser()); - + creatorNode1.send(new Item("item1")); creatorNode2.send(new Item("item2")); boolean check1 = false; boolean check2 = false; - + for (int i=0; i<2; i++) { ItemEventCoordinator event = queue.poll(5, TimeUnit.SECONDS); - + if (event.id.equals("sub1")) { assertEquals(event.events.getNodeId(), nodeId1); @@ -506,7 +506,7 @@ public class TestEvents extends SmackTestCase private BlockingQueue> theQueue; private ItemPublishEvent events; private String id; - + ItemEventCoordinator(BlockingQueue> queue, String id) { theQueue = queue; @@ -524,15 +524,15 @@ public class TestEvents extends SmackTestCase { return "ItemEventCoordinator: " + id; } - + } - + class NodeConfigCoordinator implements NodeConfigListener { private BlockingQueue theQueue; private String id; private ConfigurationEvent event; - + NodeConfigCoordinator(BlockingQueue queue, String id) { theQueue = queue; @@ -558,7 +558,7 @@ public class TestEvents extends SmackTestCase private BlockingQueue theQueue; private String id; private ItemDeleteEvent event; - + ItemDeleteCoordinator(BlockingQueue queue, String id) { theQueue = queue; diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestMessageContent.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestMessageContent.java index 39cbb3e5e..3a302c43c 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestMessageContent.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/TestMessageContent.java @@ -26,7 +26,7 @@ import junit.framework.TestCase; public class TestMessageContent extends TestCase { String payloadXmlWithNS = ""; - + public void testItemWithId() { Item item = new Item("123"); @@ -47,21 +47,21 @@ public class TestMessageContent extends TestCase public void testSimplePayload() { SimplePayload payloadNS = new SimplePayload("book", "pubsub:test:book", payloadXmlWithNS); - + assertEquals(payloadXmlWithNS, payloadNS.toXML()); - + String payloadXmlWithNoNS = ""; SimplePayload payloadNoNS = new SimplePayload("book", null, ""); - + assertEquals(payloadXmlWithNoNS, payloadNoNS.toXML()); - + } - + public void testPayloadItemWithId() { SimplePayload payload = new SimplePayload("book", "pubsub:test:book", payloadXmlWithNS); PayloadItem item = new PayloadItem("123", payload); - + String xml = "" + payloadXmlWithNS + ""; assertEquals(xml, item.toXML()); assertEquals("item", item.getElementName()); @@ -71,7 +71,7 @@ public class TestMessageContent extends TestCase { SimplePayload payload = new SimplePayload("book", "pubsub:test:book", payloadXmlWithNS); PayloadItem item = new PayloadItem(null, payload); - + String xml = "" + payloadXmlWithNS + ""; assertEquals(xml, item.toXML()); } @@ -99,14 +99,14 @@ public class TestMessageContent extends TestCase { } } - + public void testRetractItem() { RetractItem item = new RetractItem("1234"); - + assertEquals("", item.toXML()); assertEquals("retract", item.getElementName()); - + try { new RetractItem(null); @@ -116,7 +116,7 @@ public class TestMessageContent extends TestCase { } } - + public void testGetItemsRequest() { GetItemsRequest request = new GetItemsRequest("testId"); @@ -124,10 +124,10 @@ public class TestMessageContent extends TestCase request = new GetItemsRequest("testId", 5); assertEquals("", request.toXML()); - + request = new GetItemsRequest("testId", "qwerty"); assertEquals("", request.toXML()); - + request = new GetItemsRequest("testId", "qwerty", 5); assertEquals("", request.toXML()); } diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java index 28c9445ae..743ca7ac4 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/pubsub/test/PubSubTestCase.java @@ -55,7 +55,7 @@ abstract public class PubSubTestCase extends SmackTestCase protected LeafNode getPubnode(PubSubManager pubMgr, boolean persistItems, boolean deliverPayload, String nodeId) throws XMPPException { LeafNode node = null; - + try { node = (LeafNode)pubMgr.getNode(nodeId); @@ -76,7 +76,7 @@ abstract public class PubSubTestCase extends SmackTestCase if (manager == null) { manager = new PubSubManager[getMaxConnections()]; - + for(int i=0; i executingCommands = new ConcurrentHashMap(); - + private final ServiceDiscoveryManager serviceDiscoveryManager; - + /** * Thread that reaps stale sessions. */ diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java index eeaf982ed..a990a5cae 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java @@ -241,13 +241,13 @@ public class AdHocCommandData extends IQ { public static class SpecificError implements ExtensionElement { public static final String namespace = "http://jabber.org/protocol/commands"; - + public SpecificErrorCondition condition; - + public SpecificError(SpecificErrorCondition condition) { this.condition = condition; } - + public String getElementName() { return condition.toString(); } @@ -258,7 +258,7 @@ public class AdHocCommandData extends IQ { public SpecificErrorCondition getCondition() { return condition; } - + public String toXML() { StringBuilder buf = new StringBuilder(); buf.append("<").append(getElementName()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java index 774259868..afaacb5c5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java @@ -440,7 +440,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable { public int compareTo(DiscoverInfo.Identity other) { String otherLang = other.lang == null ? "" : other.lang; String thisLang = lang == null ? "" : lang; - + // This can be removed once the deprecated constructor is removed. String otherType = other.type == null ? "" : other.type; String thisType = type == null ? "" : type; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java index 2adf0d419..05965ad14 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java @@ -47,7 +47,7 @@ public class JivePropertiesExtension implements ExtensionElement { public static final String ELEMENT = "properties"; private static final Logger LOGGER = Logger.getLogger(JivePropertiesExtension.class.getName()); - + private final Map properties; public JivePropertiesExtension() { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DiscussionHistory.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DiscussionHistory.java index ea54894ea..35d6600e5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DiscussionHistory.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/DiscussionHistory.java @@ -149,7 +149,7 @@ public class DiscussionHistory { if (!isConfigured()) { return null; } - + MUCInitialPresence.History mucHistory = new MUCInitialPresence.History(); if (maxChars > -1) { mucHistory.setMaxChars(maxChars); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/InvitationRejectionListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/InvitationRejectionListener.java index 65824c781..153373dee 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/InvitationRejectionListener.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/InvitationRejectionListener.java @@ -31,5 +31,5 @@ public interface InvitationRejectionListener { * @param reason the reason why the invitee declined the invitation. */ public abstract void invitationDeclined(String invitee, String reason); - + } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java index 291dd4fb8..d61a09ea6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java @@ -115,7 +115,7 @@ public class PEPManager { PEPPubSub pubSub = new PEPPubSub(item); pubSub.setType(Type.set); //pubSub.setFrom(connection.getUser()); - + // Send the message that contains the roster connection.sendStanza(pubSub); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java index f2b4575ef..2c9085b65 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java @@ -48,7 +48,7 @@ public class PEPEvent implements ExtensionElement { this.item = item; } - + public void addPEPItem(PEPItem item) { this.item = item; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java index 138c9412a..aeb055eac 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java @@ -28,11 +28,11 @@ import org.jivesoftware.smack.packet.ExtensionElement; * @author Jeff Williams */ public abstract class PEPItem implements ExtensionElement { - + String id; abstract String getNode(); abstract String getItemDetailsXML(); - + /** * Creates a new PEPItem. * @@ -41,7 +41,7 @@ public abstract class PEPItem implements ExtensionElement { super(); this.id = id; } - + /** * Returns the XML element name of the extension sub-packet root element. * Always returns "x" diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPPubSub.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPPubSub.java index f3cc4d1bc..9b94e1bc3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPPubSub.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPPubSub.java @@ -28,7 +28,7 @@ import org.jivesoftware.smack.packet.IQ; * @author Jeff Williams */ public class PEPPubSub extends IQ { - + public static final String ELEMENT = "pubsub"; public static final String NAMESPACE = "http://jabber.org/protocol/pubsub"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java index 47f73a148..cde98cdec 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyList.java @@ -44,7 +44,7 @@ public class PrivacyList { private final String listName; /** Holds the list of {@link PrivacyItem} */ private final List items; - + protected PrivacyList(boolean isActiveList, boolean isDefaultList, String listName, List privacyItems) { super(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java index dc8354990..290c16ad1 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java @@ -264,7 +264,7 @@ public class PrivacyListManager extends Manager { private Privacy getPrivacyWithListNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // The request of the list is an empty privacy message Privacy request = new Privacy(); - + // Send the package to the server and get the answer return getRequest(request); } @@ -371,10 +371,10 @@ public class PrivacyListManager extends Manager { // The request of the list is an privacy message with an empty list Privacy request = new Privacy(); request.setPrivacyList(listName, new ArrayList()); - + // Send the package to the server and get the answer Privacy privacyAnswer = getRequest(request); - + return privacyAnswer.getPrivacyList(listName); } @@ -427,7 +427,7 @@ public class PrivacyListManager extends Manager { // The request of the list is an privacy message with an empty list Privacy request = new Privacy(); request.setActiveName(listName); - + // Send the package to the server setRequest(request); } @@ -443,7 +443,7 @@ public class PrivacyListManager extends Manager { // The request of the list is an privacy message with an empty list Privacy request = new Privacy(); request.setDeclineActiveList(true); - + // Send the package to the server setRequest(request); } @@ -461,7 +461,7 @@ public class PrivacyListManager extends Manager { // The request of the list is an privacy message with an empty list Privacy request = new Privacy(); request.setDefaultName(listName); - + // Send the package to the server setRequest(request); } @@ -477,7 +477,7 @@ public class PrivacyListManager extends Manager { // The request of the list is an privacy message with an empty list Privacy request = new Privacy(); request.setDeclineDefaultList(true); - + // Send the package to the server setRequest(request); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java index 0188cf236..b4ec7edc5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java @@ -303,7 +303,7 @@ public class Privacy extends IQ { buf.append(""); } } - + // Add the list with their privacy items for (Map.Entry> entry : this.getItemLists().entrySet()) { String listName = entry.getKey(); @@ -326,5 +326,5 @@ public class Privacy extends IQ { return buf; } - + } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java index 89e2159b2..8a54c9347 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/provider/PrivacyProvider.java @@ -74,7 +74,7 @@ public class PrivacyProvider extends IQProvider { return privacy; } - + // Parse the list complex type private static void parseList(XmlPullParser parser, Privacy privacy) throws XmlPullParserException, IOException, SmackException { boolean done = false; @@ -96,7 +96,7 @@ public class PrivacyProvider extends IQProvider { privacy.setPrivacyList(listName, items); } - + // Parse the list complex type private static PrivacyItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException { // Retrieves the required attributes diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AccessModel.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AccessModel.java index 7f46f1bef..0d22603a2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AccessModel.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AccessModel.java @@ -29,13 +29,13 @@ public enum AccessModel /** Subscription request must be approved and only subscribers may retrieve items */ authorize, - + /** Anyone with a presence subscription of both or from may subscribe and retrieve items */ presence, - + /** Anyone in the specified roster group(s) may subscribe and retrieve items */ roster, - + /** Only those on a whitelist may subscribe and retrieve items */ whitelist; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java index 8686dab6d..105f3938d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java @@ -33,7 +33,7 @@ public class Affiliation implements ExtensionElement { protected String node; protected Type type; - + public enum Type { member, none, outcast, owner, publisher @@ -50,17 +50,17 @@ public class Affiliation implements ExtensionElement node = nodeId; type = affiliation; } - + public String getNodeId() { return node; } - + public Type getType() { return type; } - + public String getElementName() { return "subscription"; @@ -77,7 +77,7 @@ public class Affiliation implements ExtensionElement builder.append(getElementName()); appendAttribute(builder, "node", node); appendAttribute(builder, "affiliation", type.toString()); - + builder.append("/>"); return builder.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java index 739fd6f8b..9a3f50725 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java @@ -28,12 +28,12 @@ import java.util.List; public class AffiliationsExtension extends NodeExtension { protected List items = Collections.emptyList(); - + public AffiliationsExtension() { super(PubSubElementType.AFFILIATIONS); } - + public AffiliationsExtension(List subList) { super(PubSubElementType.AFFILIATIONS); @@ -57,12 +57,12 @@ public class AffiliationsExtension extends NodeExtension StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); builder.append(">"); - + for (Affiliation item : items) { builder.append(item.toXML()); } - + builder.append(""); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ChildrenAssociationPolicy.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ChildrenAssociationPolicy.java index f97d1e092..e823db836 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ChildrenAssociationPolicy.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ChildrenAssociationPolicy.java @@ -26,10 +26,10 @@ public enum ChildrenAssociationPolicy { /** Anyone may associate leaf nodes with the collection */ all, - + /** Only collection node owners may associate leaf nodes with the collection. */ owners, - + /** Only those on a whitelist may associate leaf nodes with the collection. */ whitelist; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java index 8e0b5444a..fb46f78cc 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java @@ -32,18 +32,18 @@ import org.jivesoftware.smack.packet.ExtensionElement; public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketExtension { private ConfigureForm form; - + public ConfigurationEvent(String nodeId) { super(PubSubElementType.CONFIGURATION, nodeId); } - + public ConfigurationEvent(String nodeId, ConfigureForm configForm) { super(PubSubElementType.CONFIGURATION, nodeId); form = configForm; } - + public ConfigureForm getConfiguration() { return form; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java index e7639cdd8..111165ff6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java @@ -45,7 +45,7 @@ public class ConfigureForm extends Form { super(configDataForm); } - + /** * Create a decorator from an existing {@link Form} for node configuration. * Typically, this can be used to create a decorator for an answer form @@ -57,7 +57,7 @@ public class ConfigureForm extends Form { super(nodeConfigForm.getDataFormToSend()); } - + /** * Create a new form for configuring a node. This would typically only be used * when creating and configuring a node at the same time via {@link PubSubManager#createNode(String, Form)}, since @@ -69,7 +69,7 @@ public class ConfigureForm extends Form { super(formType); } - + /** * Get the currently configured {@link AccessModel}, null if it is not set. * @@ -78,13 +78,13 @@ public class ConfigureForm extends Form public AccessModel getAccessModel() { String value = getFieldValue(ConfigureNodeFields.access_model); - + if (value == null) return null; else return AccessModel.valueOf(value); } - + /** * Sets the value of access model. * @@ -118,7 +118,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.body_xslt, FormField.Type.text_single); setAnswer(ConfigureNodeFields.body_xslt.getFieldName(), bodyXslt); } - + /** * The id's of the child nodes associated with a collection node (both leaf and collection). * @@ -128,7 +128,7 @@ public class ConfigureForm extends Form { return getFieldValues(ConfigureNodeFields.children); } - + /** * Set the list of child node ids that are associated with a collection node. * @@ -139,7 +139,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.children, FormField.Type.text_multi); setAnswer(ConfigureNodeFields.children.getFieldName(), children); } - + /** * Returns the policy that determines who may associate children with the node. * @@ -148,13 +148,13 @@ public class ConfigureForm extends Form public ChildrenAssociationPolicy getChildrenAssociationPolicy() { String value = getFieldValue(ConfigureNodeFields.children_association_policy); - + if (value == null) return null; else return ChildrenAssociationPolicy.valueOf(value); } - + /** * Sets the policy that determines who may associate children with the node. * @@ -167,7 +167,7 @@ public class ConfigureForm extends Form values.add(policy.toString()); setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(), values); } - + /** * List of JID's that are on the whitelist that determines who can associate child nodes * with the collection node. This is only relevant if {@link #getChildrenAssociationPolicy()} is set to @@ -179,7 +179,7 @@ public class ConfigureForm extends Form { return getFieldValues(ConfigureNodeFields.children_association_whitelist); } - + /** * Set the JID's in the whitelist of users that can associate child nodes with the collection * node. This is only relevant if {@link #getChildrenAssociationPolicy()} is set to @@ -269,7 +269,7 @@ public class ConfigureForm extends Form { return parseBoolean(getFieldValue(ConfigureNodeFields.deliver_payloads)); } - + /** * Sets whether the node will deliver payloads with event notifications. * @@ -289,7 +289,7 @@ public class ConfigureForm extends Form public ItemReply getItemReply() { String value = getFieldValue(ConfigureNodeFields.itemreply); - + if (value == null) return null; else @@ -329,7 +329,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.max_items, FormField.Type.text_single); setAnswer(ConfigureNodeFields.max_items.getFieldName(), max); } - + /** * Gets the maximum payload size in bytes. * @@ -350,7 +350,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.max_payload_size, FormField.Type.text_single); setAnswer(ConfigureNodeFields.max_payload_size.getFieldName(), max); } - + /** * Gets the node type * @@ -359,13 +359,13 @@ public class ConfigureForm extends Form public NodeType getNodeType() { String value = getFieldValue(ConfigureNodeFields.node_type); - + if (value == null) return null; else return NodeType.valueOf(value); } - + /** * Sets the node type * @@ -386,7 +386,7 @@ public class ConfigureForm extends Form { return parseBoolean(getFieldValue(ConfigureNodeFields.notify_config)); } - + /** * Sets whether subscribers should be notified when the configuration changes. * @@ -407,7 +407,7 @@ public class ConfigureForm extends Form { return parseBoolean(getFieldValue(ConfigureNodeFields.notify_delete)); } - + /** * Sets whether subscribers should be notified when the node is deleted. * @@ -429,7 +429,7 @@ public class ConfigureForm extends Form { return parseBoolean(getFieldValue(ConfigureNodeFields.notify_retract)); } - + /** * Sets whether subscribers should be notified when items are deleted * from the node. @@ -441,7 +441,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.notify_retract, FormField.Type.bool); setAnswer(ConfigureNodeFields.notify_retract.getFieldName(), notify); } - + /** * Determines whether items should be persisted in the node. * @@ -451,7 +451,7 @@ public class ConfigureForm extends Form { return parseBoolean(getFieldValue(ConfigureNodeFields.persist_items)); } - + /** * Sets whether items should be persisted in the node. * @@ -472,7 +472,7 @@ public class ConfigureForm extends Form { return parseBoolean(getFieldValue(ConfigureNodeFields.presence_based_delivery)); } - + /** * Sets whether to deliver notifications to available users only. * @@ -492,7 +492,7 @@ public class ConfigureForm extends Form public PublishModel getPublishModel() { String value = getFieldValue(ConfigureNodeFields.publish_model); - + if (value == null) return null; else @@ -509,7 +509,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.publish_model, FormField.Type.list_single); setAnswer(ConfigureNodeFields.publish_model.getFieldName(), getListSingle(publish.toString())); } - + /** * List of the multi user chat rooms that are specified as reply rooms. * @@ -519,7 +519,7 @@ public class ConfigureForm extends Form { return getFieldValues(ConfigureNodeFields.replyroom); } - + /** * Sets the multi user chat rooms that are specified as reply rooms. * @@ -530,7 +530,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.replyroom, FormField.Type.list_multi); setAnswer(ConfigureNodeFields.replyroom.getFieldName(), replyRooms); } - + /** * Gets the specific JID's for reply to. * @@ -540,7 +540,7 @@ public class ConfigureForm extends Form { return getFieldValues(ConfigureNodeFields.replyto); } - + /** * Sets the specific JID's for reply to. * @@ -551,7 +551,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.replyto, FormField.Type.list_multi); setAnswer(ConfigureNodeFields.replyto.getFieldName(), replyTos); } - + /** * Gets the roster groups that are allowed to subscribe and retrieve items. * @@ -561,7 +561,7 @@ public class ConfigureForm extends Form { return getFieldValues(ConfigureNodeFields.roster_groups_allowed); } - + /** * Sets the roster groups that are allowed to subscribe and retrieve items. * @@ -572,7 +572,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.roster_groups_allowed, FormField.Type.list_multi); setAnswer(ConfigureNodeFields.roster_groups_allowed.getFieldName(), groups); } - + /** * Determines if subscriptions are allowed. * @@ -604,7 +604,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.subscribe, FormField.Type.bool); setAnswer(ConfigureNodeFields.subscribe.getFieldName(), subscribe); } - + /** * Gets the human readable node title. * @@ -625,7 +625,7 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.title, FormField.Type.text_single); setAnswer(ConfigureNodeFields.title.getFieldName(), title); } - + /** * The type of node data, usually specified by the namespace of the payload (if any). * @@ -646,27 +646,27 @@ public class ConfigureForm extends Form addField(ConfigureNodeFields.type, FormField.Type.text_single); setAnswer(ConfigureNodeFields.type.getFieldName(), type); } - + @Override public String toString() { StringBuilder result = new StringBuilder(getClass().getName() + " Content ["); - + for (FormField formField : getFields()) { result.append('('); result.append(formField.getVariable()); result.append(':'); - + StringBuilder valuesBuilder = new StringBuilder(); - + for (String value : formField.getValues()) { if (valuesBuilder.length() > 0) result.append(','); valuesBuilder.append(value); } - + if (valuesBuilder.length() == 0) valuesBuilder.append("NOT SET"); result.append(valuesBuilder); @@ -684,21 +684,21 @@ public class ConfigureForm extends Form private String getFieldValue(ConfigureNodeFields field) { FormField formField = getField(field.getFieldName()); - + return (formField.getValues().isEmpty()) ? null : formField.getValues().get(0); } private List getFieldValues(ConfigureNodeFields field) { FormField formField = getField(field.getFieldName()); - + return formField.getValues(); } private void addField(ConfigureNodeFields nodeField, FormField.Type type) { String fieldName = nodeField.getFieldName(); - + if (getField(fieldName) == null) { FormField field = new FormField(fieldName); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureNodeFields.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureNodeFields.java index 1f00e9260..81d643832 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureNodeFields.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureNodeFields.java @@ -44,7 +44,7 @@ public enum ConfigureNodeFields *

Value: {@link URL}

*/ body_xslt, - + /** * The collection with which a node is affiliated * @@ -68,21 +68,21 @@ public enum ConfigureNodeFields *

Value: boolean

*/ deliver_payloads, - + /** * Whether owners or publisher should receive replies to items * *

Value: {@link ItemReply}

*/ itemreply, - + /** * Who may associate leaf nodes with a collection * *

Value: {@link ChildrenAssociationPolicy}

*/ children_association_policy, - + /** * The list of JIDs that may associate leaf nodes with a * collection @@ -90,14 +90,14 @@ public enum ConfigureNodeFields *

Value: List of JIDs as Strings

*/ children_association_whitelist, - + /** * The child nodes (leaf or collection) associated with a collection * *

Value: List of Strings

*/ children, - + /** * The maximum number of child nodes that can be associated with a * collection @@ -105,35 +105,35 @@ public enum ConfigureNodeFields *

Value: int

*/ children_max, - + /** * The maximum number of items to persist * *

Value: int

*/ max_items, - + /** * The maximum payload size in bytes * *

Value: int

*/ max_payload_size, - + /** * Whether the node is a leaf (default) or collection * *

Value: {@link NodeType}

*/ node_type, - + /** * Whether to notify subscribers when the node configuration changes * *

Value: boolean

*/ notify_config, - + /** * Whether to notify subscribers when the node is deleted * @@ -147,7 +147,7 @@ public enum ConfigureNodeFields *

Value: boolean

*/ notify_retract, - + /** * Whether to persist items to storage. This is required to have multiple * items in the node. @@ -155,7 +155,7 @@ public enum ConfigureNodeFields *

Value: boolean

*/ persist_items, - + /** * Whether to deliver notifications to available users only * @@ -169,42 +169,42 @@ public enum ConfigureNodeFields *

Value: {@link PublishModel}

*/ publish_model, - + /** * The specific multi-user chat rooms to specify for replyroom * *

Value: List of JIDs as Strings

*/ replyroom, - + /** * The specific JID(s) to specify for replyto * *

Value: List of JIDs as Strings

*/ replyto, - + /** * The roster group(s) allowed to subscribe and retrieve items * *

Value: List of strings

*/ roster_groups_allowed, - + /** * Whether to allow subscriptions * *

Value: boolean

*/ subscribe, - + /** * A friendly name for the node * *

Value: String

*/ title, - + /** * The type of node data, ussually specified by the namespace * of the payload(if any);MAY be a list-single rather than a @@ -213,7 +213,7 @@ public enum ConfigureNodeFields *

Value: String

*/ type; - + public String getFieldName() { return "pubsub#" + toString(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java index 8684085ae..3b5a20ef7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java @@ -34,13 +34,13 @@ public class EventElement implements EmbeddedPacketExtension { private EventElementType type; private NodeExtension ext; - + public EventElement(EventElementType eventType, NodeExtension eventExt) { type = eventType; ext = eventExt; } - + public EventElementType getEventType() { return type; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElementType.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElementType.java index 70da54ea6..7223329b3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElementType.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElementType.java @@ -29,16 +29,16 @@ public enum EventElementType /** A node has had its configuration changed */ configuration, - + /** A node has been deleted */ delete, - + /** Items have been published to a node */ items, - + /** All items have been purged from a node */ purge, - + /** A node has been subscribed to */ subscription } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java index ac8256219..9cb23e304 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java @@ -29,7 +29,7 @@ import org.jivesoftware.smackx.xdata.Form; public class FormNode extends NodeExtension { private Form configForm; - + /** * Create a {@link FormNode} which contains the specified form. * @@ -44,7 +44,7 @@ public class FormNode extends NodeExtension throw new IllegalArgumentException("Submit form cannot be null"); configForm = submitForm; } - + /** * Create a {@link FormNode} which contains the specified form, which is * associated with the specified node. @@ -61,7 +61,7 @@ public class FormNode extends NodeExtension throw new IllegalArgumentException("Submit form cannot be null"); configForm = submitForm; } - + /** * Get the Form that is to be sent, or was retrieved from the server. * @@ -71,7 +71,7 @@ public class FormNode extends NodeExtension { return configForm; } - + @Override public CharSequence toXML() { @@ -83,7 +83,7 @@ public class FormNode extends NodeExtension { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); - + if (getNode() != null) { builder.append(" node='"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNodeType.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNodeType.java index af8a642d1..5afe96fb8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNodeType.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNodeType.java @@ -29,16 +29,16 @@ public enum FormNodeType { /** Form for configuring an existing node */ CONFIGURE_OWNER, - + /** Form for configuring a node during creation */ CONFIGURE, - + /** Form for configuring subscription options */ OPTIONS, /** Form which represents the default node configuration options */ DEFAULT; - + public PubSubElementType getNodeElement() { return PubSubElementType.valueOf(toString()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java index 6cd5d3c59..1d29ab1e2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java @@ -27,12 +27,12 @@ public class GetItemsRequest extends NodeExtension { protected final String subId; protected final int maxItems; - + public GetItemsRequest(String nodeId) { this(nodeId, null, -1); } - + public GetItemsRequest(String nodeId, String subscriptionId) { this(nodeId, subscriptionId, -1); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java index 4e72b7a01..0b658877b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java @@ -45,7 +45,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider; public class Item extends NodeExtension { private String id; - + /** * Create an empty Item with no id. This is a valid item for nodes which are configured * so that {@link ConfigureForm#isDeliverPayloads()} is false. In most cases an id will be generated by the server. @@ -57,7 +57,7 @@ public class Item extends NodeExtension { super(PubSubElementType.ITEM); } - + /** * Create an Item with an id but no payload. This is a valid item for nodes which are configured * so that {@link ConfigureForm#isDeliverPayloads()} is false. @@ -88,7 +88,7 @@ public class Item extends NodeExtension super(PubSubElementType.ITEM_EVENT, nodeId); id = itemId; } - + /** * Get the item id. Unique to the node it is associated with. * @@ -98,7 +98,7 @@ public class Item extends NodeExtension { return id; } - + @Override public String getNamespace() { @@ -109,14 +109,14 @@ public class Item extends NodeExtension public String toXML() { StringBuilder builder = new StringBuilder(" extends SubscriptionEvent { private List items; private Date originalDate; - + /** * Constructs an ItemPublishEvent with the provided list * of {@link Item} that were published. @@ -42,7 +42,7 @@ public class ItemPublishEvent extends SubscriptionEvent super(nodeId); items = eventItems; } - + /** * Constructs an ItemPublishEvent with the provided list * of {@link Item} that were published. The list of subscription ids @@ -58,7 +58,7 @@ public class ItemPublishEvent extends SubscriptionEvent super(nodeId, subscriptionIds); items = eventItems; } - + /** * Constructs an ItemPublishEvent with the provided list * of {@link Item} that were published in the past. The published @@ -74,11 +74,11 @@ public class ItemPublishEvent extends SubscriptionEvent { super(nodeId, subscriptionIds); items = eventItems; - + if (publishedDate != null) originalDate = publishedDate; } - + /** * Get the list of {@link Item} that were published. * @@ -88,7 +88,7 @@ public class ItemPublishEvent extends SubscriptionEvent { return Collections.unmodifiableList(items); } - + /** * Indicates whether this event was delayed. That is, the items * were published to the node at some time in the past. This will @@ -103,7 +103,7 @@ public class ItemPublishEvent extends SubscriptionEvent { return (originalDate != null); } - + /** * Gets the original date the items were published. This is only * valid if {@link #isDelayed()} is true. @@ -120,5 +120,5 @@ public class ItemPublishEvent extends SubscriptionEvent return getClass().getName() + " [subscriptions: " + getSubscriptions() + "], [Delayed: " + (isDelayed() ? originalDate.toString() : "false") + ']'; } - + } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemReply.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemReply.java index 302507a66..8cbd46d2b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemReply.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemReply.java @@ -26,7 +26,7 @@ public enum ItemReply { /** The node owner */ owner, - + /** The item publisher */ publisher; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java index 2f273e77f..77c7a2fe9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java @@ -42,19 +42,19 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten { /** An items element, which has an optional max_items attribute when requesting items */ items(PubSubElementType.ITEMS, "max_items"), - + /** A retract element, which has an optional notify attribute when publishing deletions */ retract(PubSubElementType.RETRACT, "notify"); - + private PubSubElementType elem; private String att; - + private ItemsElementType(PubSubElementType nodeElement, String attribute) { elem = nodeElement; att = attribute; } - + public PubSubElementType getNodeElement() { return elem; @@ -89,7 +89,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten type = itemsType; this.items = items; } - + /** * Construct an instance with a list representing items that have been published or deleted. * @@ -113,7 +113,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten this.items = items; this.notify = notify; } - + /** * Get the type of element * @@ -123,13 +123,13 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten { return type; } - + @SuppressWarnings("unchecked") public List getExtensions() { return (List)getItems(); } - + /** * Gets the items related to the type of request or event. * @@ -149,7 +149,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten { return notify; } - + @Override public CharSequence toXML() { @@ -163,7 +163,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten builder.append(getElementName()); builder.append(" node='"); builder.append(getNode()); - + if (notify != null) { builder.append("' "); @@ -180,7 +180,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten builder.append(item.toXML()); } } - + builder.append(""); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java index 4df63bcee..69fabd750 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java @@ -43,7 +43,7 @@ public class LeafNode extends Node { super(connection, nodeName); } - + /** * Get information on the items in the node in standard * {@link DiscoverItems} format. @@ -75,7 +75,7 @@ public class LeafNode extends Node { return getItems((List) null, (List) null); } - + /** * Get the current items stored in the node based * on the subscription associated with the provided @@ -113,7 +113,7 @@ public class LeafNode extends Node public List getItems(Collection ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List itemList = new ArrayList(ids.size()); - + for (String id : ids) { itemList.add(new Item(id)); @@ -138,7 +138,7 @@ public class LeafNode extends Node PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), maxItems)); return getItems(request); } - + /** * Get items persisted on the node, limited to the specified number * based on the subscription associated with the provided subscriptionId. @@ -218,10 +218,10 @@ public class LeafNode extends Node public void publish() throws NotConnectedException, InterruptedException { PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId())); - + con.sendStanza(packet); } - + /** * Publishes an event to the node. This is a simple item * with no payload. @@ -265,7 +265,7 @@ public class LeafNode extends Node public void publish(Collection items) throws NotConnectedException, InterruptedException { PubSub packet = createPubsubPacket(Type.set, new PublishItem(getId(), items)); - + con.sendStanza(packet); } @@ -289,10 +289,10 @@ public class LeafNode extends Node public void send() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId())); - + con.createPacketCollectorAndSend(packet).nextResultOrThrow(); } - + /** * Publishes an event to the node. This can be either a simple item * with no payload, or one with it. This is determined by the Node @@ -324,7 +324,7 @@ public class LeafNode extends Node items.add((item == null ? (T)new Item() : item)); send(items); } - + /** * Publishes multiple events to the node. Same rules apply as in {@link #send(Item)}. * @@ -346,10 +346,10 @@ public class LeafNode extends Node public void send(Collection items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = createPubsubPacket(Type.set, new PublishItem(getId(), items)); - + con.createPacketCollectorAndSend(packet).nextResultOrThrow(); } - + /** * Purges the node of all items. * @@ -363,10 +363,10 @@ public class LeafNode extends Node public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace()); - + con.createPacketCollectorAndSend(request).nextResultOrThrow(); } - + /** * Delete the item with the specified id from the node. * @@ -382,7 +382,7 @@ public class LeafNode extends Node items.add(itemId); deleteItem(items); } - + /** * Delete the items with the specified id's from the node. * @@ -395,7 +395,7 @@ public class LeafNode extends Node public void deleteItem(Collection itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List items = new ArrayList(itemIds.size()); - + for (String id : itemIds) { items.add(new Item(id)); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java index afbf78724..571d061ed 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java @@ -50,11 +50,11 @@ abstract public class Node protected XMPPConnection con; protected String id; protected Jid to; - + protected ConcurrentHashMap, StanzaListener> itemEventToListenerMap = new ConcurrentHashMap, StanzaListener>(); protected ConcurrentHashMap itemDeleteToListenerMap = new ConcurrentHashMap(); protected ConcurrentHashMap configEventToListenerMap = new ConcurrentHashMap(); - + /** * Construct a node associated to the supplied connection with the specified * node id. @@ -105,7 +105,7 @@ abstract public class Node Stanza reply = sendPubsubPacket(pubSub); return NodeUtils.getFormFromPacket(reply, PubSubElementType.CONFIGURE_OWNER); } - + /** * Update the configuration with the contents of the new {@link Form} * @@ -121,7 +121,7 @@ abstract public class Node getId(), submitForm), PubSubNamespace.OWNER); con.createPacketCollectorAndSend(packet).nextResultOrThrow(); } - + /** * Discover node information in standard {@link DiscoverInfo} format. * @@ -138,7 +138,7 @@ abstract public class Node info.setNode(getId()); return (DiscoverInfo) con.createPacketCollectorAndSend(info).nextResultOrThrow(); } - + /** * Get the subscriptions currently associated with this node. * @@ -308,7 +308,7 @@ abstract public class Node PubSub reply = sendPubsubPacket(pubSub); return reply.getExtension(PubSubElementType.SUBSCRIPTION); } - + /** * The user subscribes to the node using the supplied jid and subscription * options. The bare jid portion of this one must match the jid for the @@ -352,7 +352,7 @@ abstract public class Node { unsubscribe(jid, null); } - + /** * Remove the specific subscription related to the specified JID. * @@ -427,7 +427,7 @@ abstract public class Node public void removeItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) { StanzaListener conListener = itemEventToListenerMap.remove(listener); - + if (conListener != null) con.removeSyncStanzaListener(conListener); } @@ -453,11 +453,11 @@ abstract public class Node public void removeConfigurationListener(NodeConfigListener listener) { StanzaListener conListener = configEventToListenerMap .remove(listener); - + if (conListener != null) con.removeSyncStanzaListener(conListener); } - + /** * Register an listener for item delete events. This listener * gets called whenever an item is deleted from the node. @@ -470,7 +470,7 @@ abstract public class Node itemDeleteToListenerMap.put(listener, delListener); EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract"); EventContentFilter purge = new EventContentFilter(EventElementType.purge.toString()); - + con.addSyncStanzaListener(delListener, new OrFilter(deleteItem, purge)); } @@ -482,7 +482,7 @@ abstract public class Node public void removeItemDeleteListener(ItemDeleteListener listener) { StanzaListener conListener = itemDeleteToListenerMap .remove(listener); - + if (conListener != null) con.removeSyncStanzaListener(conListener); } @@ -492,12 +492,12 @@ abstract public class Node { return super.toString() + " " + getClass().getName() + " id: " + id; } - + protected PubSub createPubsubPacket(Type type, ExtensionElement ext) { return createPubsubPacket(type, ext, null); } - + protected PubSub createPubsubPacket(Type type, ExtensionElement ext, PubSubNamespace ns) { return PubSub.createPubsubPacket(to, type, ext, ns); @@ -513,11 +513,11 @@ abstract public class Node { HeadersExtension headers = (HeadersExtension)packet.getExtension("headers", "http://jabber.org/protocol/shim"); List values = null; - + if (headers != null) { values = new ArrayList(headers.getHeaders().size()); - + for (Header header : headers.getHeaders()) { values.add(header.getValue()); @@ -541,7 +541,7 @@ abstract public class Node { listener = eventListener; } - + @SuppressWarnings({ "rawtypes", "unchecked" }) public void processPacket(Stanza packet) { @@ -566,13 +566,13 @@ abstract public class Node { listener = eventListener; } - + public void processPacket(Stanza packet) { EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); - + List extList = event.getExtensions(); - + if (extList.get(0).getElementName().equals(PubSubElementType.PURGE_EVENT.getElementName())) { listener.handlePurge(); @@ -594,7 +594,7 @@ abstract public class Node } } } - + /** * This class translates low level node configuration events into api level objects for * user consumption. @@ -609,7 +609,7 @@ abstract public class Node { listener = eventListener; } - + public void processPacket(Stanza packet) { EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); @@ -629,7 +629,7 @@ abstract public class Node { private String firstElement; private String secondElement; - + EventContentFilter(String elementName) { firstElement = elementName; @@ -647,27 +647,27 @@ abstract public class Node return false; EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); - + if (event == null) return false; NodeExtension embedEvent = event.getEvent(); - + if (embedEvent == null) return false; - + if (embedEvent.getElementName().equals(firstElement)) { if (!embedEvent.getNode().equals(getId())) return false; - + if (secondElement == null) return true; - + if (embedEvent instanceof EmbeddedPacketExtension) { List secondLevelList = ((EmbeddedPacketExtension)embedEvent).getExtensions(); - + if (secondLevelList.size() > 0 && secondLevelList.get(0).getElementName().equals(secondElement)) return true; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeEvent.java index 97d3cef72..1d92e50be 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeEvent.java @@ -19,12 +19,12 @@ package org.jivesoftware.smackx.pubsub; abstract public class NodeEvent { private String nodeId; - + protected NodeEvent(String id) { nodeId = id; } - + public String getNodeId() { return nodeId; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java index a115eaa35..74f7cb4bb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java @@ -30,7 +30,7 @@ public class NodeExtension implements ExtensionElement { private final PubSubElementType element; private final String node; - + /** * Constructs a NodeExtension with an element name specified * by {@link PubSubElementType} and the specified node id. @@ -64,7 +64,7 @@ public class NodeExtension implements ExtensionElement { return node; } - + public String getElementName() { return element.getElementName(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java index 21d30bcc8..64563a039 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java @@ -27,29 +27,29 @@ public class OptionsExtension extends NodeExtension { protected String jid; protected String id; - + public OptionsExtension(String subscriptionJid) { this(subscriptionJid, null, null); } - + public OptionsExtension(String subscriptionJid, String nodeId) { this(subscriptionJid, nodeId, null); } - + public OptionsExtension(String jid, String nodeId, String subscriptionId) { super(PubSubElementType.OPTIONS, nodeId); this.jid = jid; id = subscriptionId; } - + public String getJid() { return jid; } - + public String getId() { return id; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java index e0f5865f1..50ee2b150 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java @@ -46,7 +46,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider; public class PayloadItem extends Item { private E payload; - + /** * Create an Item with no id and a payload The id will be set by the server. * @@ -55,7 +55,7 @@ public class PayloadItem extends Item public PayloadItem(E payloadExt) { super(); - + if (payloadExt == null) throw new IllegalArgumentException("payload cannot be 'null'"); payload = payloadExt; @@ -70,12 +70,12 @@ public class PayloadItem extends Item public PayloadItem(String itemId, E payloadExt) { super(itemId); - + if (payloadExt == null) throw new IllegalArgumentException("payload cannot be 'null'"); payload = payloadExt; } - + /** * Create an Item with an id, node id and payload. * @@ -92,12 +92,12 @@ public class PayloadItem extends Item public PayloadItem(String itemId, String nodeId, E payloadExt) { super(itemId, nodeId); - + if (payloadExt == null) throw new IllegalArgumentException("payload cannot be 'null'"); payload = payloadExt; } - + /** * Get the payload associated with this Item. Customising the payload * parsing from the server can be accomplished as described in {@link ItemProvider}. @@ -108,19 +108,19 @@ public class PayloadItem extends Item { return payload; } - + @Override public String toXML() { StringBuilder builder = new StringBuilder(" nodeMap = new ConcurrentHashMap(); - + /** * Create a pubsub manager associated to the specified connection. Defaults the service * name to pubsub @@ -70,7 +70,7 @@ final public class PubSubManager con = connection; to = JidCreate.domainBareFrom("pubsub." + connection.getServiceName()); } - + /** * Create a pubsub manager associated to the specified connection where * the pubsub requests require a specific to address for packets. @@ -83,7 +83,7 @@ final public class PubSubManager con = connection; to = toAddress; } - + /** * Creates an instant node, if supported. * @@ -97,14 +97,14 @@ final public class PubSubManager { PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null); NodeExtension elem = reply.getExtension("create", PubSubNamespace.BASIC.getXmlns()); - + LeafNode newNode = new LeafNode(con, elem.getNode()); newNode.setTo(to); nodeMap.put(newNode.getId(), newNode); - + return newNode; } - + /** * Creates a node with default configuration. * @@ -120,7 +120,7 @@ final public class PubSubManager { return (LeafNode)createNode(id, null); } - + /** * Creates a node with specified configuration. * @@ -139,12 +139,12 @@ final public class PubSubManager { PubSub request = PubSub.createPubsubPacket(to, Type.set, new NodeExtension(PubSubElementType.CREATE, name), null); boolean isLeafNode = true; - + if (config != null) { request.addExtension(new FormNode(FormNodeType.CONFIGURE, config)); FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName()); - + if (nodeTypeField != null) isLeafNode = nodeTypeField.getValues().get(0).equals(NodeType.leaf.toString()); } @@ -155,7 +155,7 @@ final public class PubSubManager Node newNode = isLeafNode ? new LeafNode(con, name) : new CollectionNode(con, name); newNode.setTo(to); nodeMap.put(newNode.getId(), newNode); - + return newNode; } @@ -174,13 +174,13 @@ final public class PubSubManager public T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Node node = nodeMap.get(id); - + if (node == null) { DiscoverInfo info = new DiscoverInfo(); info.setTo(to); info.setNode(id); - + DiscoverInfo infoReply = (DiscoverInfo) con.createPacketCollectorAndSend(info).nextResultOrThrow(); if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) { @@ -205,7 +205,7 @@ final public class PubSubManager } return (T) node; } - + /** * Get all the nodes that currently exist as a child of the specified * collection node. If the service does not support collection nodes @@ -225,14 +225,14 @@ final public class PubSubManager public DiscoverItems discoverNodes(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverItems items = new DiscoverItems(); - + if (nodeId != null) items.setNode(nodeId); items.setTo(to); DiscoverItems nodeItems = (DiscoverItems) con.createPacketCollectorAndSend(items).nextResultOrThrow(); return nodeItems; } - + /** * Gets the subscriptions on the root node. * @@ -248,7 +248,7 @@ final public class PubSubManager SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns()); return subElem.getSubscriptions(); } - + /** * Gets the affiliations on the root node. * @@ -280,7 +280,7 @@ final public class PubSubManager sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); nodeMap.remove(nodeId); } - + /** * Returns the default settings for Node configuration. * @@ -297,7 +297,7 @@ final public class PubSubManager PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.DEFAULT), PubSubElementType.DEFAULT.getNamespace()); return NodeUtils.getFormFromPacket(reply, PubSubElementType.DEFAULT); } - + /** * Gets the supported features of the servers pubsub implementation * as a standard {@link DiscoverInfo} instance. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java index 370f46de0..8eb63c723 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java @@ -27,7 +27,7 @@ import java.util.Collection; public class PublishItem extends NodeExtension { protected Collection items; - + /** * Construct a request to publish an item to a node. * @@ -61,13 +61,13 @@ public class PublishItem extends NodeExtension builder.append(" node='"); builder.append(getNode()); builder.append("'>"); - + for (Item item : items) { builder.append(item.toXML()); } builder.append(""); - + return builder.toString(); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishModel.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishModel.java index d4c616ad5..d96f8dcf2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishModel.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishModel.java @@ -26,10 +26,10 @@ public enum PublishModel { /** Only publishers may publish */ publishers, - + /** Only subscribers may publish */ subscribers, - + /** Anyone may publish */ open; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java index 4f20a5597..8d21e93ce 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java @@ -39,7 +39,7 @@ public class RetractItem implements ExtensionElement throw new IllegalArgumentException("itemId must not be 'null'"); id = itemId; } - + public String getId() { return id; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java index 40296b918..a142b49db 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java @@ -29,7 +29,7 @@ public class SimplePayload implements ExtensionElement private final String elemName; private final String ns; private final CharSequence payload; - + /** * Construct a SimplePayload object with the specified element name, * namespace and content. The content must be well formed XML. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java index de7a75861..c84a7a63e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java @@ -24,13 +24,13 @@ package org.jivesoftware.smackx.pubsub; public class SubscribeExtension extends NodeExtension { protected String jid; - + public SubscribeExtension(String subscribeJid) { super(PubSubElementType.SUBSCRIBE); jid = subscribeJid; } - + public SubscribeExtension(String subscribeJid, String nodeId) { super(PubSubElementType.SUBSCRIBE, nodeId); @@ -47,7 +47,7 @@ public class SubscribeExtension extends NodeExtension { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); - + if (getNode() != null) { builder.append(" node='"); @@ -57,7 +57,7 @@ public class SubscribeExtension extends NodeExtension builder.append(" jid='"); builder.append(getJid()); builder.append("'/>"); - + return builder.toString(); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeForm.java index f10b7f4d5..b839c187b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeForm.java @@ -44,17 +44,17 @@ public class SubscribeForm extends Form { super(configDataForm); } - + public SubscribeForm(Form subscribeOptionsForm) { super(subscribeOptionsForm.getDataFormToSend()); } - + public SubscribeForm(DataForm.Type formType) { super(formType); } - + /** * Determines if an entity wants to receive notifications. * @@ -64,7 +64,7 @@ public class SubscribeForm extends Form { return parseBoolean(getFieldValue(SubscribeOptionFields.deliver)); } - + /** * Sets whether an entity wants to receive notifications. * @@ -85,7 +85,7 @@ public class SubscribeForm extends Form { return parseBoolean(getFieldValue(SubscribeOptionFields.digest)); } - + /** * Sets whether notifications should be delivered as aggregations or not. * @@ -137,7 +137,7 @@ public class SubscribeForm extends Form throw exc; } } - + /** * Sets the time at which the leased subscription will expire, or has expired. * @@ -148,7 +148,7 @@ public class SubscribeForm extends Form addField(SubscribeOptionFields.expire, FormField.Type.text_single); setAnswer(SubscribeOptionFields.expire.getFieldName(), XmppDateTime.formatXEP0082Date(expire)); } - + /** * Determines whether the entity wants to receive an XMPP message body in * addition to the payload format. @@ -159,7 +159,7 @@ public class SubscribeForm extends Form { return parseBoolean(getFieldValue(SubscribeOptionFields.include_body)); } - + /** * Sets whether the entity wants to receive an XMPP message body in * addition to the payload format. @@ -181,14 +181,14 @@ public class SubscribeForm extends Form public List getShowValues() { ArrayList result = new ArrayList(5); - + for (String state : getFieldValues(SubscribeOptionFields.show_values)) { result.add(PresenceState.valueOf(state)); } return result; } - + /** * Sets the list of {@link PresenceState} for which an entity wants * to receive notifications. @@ -198,7 +198,7 @@ public class SubscribeForm extends Form public void setShowValues(Collection stateValues) { ArrayList values = new ArrayList(stateValues.size()); - + for (PresenceState state : stateValues) { values.add(state.toString()); @@ -206,8 +206,8 @@ public class SubscribeForm extends Form addField(SubscribeOptionFields.show_values, FormField.Type.list_multi); setAnswer(SubscribeOptionFields.show_values.getFieldName(), values); } - - + + static private boolean parseBoolean(String fieldValue) { return ("1".equals(fieldValue) || "true".equals(fieldValue)); @@ -216,21 +216,21 @@ public class SubscribeForm extends Form private String getFieldValue(SubscribeOptionFields field) { FormField formField = getField(field.getFieldName()); - + return formField.getValues().get(0); } private List getFieldValues(SubscribeOptionFields field) { FormField formField = getField(field.getFieldName()); - + return formField.getValues(); } private void addField(SubscribeOptionFields nodeField, FormField.Type type) { String fieldName = nodeField.getFieldName(); - + if (getField(fieldName) == null) { FormField field = new FormField(fieldName); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeOptionFields.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeOptionFields.java index 263e2b4fe..43df43753 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeOptionFields.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeOptionFields.java @@ -40,7 +40,7 @@ public enum SubscribeOptionFields *

Value: boolean

*/ digest, - + /** * The minimum number of seconds between sending any two notifications digests * @@ -61,38 +61,38 @@ public enum SubscribeOptionFields *

Value: boolean

*/ include_body, - + /** * The presence states for which an entity wants to receive notifications. * *

Value: {@link PresenceState}

*/ show_values, - + /** * * *

Value:

*/ subscription_type, - + /** * *

Value:

*/ subscription_depth; - + public String getFieldName() { if (this == show_values) return "pubsub#" + toString().replace('_', '-'); return "pubsub#" + toString(); } - + static public SubscribeOptionFields valueOfFromElement(String elementName) { String portion = elementName.substring(elementName.lastIndexOf('#' + 1)); - + if ("show-values".equals(portion)) return show_values; else diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java index d93b0c55e..38f637213 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java @@ -27,7 +27,7 @@ public class Subscription extends NodeExtension protected String id; protected State state; protected boolean configRequired = false; - + public enum State { subscribed, unconfigured, pending, none @@ -43,7 +43,7 @@ public class Subscription extends NodeExtension { this(subscriptionJid, null, null, null); } - + /** * Used to constructs a subscription request to the specified node with the specified * JID. @@ -55,7 +55,7 @@ public class Subscription extends NodeExtension { this(subscriptionJid, nodeId, null, null); } - + /** * Constructs a representation of a subscription reply to the specified node * and JID. The server will have supplied the subscription id and current state. @@ -72,7 +72,7 @@ public class Subscription extends NodeExtension id = subscriptionId; this.state = state; } - + /** * Constructs a representation of a subscription reply to the specified node * and JID. The server will have supplied the subscription id and current state @@ -92,7 +92,7 @@ public class Subscription extends NodeExtension this.state = state; this.configRequired = configRequired; } - + /** * Gets the JID the subscription is created for * @@ -102,7 +102,7 @@ public class Subscription extends NodeExtension { return jid; } - + /** * Gets the subscription id * @@ -112,7 +112,7 @@ public class Subscription extends NodeExtension { return id; } - + /** * Gets the current subscription state. * @@ -132,21 +132,21 @@ public class Subscription extends NodeExtension { return configRequired; } - + public String toXML() { StringBuilder builder = new StringBuilder(""); return builder.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionEvent.java index ccfc50f2d..adcfc3918 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionEvent.java @@ -50,7 +50,7 @@ abstract public class SubscriptionEvent extends NodeEvent protected SubscriptionEvent(String nodeId, List subscriptionIds) { super(nodeId); - + if (subscriptionIds != null) subIds = subscriptionIds; } @@ -64,7 +64,7 @@ abstract public class SubscriptionEvent extends NodeEvent { return Collections.unmodifiableList(subIds); } - + /** * Set the list of subscription id's for this event. * diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java index 7ab93348b..4c98bfe62 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java @@ -27,7 +27,7 @@ import java.util.List; public class SubscriptionsExtension extends NodeExtension { protected List items = Collections.emptyList(); - + /** * Subscriptions to the root node * @@ -36,7 +36,7 @@ public class SubscriptionsExtension extends NodeExtension public SubscriptionsExtension(List subList) { super(PubSubElementType.SUBSCRIPTIONS); - + if (subList != null) items = subList; } @@ -76,7 +76,7 @@ public class SubscriptionsExtension extends NodeExtension { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); - + if (getNode() != null) { builder.append(" node='"); @@ -84,12 +84,12 @@ public class SubscriptionsExtension extends NodeExtension builder.append("'"); } builder.append(">"); - + for (Subscription item : items) { builder.append(item.toXML()); } - + builder.append(""); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/UnsubscribeExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/UnsubscribeExtension.java index a5536237c..db9103a6d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/UnsubscribeExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/UnsubscribeExtension.java @@ -28,29 +28,29 @@ public class UnsubscribeExtension extends NodeExtension { protected String jid; protected String id; - + public UnsubscribeExtension(String subscriptionJid) { this(subscriptionJid, null, null); } - + public UnsubscribeExtension(String subscriptionJid, String nodeId) { this(subscriptionJid, nodeId, null); } - + public UnsubscribeExtension(String jid, String nodeId, String subscriptionId) { super(PubSubElementType.UNSUBSCRIBE, nodeId); this.jid = jid; id = subscriptionId; } - + public String getJid() { return jid; } - + public String getId() { return id; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/listener/ItemDeleteListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/listener/ItemDeleteListener.java index 7e940d62f..24b9faef8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/listener/ItemDeleteListener.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/listener/ItemDeleteListener.java @@ -35,7 +35,7 @@ public interface ItemDeleteListener * @param items The event with item deletion details */ void handleDeletedItems(ItemDeleteEvent items); - + /** * Called when all items are deleted from a node the listener is * registered with. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSubNamespace.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSubNamespace.java index 9437eb565..d1efff2e5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSubNamespace.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSubNamespace.java @@ -30,24 +30,24 @@ public enum PubSubNamespace ERROR("errors"), EVENT("event"), OWNER("owner"); - + private String fragment; - + private PubSubNamespace(String fragment) { this.fragment = fragment; } - + public String getXmlns() { String ns = PubSub.NAMESPACE; - + if (fragment != null) ns += '#' + fragment; - + return ns; } - + public String getFragment() { return fragment; @@ -56,7 +56,7 @@ public enum PubSubNamespace public static PubSubNamespace valueOfFromXmlns(String ns) { int index = ns.lastIndexOf('#'); - + if (index != -1) { String suffix = ns.substring(ns.lastIndexOf('#')+1); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java index b5c87ea4f..fd6ca04e0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java @@ -41,14 +41,14 @@ public class SubscriptionProvider extends ExtensionElementProvider boolean isRequired = false; int tag = parser.next(); - + if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options")) { tag = parser.next(); - + if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required")) isRequired = true; - + while (tag != XmlPullParser.END_TAG && !parser.getName().equals("subscribe-options")) tag = parser.next(); } while (parser.getEventType() != XmlPullParser.END_TAG) parser.next(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/ReportedData.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/ReportedData.java index 00eede61a..659f5efc2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/ReportedData.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/ReportedData.java @@ -32,11 +32,11 @@ import java.util.List; * @author Gaston Dombiak */ public class ReportedData { - + private List columns = new ArrayList(); private List rows = new ArrayList(); private String title = ""; - + /** * Returns a new ReportedData if the packet is used for reporting data and includes an * extension that matches the elementName and namespace "x","jabber:x:data". diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java index 85495ee0f..8563ebe0e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java @@ -95,7 +95,7 @@ public class StreamInitiationProvider extends IQProvider { LOGGER.log(Level.SEVERE, "Failed to parse file size from " + fileSize, e); } } - + Date fileDate = new Date(); if (date != null) { try { @@ -104,7 +104,7 @@ public class StreamInitiationProvider extends IQProvider { // couldn't parse date, use current date-time } } - + File file = new File(name, fileSize); file.setHash(hash); file.setDate(fileDate); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java index 1a477f90c..068d20dd4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java @@ -87,9 +87,9 @@ public class VCard extends IQ { public static final String NAMESPACE = "vcard-temp"; private static final Logger LOGGER = Logger.getLogger(VCard.class.getName()); - + private static final String DEFAULT_MIME_TYPE = "image/jpeg"; - + /** * Phone types: * VOICE?, FAX?, PAGER?, MSG?, CELL?, VIDEO?, BBS?, MODEM?, ISDN?, PCS?, PREF? @@ -404,7 +404,7 @@ public class VCard extends IQ { public void setEncodedImage(String encodedAvatar) { setAvatar(encodedAvatar, DEFAULT_MIME_TYPE); } - + /** * Return the byte representation of the avatar(if one exists), otherwise returns null if * no avatar could be found. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java index 191a3257b..1b1204b6f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java @@ -73,7 +73,7 @@ public class Form { public Form(DataForm dataForm) { this.dataForm = dataForm; } - + /** * Creates a new Form of a given type from scratch. * @@ -82,7 +82,7 @@ public class Form { public Form(DataForm.Type type) { this.dataForm = new DataForm(type); } - + /** * Adds a new field to complete as part of the form. * @@ -91,7 +91,7 @@ public class Form { public void addField(FormField field) { dataForm.addField(field); } - + /** * Sets a new String value to a given form's field. The field whose variable matches the * requested variable will be completed with the specified value. If no field could be found @@ -401,7 +401,7 @@ public class Form { public DataForm.Type getType() { return dataForm.getType(); } - + /** * Sets instructions that explain how to fill out the form and what the form is about. @@ -417,7 +417,7 @@ public class Form { } // Set the new list of instructions dataForm.setInstructions(instructionsList); - + } @@ -430,7 +430,7 @@ public class Form { public void setTitle(String title) { dataForm.setTitle(title); } - + /** * Returns a DataForm that serves to send this Form to the server. If the form is of type * submit, it may contain fields with no value. These fields will be removed since they only @@ -451,7 +451,7 @@ public class Form { } return dataForm; } - + /** * Returns true if the form is a form to fill out. * @@ -460,7 +460,7 @@ public class Form { private boolean isFormType() { return DataForm.Type.form == dataForm.getType(); } - + /** * Returns true if the form is a form to submit. * diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java index c439cb759..fa239db43 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java @@ -73,11 +73,11 @@ public class DataForm implements ExtensionElement { private final List items = new ArrayList(); private final List fields = new ArrayList(); private final List extensionElements = new ArrayList(); - + public DataForm(Type type) { this.type = type; } - + /** * Returns the meaning of the data within the context. The data could be part of a form * to fill out, a form submission or data results. @@ -87,7 +87,7 @@ public class DataForm implements ExtensionElement { public Type getType() { return type; } - + /** * Returns the description of the data. It is similar to the title on a web page or an X * window. You can put a on either a form to fill out, or a set of data results. @@ -214,7 +214,7 @@ public class DataForm implements ExtensionElement { fields.add(field); } } - + /** * Adds a new instruction to the list of instructions that explain how to fill out the form * and what the form is about. The dataform could include multiple instructions since each @@ -320,7 +320,7 @@ public class DataForm implements ExtensionElement { public static final String ELEMENT = "reported"; private List<FormField> fields = new ArrayList<FormField>(); - + public ReportedData(List<FormField> fields) { this.fields = fields; } @@ -345,7 +345,7 @@ public class DataForm implements ExtensionElement { return buf; } } - + /** * * Represents items of reported data. @@ -356,11 +356,11 @@ public class DataForm implements ExtensionElement { public static final String ELEMENT = "item"; private List<FormField> fields = new ArrayList<FormField>(); - + public Item(List<FormField> fields) { this.fields = fields; } - + /** * Returns the fields that define the data that goes with the item. * @@ -369,7 +369,7 @@ public class DataForm implements ExtensionElement { public List<FormField> getFields() { return Collections.unmodifiableList(new ArrayList<FormField>(fields)); } - + public CharSequence toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.openElement(ELEMENT); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java index c62ecad66..453e927b4 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java @@ -665,5 +665,5 @@ public class InBandBytestreamSessionTest { protocol.verifyAll(); } - + } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java index 0103d250f..713ab5667 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/CloseTest.java @@ -77,7 +77,7 @@ public class CloseTest { close.setFrom(JidCreate.from("romeo@montague.lit/orchard")); close.setTo(JidCreate.from("juliet@capulet.lit/balcony")); close.setStanzaId("us71g45j"); - + assertXMLEqual(control, close.toXML().toString()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java index f6550b239..cc10885af 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java @@ -76,7 +76,7 @@ public class DataPacketExtensionTest { data = new DataPacketExtension("sessionID", 0, new String(new byte[] { 123 })); assertNull(data.getDecodedData()); } - + private static Properties outputProperties = new Properties(); { outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes"); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java index c8c2a9371..f714355fa 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataTest.java @@ -56,7 +56,7 @@ public class DataTest { @Test public void shouldReturnValidIQStanzaXML() throws Exception { String encodedData = Base64.encode("Test"); - + String control = XMLBuilder.create("iq") .a("from", "romeo@montague.lit/orchard") .a("to", "juliet@capulet.lit/balcony") @@ -74,7 +74,7 @@ public class DataTest { data.setFrom(JidCreate.from("romeo@montague.lit/orchard")); data.setTo(JidCreate.from("juliet@capulet.lit/balcony")); data.setStanzaId("kr91n475"); - + assertXMLEqual(control, data.toXML().toString()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java index 459e1fd2a..6da90fdaa 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/OpenTest.java @@ -75,7 +75,7 @@ public class OpenTest { assertEquals(4096, open.getBlockSize()); assertEquals(StanzaType.MESSAGE, open.getStanza()); } - + private static Properties outputProperties = new Properties(); { outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes"); @@ -99,9 +99,9 @@ public class OpenTest { open.setFrom(JidCreate.from("romeo@montague.lit/orchard")); open.setTo(JidCreate.from("juliet@capulet.lit/balcony")); open.setStanzaId("jn3h8g65"); - + assertXMLEqual(control, open.toXML().toString()); } - - + + } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java index 481d4a66f..befea52eb 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/provider/OpenIQProviderTest.java @@ -51,10 +51,10 @@ public class OpenIQProviderTest { .a("sid", "i781hf64") .a("stanza", "iq") .asString(outputProperties); - + OpenIQProvider oip = new OpenIQProvider(); Open open = oip.parse(getParser(control)); - + assertEquals(StanzaType.IQ, open.getStanza()); } @@ -66,10 +66,10 @@ public class OpenIQProviderTest { .a("sid", "i781hf64") .a("stanza", "message") .asString(outputProperties); - + OpenIQProvider oip = new OpenIQProvider(); Open open = oip.parse(getParser(control)); - + assertEquals(StanzaType.MESSAGE, open.getStanza()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java index 7e2d8fecf..fe1d09533 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/delay/provider/DelayInformationTest.java @@ -60,7 +60,7 @@ public class DelayInformationTest extends InitExtensions { GregorianCalendar calendar = new GregorianCalendar(2002, 9 - 1, 10, 23, 8, 25); calendar.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = calendar.getTime(); - + control = XMLBuilder.create("x") .a("xmlns", "jabber:x:delay") .a("from", "capulet.com") @@ -70,7 +70,7 @@ public class DelayInformationTest extends InitExtensions { parser = PacketParserUtils.getParserFor(control); delayInfo = (DelayInformation) p.parse(parser); - + assertEquals("capulet.com", delayInfo.getFrom()); assertEquals(date, delayInfo.getStamp()); assertEquals("Offline Storage", delayInfo.getReason()); @@ -101,7 +101,7 @@ public class DelayInformationTest extends InitExtensions { DelayInformationProvider p = new DelayInformationProvider(); DelayInformation delayInfo; String control; - + // XEP-0082 date format control = XMLBuilder.create("delay") .a("xmlns", "urn:xmpp:delay") @@ -110,7 +110,7 @@ public class DelayInformationTest extends InitExtensions { .asString(outputProperties); delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); - + GregorianCalendar cal = (GregorianCalendar) calendar.clone(); cal.add(Calendar.MILLISECOND, 120); assertEquals(cal.getTime(), delayInfo.getStamp()); @@ -132,9 +132,9 @@ public class DelayInformationTest extends InitExtensions { .a("from", "capulet.com") .a("stamp", "2002-9-10T23:08:25Z") .asString(outputProperties); - + delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); - + assertEquals(calendar.getTime(), delayInfo.getStamp()); } @@ -151,9 +151,9 @@ public class DelayInformationTest extends InitExtensions { .a("from", "capulet.com") .a("stamp", "20020910T23:08:25") .asString(outputProperties); - + delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); - + assertEquals(calendar.getTime(), delayInfo.getStamp()); // XEP-0091 date format without leading 0 in month @@ -165,7 +165,7 @@ public class DelayInformationTest extends InitExtensions { } dateInPast.add(Calendar.DAY_OF_MONTH, -3); dateInPast.set(Calendar.MILLISECOND, 0); - + control = XMLBuilder.create("x") .a("xmlns", "jabber:x:delay") .a("from", "capulet.com") @@ -185,7 +185,7 @@ public class DelayInformationTest extends InitExtensions { delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); Date controlDate = XmppDateTime.parseDate("2008-06-08T09:16:20.0Z"); - + assertEquals(controlDate, delayInfo.getStamp()); } @@ -195,7 +195,7 @@ public class DelayInformationTest extends InitExtensions { + "<delay xmlns='urn:xmpp:delay' stamp='2002-09-10T23:41:07Z'/></presence>"; Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); - + DelayInformation delay = DelayInformationManager.getXep203DelayInformation(presence); assertNotNull(delay); Date date = XmppDateTime.parseDate("2002-09-10T23:41:07Z"); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/forward/ForwardedTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/forward/ForwardedTest.java index 70e05054d..e603e2850 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/forward/ForwardedTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/forward/ForwardedTest.java @@ -44,19 +44,19 @@ public class ForwardedTest { XmlPullParser parser; String control; Forwarded fwd; - + control = XMLBuilder.create("forwarded") .a("xmlns", "urn:xmpp:forwarded:0") .e("message") .a("from", "romeo@montague.com") .asString(outputProperties); - + parser = PacketParserUtils.getParserFor(control); fwd = (Forwarded) new ForwardedProvider().parse(parser); // no delay in packet assertEquals(null, fwd.getDelayInformation()); - + // check message assertThat("romeo@montague.com", equalsCharSequence(fwd.getForwardedPacket().getFrom())); @@ -97,11 +97,11 @@ public class ForwardedTest { public void forwardedEmptyTest() throws Exception { XmlPullParser parser; String control; - + control = XMLBuilder.create("forwarded") .a("xmlns", "urn:xmpp:forwarded:0") .asString(outputProperties); - + parser = PacketParserUtils.getParserFor(control); new ForwardedProvider().parse(parser); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java index 887d3fa85..b35feb25d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/ping/PingTest.java @@ -92,13 +92,13 @@ public class PingTest extends InitExtensions { @Test public void checkSuccessfulPing() throws Exception { ThreadedDummyConnection threadedCon = getAuthentiactedDummyConnection(); - + PingManager pinger = PingManager.getInstanceFor(threadedCon); boolean pingSuccess = pinger.ping(DUMMY_AT_EXAMPLE_ORG); - + assertTrue(pingSuccess); - + } /** @@ -121,7 +121,7 @@ public class PingTest extends InitExtensions { } fail(); } - + /** * Server returns an exception for entity. * @throws Exception @@ -144,17 +144,17 @@ public class PingTest extends InitExtensions { PingManager pinger = PingManager.getInstanceFor(threadedCon); boolean pingSuccess = pinger.ping(DUMMY_AT_EXAMPLE_ORG); - + assertFalse(pingSuccess); } - + @Test public void checkPingToServerSuccess() throws Exception { ThreadedDummyConnection con = getAuthentiactedDummyConnection(); PingManager pinger = PingManager.getInstanceFor(con); boolean pingSuccess = pinger.pingMyServer(); - + assertTrue(pingSuccess); } @@ -180,10 +180,10 @@ public class PingTest extends InitExtensions { PingManager pinger = PingManager.getInstanceFor(con); boolean pingSuccess = pinger.pingMyServer(); - + assertTrue(pingSuccess); } - + @Test public void checkPingToServerTimeout() throws SmackException, IOException, XMPPException, InterruptedException { DummyConnection con = getAuthenticatedDummyConnectionWithoutIqReplies(); @@ -198,7 +198,7 @@ public class PingTest extends InitExtensions { ThreadedDummyConnection con = getAuthentiactedDummyConnection(); DiscoverInfo info = new DiscoverInfo(); info.addFeature(Ping.NAMESPACE); - + //@formatter:off String reply = "<iq type='result' id='qrzSp-16' to='test@myserver.com'>" + @@ -211,7 +211,7 @@ public class PingTest extends InitExtensions { PingManager pinger = PingManager.getInstanceFor(con); boolean pingSupported = pinger.isPingSupported(DUMMY_AT_EXAMPLE_ORG); - + assertTrue(pingSupported); } @@ -220,7 +220,7 @@ public class PingTest extends InitExtensions { ThreadedDummyConnection con = getAuthentiactedDummyConnection(); DiscoverInfo info = new DiscoverInfo(); info.addFeature(Ping.NAMESPACE); - + //@formatter:off String reply = "<iq type='result' id='qrzSp-16' to='test@myserver.com'>" + @@ -233,7 +233,7 @@ public class PingTest extends InitExtensions { PingManager pinger = PingManager.getInstanceFor(con); boolean pingSupported = pinger.isPingSupported(DUMMY_AT_EXAMPLE_ORG); - + assertFalse(pingSupported); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/privacy/provider/PrivacyProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/privacy/provider/PrivacyProviderTest.java index 04cdffc63..ed611564c 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/privacy/provider/PrivacyProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/privacy/provider/PrivacyProviderTest.java @@ -49,7 +49,7 @@ public class PrivacyProviderTest extends InitExtensions { // @formatter:on IQ iqPrivacyList = (IQ) PacketParserUtils.parseStanza(xmlPrivacyList); assertTrue(iqPrivacyList instanceof Privacy); - + Privacy privacyList = (Privacy) iqPrivacyList; List<PrivacyItem> pl = privacyList.getPrivacyList("public"); @@ -58,7 +58,7 @@ public class PrivacyProviderTest extends InitExtensions { assertEquals("tybalt@example.com", first.getValue()); assertEquals(false, first.isAllow()); assertEquals(1, first.getOrder()); - + PrivacyItem second = pl.get(1); assertEquals(true, second.isAllow()); assertEquals(2, second.getOrder()); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java index 0bf1158fa..2c153f5c3 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java @@ -49,7 +49,7 @@ public class ConfigureFormTest form.setChildrenAssociationPolicy(ChildrenAssociationPolicy.owners); assertEquals(ChildrenAssociationPolicy.owners, form.getChildrenAssociationPolicy()); } - + @Test public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException, InterruptedException { @@ -59,14 +59,14 @@ public class ConfigureFormTest Identity ident = new Identity("pubsub", null, "leaf"); info.addIdentity(ident); con.addIQReply(info); - + Node node = mgr.getNode("princely_musings"); - + PubSub errorIq = new PubSub(); XMPPError error = new XMPPError(Condition.forbidden); errorIq.setError(error); con.addIQReply(errorIq); - + try { node.getNodeConfiguration(); @@ -86,12 +86,12 @@ public class ConfigureFormTest Identity ident = new Identity("pubsub", null, "leaf"); info.addIdentity(ident); con.addIQReply(info); - + Node node = mgr.getNode("princely_musings"); - + SmackConfiguration.setDefaultPacketReplyTimeout(100); con.setTimeout(); - + node.getNodeConfiguration(); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java index 0c6ffc108..564d0fbf3 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java @@ -102,17 +102,17 @@ public class ItemValidationTest extends InitExtensions { "</items>" + "</event>" + "</message>"); - + Stanza message = PacketParserUtils.parseMessage(parser); ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); - + assertTrue(eventExt instanceof EventElement); EventElement event = (EventElement) eventExt; assertEquals(EventElementType.items, event.getEventType()); assertEquals(1, event.getExtensions().size()); assertTrue(event.getExtensions().get(0) instanceof ItemsExtension); assertEquals(1, ((ItemsExtension)event.getExtensions().get(0)).items.size()); - + ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); assertTrue(itemExt instanceof Item); assertEquals("testid1", ((Item)itemExt).getId()); @@ -122,7 +122,7 @@ public class ItemValidationTest extends InitExtensions { public void parseSimplePayloadItem() throws Exception { String itemContent = "<foo xmlns='smack:test'>Some text</foo>"; - + XmlPullParser parser = PacketParserUtils.getParserFor( "<message from='pubsub.myserver.com' to='francisco@denmark.lit' id='foo'>" + "<event xmlns='http://jabber.org/protocol/pubsub#event'>" + @@ -133,7 +133,7 @@ public class ItemValidationTest extends InitExtensions { "</items>" + "</event>" + "</message>"); - + Stanza message = PacketParserUtils.parseMessage(parser); ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement) eventExt; @@ -141,10 +141,10 @@ public class ItemValidationTest extends InitExtensions { assertTrue(itemExt instanceof PayloadItem<?>); PayloadItem<?> item = (PayloadItem<?>)itemExt; - + assertEquals("testid1", item.getId()); assertTrue(item.getPayload() instanceof SimplePayload); - + SimplePayload payload = (SimplePayload) item.getPayload(); assertEquals("foo", payload.getElementName()); assertEquals("smack:test", payload.getNamespace()); @@ -169,7 +169,7 @@ public class ItemValidationTest extends InitExtensions { "<published>2003-12-13T18:30:02Z</published>" + "<updated>2003-12-13T18:30:02Z</updated>" + "</entry>"; - + XmlPullParser parser = PacketParserUtils.getParserFor( "<message from='pubsub.myserver.com' to='francisco@denmark.lit' id='foo'>" + "<event xmlns='http://jabber.org/protocol/pubsub#event'>" + @@ -180,7 +180,7 @@ public class ItemValidationTest extends InitExtensions { "</items>" + "</event>" + "</message>"); - + Stanza message = PacketParserUtils.parseMessage(parser); ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement) eventExt; @@ -188,10 +188,10 @@ public class ItemValidationTest extends InitExtensions { assertTrue(itemExt instanceof PayloadItem<?>); PayloadItem<?> item = (PayloadItem<?>)itemExt; - + assertEquals("testid1", item.getId()); assertTrue(item.getPayload() instanceof SimplePayload); - + SimplePayload payload = (SimplePayload) item.getPayload(); assertEquals("entry", payload.getElementName()); assertEquals("http://www.w3.org/2005/Atom", payload.getNamespace()); @@ -202,7 +202,7 @@ public class ItemValidationTest extends InitExtensions { public void parseEmptyTag() throws Exception { String itemContent = "<foo xmlns='smack:test'><bar/></foo>"; - + XmlPullParser parser = PacketParserUtils.getParserFor( "<message from='pubsub.myserver.com' to='francisco@denmark.lit' id='foo'>" + "<event xmlns='http://jabber.org/protocol/pubsub#event'>" + @@ -213,24 +213,24 @@ public class ItemValidationTest extends InitExtensions { "</items>" + "</event>" + "</message>"); - + Stanza message = PacketParserUtils.parseMessage(parser); ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); - + assertTrue(eventExt instanceof EventElement); EventElement event = (EventElement) eventExt; assertEquals(EventElementType.items, event.getEventType()); assertEquals(1, event.getExtensions().size()); assertTrue(event.getExtensions().get(0) instanceof ItemsExtension); assertEquals(1, ((ItemsExtension)event.getExtensions().get(0)).items.size()); - + ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); assertTrue(itemExt instanceof PayloadItem<?>); PayloadItem<?> item = (PayloadItem<?>)itemExt; - + assertEquals("testid1", item.getId()); assertTrue(item.getPayload() instanceof SimplePayload); - + assertXMLEqual(itemContent, ((SimplePayload)item.getPayload()).toXML().toString()); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java index 29c765d5f..2d5ba979b 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java @@ -50,13 +50,13 @@ public class DeliveryReceiptTest extends InitExtensions { public void receiptTest() throws Exception { XmlPullParser parser; String control; - + control = XMLBuilder.create("message") .a("from", "romeo@montague.com") .e("request") .a("xmlns", "urn:xmpp:receipts") .asString(outputProperties); - + parser = PacketParserUtils.getParserFor(control); Message p = PacketParserUtils.parseMessage(parser); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java index 423ee5fe7..ef0003bb1 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java @@ -54,15 +54,15 @@ public class DataFormTest { df.addInstruction(instruction); FormField field = new FormField("testField1"); df.addField(field); - + assertNotNull( df.toXML()); String output = df.toXML().toString(); assertEquals(TEST_OUTPUT_1, output); - + XmlPullParser parser = PacketParserUtils.getParserFor(output); - + df = pr.parse(parser); - + assertNotNull(df); assertNotNull(df.getFields()); assertEquals(1 , df.getFields().size() ); @@ -81,7 +81,7 @@ public class DataFormTest { df.addInstruction(instruction); FormField field = new FormField("testField1"); df.addField(field); - + DataLayout layout = new DataLayout("Label"); Fieldref reffield = new Fieldref("testField1"); layout.getPageLayout().add(reffield); @@ -89,25 +89,25 @@ public class DataFormTest { section.getSectionLayout().add(new Text("SectionText")); layout.getPageLayout().add(section); layout.getPageLayout().add(new Text("PageText")); - + df.addExtensionElement(layout); - - + + assertNotNull( df.toXML()); String output = df.toXML().toString(); assertEquals(TEST_OUTPUT_2, output); - + XmlPullParser parser = PacketParserUtils.getParserFor(output); - + df = pr.parse(parser); - + assertNotNull(df); assertNotNull(df.getExtensionElements()); assertEquals(1 , df.getExtensionElements().size() ); Element element = df.getExtensionElements().get(0); assertNotNull(element); layout = (DataLayout) element; - + assertEquals(3 , layout.getPageLayout().size()); assertNotNull( df.toXML()); @@ -126,22 +126,22 @@ public class DataFormTest { ValidateElement dv = new RangeValidateElement("xs:integer","1111", "9999"); field.setValidateElement(dv); - + assertNotNull( df.toXML()); String output = df.toXML().toString(); assertEquals(TEST_OUTPUT_3, output); - + XmlPullParser parser = PacketParserUtils.getParserFor(output); - + df = pr.parse(parser); - + assertNotNull(df); assertNotNull(df.getFields()); assertEquals(1 , df.getFields().size() ); Element element = df.getFields().get(0).getValidateElement(); assertNotNull(element); dv = (ValidateElement) element; - + assertEquals("xs:integer" , dv.getDatatype()); assertNotNull( df.toXML()); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java index e1324cda0..a49b665d0 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java @@ -55,15 +55,15 @@ public class DataLayoutTest { section.getSectionLayout().add(new Text("SectionText")); layout.getPageLayout().add(section); layout.getPageLayout().add(new Text( "PageText")); - + assertNotNull( layout.toXML()); String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_2, output); - + XmlPullParser parser = PacketParserUtils.getParserFor(output); - + layout = DataLayoutProvider.parse(parser); - + assertEquals(3 , layout.getPageLayout().size()); assertEquals("Label", layout.getLabel()); @@ -74,7 +74,7 @@ public class DataLayoutTest { @Test public void testLayoutSpecialCharacters() throws XmlPullParserException, IOException, SmackException { - + DataLayout layout = new DataLayout("Label - & \u00E9 \u00E1 "); Fieldref reffield = new Fieldref("testField1"); layout.getPageLayout().add(reffield); @@ -82,22 +82,22 @@ public class DataLayoutTest { section.getSectionLayout().add(new Text( "SectionText - & \u00E9 \u00E1 ")); layout.getPageLayout().add(section); layout.getPageLayout().add(new Text( "PageText - & \u00E9 \u00E1 ")); - + section = new Section("<html>Number of Persons by<br/> Nationality and Status</html>"); section.getSectionLayout().add(new Reportedref()); layout.getPageLayout().add(section); layout.getPageLayout().add(new Text( "<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>")); - + assertNotNull( layout.toXML()); String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); - + XmlPullParser parser = PacketParserUtils.getParserFor(output); - + layout = DataLayoutProvider.parse(parser); - + assertEquals(5 , layout.getPageLayout().size()); assertEquals("Label - & \u00E9 \u00E1 ", layout.getLabel()); section = (Section) layout.getPageLayout().get(1); @@ -109,7 +109,7 @@ public class DataLayoutTest { text = (Text) layout.getPageLayout().get(4); assertEquals("<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>", text.getText()); - + assertNotNull( layout.toXML()); output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); @@ -118,17 +118,17 @@ public class DataLayoutTest { @Test public void testLayoutFromFile() throws Exception { DataFormProvider pr = new DataFormProvider(); - + XmlPullParser parser = PacketParserUtils.newXmppParser(); parser.setInput(new InputStreamReader(this.getClass().getResourceAsStream(TEST_INPUT_1), "UTF-8")); parser.next(); - + DataForm form = pr.parse(parser); assertNotNull( form); assertEquals(1 , form.getExtensionElements().size()); - + DataLayout layout = (DataLayout) form.getExtensionElements().get(0); - + assertEquals(5 , layout.getPageLayout().size()); assertEquals("Label - & \u00E9 \u00E1 ", layout.getLabel()); Section section = (Section) layout.getPageLayout().get(1); @@ -140,7 +140,7 @@ public class DataLayoutTest { text = (Text) layout.getPageLayout().get(4); assertEquals("<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>", text.getText()); - + assertNotNull( layout.toXML()); String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java index e463a6d31..3d853216f 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java @@ -48,7 +48,7 @@ public class DataValidationHelperTest { catch (ValidationConsistencyException e) { assertEquals("Field type 'jid-single' is not consistent with validation method 'basic'.", e.getMessage()); } - + try { new ListRange(-1L, 1L); fail("No correct check on consistency"); @@ -56,7 +56,7 @@ public class DataValidationHelperTest { catch (IllegalArgumentException e) { assertEquals("unsigned 32-bit integers can't be negative", e.getMessage()); } - + element.setListRange(new ListRange(10L, 100L)); try { element.checkConsistency(field); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java index 28fef5c64..188f26b70 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java @@ -46,21 +46,21 @@ public class DataValidationTest { @Test public void testMin() throws XmlPullParserException, IOException, SmackException { - + ValidateElement dv = new BasicValidateElement(null); - + assertNotNull( dv.toXML()); String output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_MIN, output); XmlPullParser parser = getParser(TEST_INPUT_MIN); - + dv = DataValidationProvider.parse(parser); assertNotNull(dv); assertEquals("xs:string", dv.getDatatype()); assertTrue( dv instanceof BasicValidateElement); - + assertNotNull( dv.toXML()); output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_MIN, output); @@ -68,18 +68,18 @@ public class DataValidationTest { @Test public void testRange() throws XmlPullParserException, IOException, SmackException { - + ValidateElement dv = new RangeValidateElement("xs:string", "min-val", "max-val"); - + ListRange listRange = new ListRange(111L, 999L); dv.setListRange(listRange ); - + assertNotNull( dv.toXML()); String output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE, output); XmlPullParser parser = getParser(output); - + dv = DataValidationProvider.parse(parser); assertNotNull(dv); @@ -91,8 +91,8 @@ public class DataValidationTest { assertNotNull(rdv.getListRange()); assertEquals(new Long(111), rdv.getListRange().getMin()); assertEquals(999, rdv.getListRange().getMax().intValue()); - - + + assertNotNull( dv.toXML()); output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE, output); @@ -100,15 +100,15 @@ public class DataValidationTest { @Test public void testRange2() throws XmlPullParserException, IOException, SmackException { - + ValidateElement dv = new RangeValidateElement(null, null, null); - + assertNotNull( dv.toXML()); String output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE2, output); XmlPullParser parser = getParser(output); - + dv = DataValidationProvider.parse(parser); assertNotNull(dv); @@ -117,7 +117,7 @@ public class DataValidationTest { RangeValidateElement rdv = (RangeValidateElement) dv; assertEquals(null, rdv.getMin()); assertEquals(null, rdv.getMax()); - + assertNotNull( rdv.toXML()); output = rdv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE2, output); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/chat/Chat.java b/smack-im/src/main/java/org/jivesoftware/smack/chat/Chat.java index db80a2dc4..b7c49cc4c 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/chat/Chat.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/chat/Chat.java @@ -188,7 +188,7 @@ public class Chat { public String toString() { return "Chat [(participant=" + participant + "), (thread=" + threadID + ")]"; } - + @Override public int hashCode() { int hash = 1; @@ -196,7 +196,7 @@ public class Chat { hash = hash * 31 + participant.hashCode(); return hash; } - + @Override public boolean equals(Object obj) { return obj instanceof Chat diff --git a/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java b/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java index 1120ba752..6244748c5 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java @@ -318,7 +318,7 @@ public class ChatManager extends Manager{ return null; } Chat match = jidChats.get(userJID); - + if (match == null && (matchMode == MatchMode.BARE_JID)) { match = baseJidChats.get(userJID.asBareJidIfPossible()); } @@ -397,7 +397,7 @@ public class ChatManager extends Manager{ } interceptors.put(messageInterceptor, filter); } - + /** * Returns a unique id. * @@ -406,11 +406,11 @@ public class ChatManager extends Manager{ private static String nextID() { return UUID.randomUUID().toString(); } - + public static void setDefaultMatchMode(MatchMode mode) { defaultMatchMode = mode; } - + public static void setDefaultIsNormalIncluded(boolean allowNormal) { defaultIsNormalInclude = allowNormal; } diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index 161ba7617..6e5c417bd 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -319,7 +319,7 @@ public class Roster extends Manager { reload(); waitUntilLoaded(); } - + /** * Set the roster store, may cause a roster reload * @@ -442,7 +442,7 @@ public class Roster extends Manager { if (groups.containsKey(name)) { return groups.get(name); } - + RosterGroup group = new RosterGroup(name, connection); groups.put(name, group); return group; diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java index 22fafc822..06e1665b6 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java @@ -246,7 +246,7 @@ public class RosterEntry { return false; return true; } - + static RosterPacket.Item toRosterItem(RosterEntry entry) { RosterPacket.Item item = new RosterPacket.Item(entry.getUser(), entry.getName()); item.setItemType(entry.getType()); diff --git a/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java b/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java index fb04b1551..e7fcee880 100644 --- a/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java +++ b/smack-im/src/test/java/org/jivesoftware/smack/chat/ChatConnectionTest.java @@ -361,7 +361,7 @@ public class ChatConnectionTest { @Override public void chatCreated(Chat chat, boolean createdLocally) { newChat = chat; - + if (listener != null) newChat.addMessageListener(listener); reportInvoked(); @@ -371,7 +371,7 @@ public class ChatConnectionTest { return newChat; } } - + private class TestChatServer extends Thread { private Stanza chatPacket; private DummyConnection con; @@ -390,18 +390,18 @@ public class ChatConnectionTest { private class TestMessageListener implements ChatMessageListener { private Chat msgChat; private int counter = 0; - + @Override public void processMessage(Chat chat, Message message) { msgChat = chat; counter++; } - + @SuppressWarnings("unused") public Chat getChat() { return msgChat; } - + public int getNumMessages() { return counter; } diff --git a/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java b/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java index 05f1523ad..fe6f80d63 100644 --- a/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java +++ b/smack-im/src/test/java/org/jivesoftware/smack/roster/RosterTest.java @@ -422,7 +422,7 @@ public class RosterTest extends InitSmackIm { assertSame("Shouldn't provide an empty group element!", 0, item.getGroupNames().size()); - + } }; serverSimulator.start(); diff --git a/smack-jingle-old/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java b/smack-jingle-old/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java index 76445fc21..2317e1ced 100644 --- a/smack-jingle-old/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java +++ b/smack-jingle-old/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java @@ -59,7 +59,7 @@ public class Demo extends JFrame { this.server = server; this.user = user; this.pass = pass; - + if (user.equals("jeffw")) { jid = new JTextField("eowyn" + "@" + server + "/Smack"); } else { diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java index bf795a2d5..70ccd43dc 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java @@ -264,7 +264,7 @@ public class JingleManagerTest extends SmackTestCase { JingleManager man0 = new JingleManager(getConnection(0), trl0); JingleManager man1 = new JingleManager(getConnection(1), trl1); - + man1.addJingleSessionRequestListener(new JingleSessionRequestListener() { /** * Called when a new session request is detected @@ -323,10 +323,10 @@ public class JingleManagerTest extends SmackTestCase { JingleManager man0 = new JingleManager(getConnection(0), trl0); JingleManager man1 = new JingleManager(getConnection(1), trl1); - + man0.addCreationListener(ftm0); man1.addCreationListener(ftm1); - + man1.addJingleSessionRequestListener(new JingleSessionRequestListener() { /** * Called when a new session request is detected @@ -527,7 +527,7 @@ public class JingleManagerTest extends SmackTestCase { JingleManager man0 = new JingleManager(getConnection(0), trl0); JingleManager man1 = new JingleManager(getConnection(1), trl1); - + man1.addJingleSessionRequestListener(new JingleSessionRequestListener() { /** * Called when a new session request is detected @@ -681,7 +681,7 @@ public class JingleManagerTest extends SmackTestCase { public void testFullTest() { resetCounter(); - + XMPPTCPConnection x0 = getConnection(0); XMPPTCPConnection x1 = getConnection(1); @@ -701,7 +701,7 @@ public class JingleManagerTest extends SmackTestCase { JingleManager man0 = new JingleManager(x0, trl0); JingleManager man1 = new JingleManager(x1, trl1); - + man1.addJingleSessionRequestListener(new JingleSessionRequestListener() { public void sessionRequested(final JingleSessionRequest request) { @@ -796,7 +796,7 @@ public class JingleManagerTest extends SmackTestCase { public void testMediaManager() { resetCounter(); - + XMPPTCPConnection x0 = getConnection(0); XMPPTCPConnection x1 = getConnection(1); @@ -807,7 +807,7 @@ public class JingleManagerTest extends SmackTestCase { FixedTransportManager ftm1 = new FixedTransportManager(tr1); try { - + JingleMediaManager jingleMediaManager = new JingleMediaManager(ftm0) { // Media Session Implementation public JingleMediaSession createMediaSession(final PayloadType payloadType, final TransportCandidate remote, @@ -852,7 +852,7 @@ public class JingleManagerTest extends SmackTestCase { } }; - + List<JingleMediaManager> trl0 = new ArrayList<JingleMediaManager>(); trl0.add(jingleMediaManager); @@ -901,11 +901,11 @@ public class JingleManagerTest extends SmackTestCase { /** * This is a simple test where the user_2 rejects the Jingle session. */ - + // This test doesn't make sense in light of multiple <content> sections allowed in XEp-166. // What we really need is a test for actions: content-add and content-remove. - - + + // public void testIncompatibleCodecs() { // // resetCounter(); diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java index 147fda5fb..2b691884a 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java @@ -283,7 +283,7 @@ public class JingleMediaTest extends SmackTestCase { final JingleManager jm0 = new JingleManager(x0, jml0); final JingleManager jm1 = new JingleManager(x1, jml1); - + jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() { public void sessionRequested(final JingleSessionRequest request) { @@ -327,7 +327,7 @@ public class JingleMediaTest extends SmackTestCase { XMPPTCPConnection x0 = getConnection(n); XMPPTCPConnection x1 = getConnection(n + 1); - + BridgedTransportManager btm0 = new BridgedTransportManager(x0); BridgedTransportManager btm1 = new BridgedTransportManager(x1); @@ -346,7 +346,7 @@ public class JingleMediaTest extends SmackTestCase { jm0.addCreationListener(btm0); jm1.addCreationListener(btm1); - + jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() { public void sessionRequested(final JingleSessionRequest request) { @@ -369,7 +369,7 @@ public class JingleMediaTest extends SmackTestCase { //js0.sendFormattedError(JingleError.UNSUPPORTED_TRANSPORTS); js0.sendStanza(js0.createJingleError(null, JingleError.UNSUPPORTED_TRANSPORTS)); - + Thread.sleep(20000); diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java index c8dc30106..2023f3c99 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleSessionTest.java @@ -30,13 +30,13 @@ public class JingleSessionTest extends SmackTestCase { } public void testEqualsObject() { - + FixedResolver tr1 = new FixedResolver("127.0.0.1", 54222); FixedTransportManager ftm1 = new FixedTransportManager(tr1); TestMediaManager tmm1 = new TestMediaManager(ftm1); List<JingleMediaManager> trl1 = new ArrayList<JingleMediaManager>(); trl1.add(tmm1); - + JingleSession js1 = new JingleSession(getConnection(0), "res1", null, "10", trl1); JingleSession js2 = new JingleSession(getConnection(1), "res1", null, "10", trl1); JingleSession js3 = new JingleSession(getConnection(2), "res2", null, "11", trl1); @@ -66,7 +66,7 @@ public class JingleSessionTest extends SmackTestCase { TestMediaManager tmm1 = new TestMediaManager(ftm1); List<JingleMediaManager> trl1 = new ArrayList<JingleMediaManager>(); trl1.add(tmm1); - + JingleSession js1 = new JingleSession(getConnection(0), ini1, null, sid1, trl1); JingleSession js2 = new JingleSession(getConnection(1), ini2, null, sid2, trl1); diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/PayloadTypeTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/PayloadTypeTest.java index 987be7711..2c6449223 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/PayloadTypeTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/PayloadTypeTest.java @@ -31,27 +31,27 @@ public class PayloadTypeTest extends SmackTestCase { PayloadType p2 = new PayloadType(0, "pt1", 2); assertTrue(p1.equals(p2)); } - + /** * Test for the difference of payloads. */ public void testDifference() { ArrayList<Audio> set1 = new ArrayList<Audio>(); ArrayList<Audio> set2 = new ArrayList<Audio>(); - + PayloadType.Audio common1 = new PayloadType.Audio(34, "supercodec-1", 2, 14000); PayloadType.Audio common2 = new PayloadType.Audio(56, "supercodec-2", 1, 44000); - + set1.add(common1); set1.add(common2); set1.add(new PayloadType.Audio(36, "supercodec-3", 2, 28000)); set1.add(new PayloadType.Audio(45, "supercodec-4", 1, 98000)); - + set2.add(new PayloadType.Audio(27, "supercodec-3", 2, 28000)); set2.add(common2); set2.add(new PayloadType.Audio(32, "supercodec-4", 1, 98000)); set2.add(common1); - + // Get the difference ArrayList<Audio> commonSet = new ArrayList<Audio>(); commonSet.addAll(set1); @@ -60,7 +60,7 @@ public class PayloadTypeTest extends SmackTestCase { assertTrue(commonSet.size() == 2); System.out.println("Codec " + ((PayloadType.Audio)commonSet.get(0)).getId()); System.out.println("Codec " + ((PayloadType.Audio)commonSet.get(1)).getId()); - + assertTrue(commonSet.contains(common1)); assertTrue(commonSet.contains(common2)); } @@ -71,22 +71,22 @@ public class PayloadTypeTest extends SmackTestCase { public void testDifferenceSameSet() { ArrayList<Audio> set1 = new ArrayList<Audio>(); ArrayList<Audio> set2 = new ArrayList<Audio>(); - + PayloadType.Audio common1 = new PayloadType.Audio(34, "supercodec-1", 2, 14000); PayloadType.Audio common2 = new PayloadType.Audio(56, "supercodec-2", 1, 44000); PayloadType.Audio common3 = new PayloadType.Audio(0, "supercodec-3", 1, 44000); PayloadType.Audio common4 = new PayloadType.Audio(120, "supercodec-4", 2, 66060); - + set1.add(common1); set1.add(common2); set1.add(common3); set1.add(common4); - + set2.add(common1); set2.add(common2); set2.add(common3); set2.add(common4); - + // Get the difference ArrayList<Audio> commonSet = new ArrayList<Audio>(); commonSet.addAll(set1); diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/BasicResolverTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/BasicResolverTest.java index 40509323c..6bfed18f6 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/BasicResolverTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/BasicResolverTest.java @@ -56,7 +56,7 @@ public class BasicResolverTest extends SmackTestCase { TransportCandidate tc = new TransportCandidate.Fixed(validHostname, 0); resetCounter(); - + tc.addListener(new TransportResolverListener.Checker() { public void candidateChecked(TransportCandidate cand, boolean result) { if(result == true) { @@ -66,17 +66,17 @@ public class BasicResolverTest extends SmackTestCase { } public void candidateChecking(TransportCandidate cand) { - + } }); - + tc.check(new ArrayList<TransportCandidate>()); - + try { Thread.sleep(TransportResolver.CHECK_TIMEOUT); } catch (Exception e) { } - + assertTrue(valCounter() > 0); } @@ -86,7 +86,7 @@ public class BasicResolverTest extends SmackTestCase { TransportCandidate tc = new TransportCandidate.Fixed(invalidHostname, 0); resetCounter(); - + tc.addListener(new TransportResolverListener.Checker() { public void candidateChecked(TransportCandidate cand, boolean result) { if(result == false) { @@ -98,9 +98,9 @@ public class BasicResolverTest extends SmackTestCase { public void candidateChecking(TransportCandidate cand) { } }); - + tc.check(new ArrayList<TransportCandidate>()); - + try { Thread.sleep(TransportResolver.CHECK_TIMEOUT); } catch (Exception e) { @@ -109,7 +109,7 @@ public class BasicResolverTest extends SmackTestCase { assertTrue(valCounter() > 0); } - + protected int getMaxConnections() { return 0; } diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java index 3f418306e..11c3d0caa 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java @@ -166,7 +166,7 @@ public class STUNResolverTest extends SmackTestCase { // TODO Auto-generated catch block e1.printStackTrace(); } - + try { TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress() .getHostAddress(), 1, nicNum, "1", candidate.getPort(), "1", candidate.getPriority(), diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/TransportResolverTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/TransportResolverTest.java index d4229ccd2..f506a0bf2 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/TransportResolverTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/nat/TransportResolverTest.java @@ -25,7 +25,7 @@ public class TransportResolverTest extends SmackTestCase { public void testIsResolving() { final TransportResolver tr = new BasicResolver(); - + tr.addListener( new TransportResolverListener.Resolver() { public void candidateAdded(final TransportCandidate cand) { @@ -48,7 +48,7 @@ public class TransportResolverTest extends SmackTestCase { assertFalse(tr.isResolving()); assertFalse(tr.isResolved()); - + try { tr.resolve(null); } catch (XMPPException e) { diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java index 72cef16c7..964b282d9 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java @@ -36,13 +36,13 @@ public class JingleProviderTest extends SmackTestCase { String nameSpace = Jingle.getNamespace(); System.out.println("Testing if the Jingle IQ provider is registered..."); - + // Verify that the Jingle IQProvider is registered. iqProv = (IQProvider)ProviderManager.getInstance().getIQProvider(elementNamee, nameSpace); - + assertNotNull(iqProv); } - + /** * Test for parsing a Jingle */ @@ -93,7 +93,7 @@ public class JingleProviderTest extends SmackTestCase { assertTrue(iqReceived instanceof Jingle); Jingle jin = (Jingle) iqReceived; - + System.out.println("Sent: " + iqSent.toXML()); System.out.println("Received: " + jin.toXML()); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleException.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleException.java index e7492a2eb..6406ff7a4 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleException.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleException.java @@ -27,7 +27,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError; */ public class JingleException extends XMPPException { private static final long serialVersionUID = -1521230401958103382L; - + private final JingleError error; /** diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java index 07296a133..db1a6e2c8 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java @@ -185,7 +185,7 @@ import org.jxmpp.jid.Jid; public class JingleManager implements JingleSessionListener { private static final Logger LOGGER = Logger.getLogger(JingleManager.class.getName()); - + // non-static final List<JingleSession> jingleSessions = new ArrayList<JingleSession>(); @@ -247,7 +247,7 @@ public class JingleManager implements JingleSessionListener { } - + /** * Setup the jingle system to let the remote clients know we support Jingle. * (This used to be a static part of construction. The problem is a remote client might diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java index f829d9d57..f6aebfb2b 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleNegotiator.java @@ -53,9 +53,9 @@ public abstract class JingleNegotiator { private String expectedAckId; private JingleNegotiatorState state; - + private boolean isStarted; - + /** * Default constructor. */ @@ -78,9 +78,9 @@ public abstract class JingleNegotiator { } public void setNegotiatorState(JingleNegotiatorState stateIs) { - + JingleNegotiatorState stateWas = state; - + LOGGER.fine("Negotiator state change: " + stateWas + "->" + stateIs + "(" + this.getClass().getSimpleName() + ")"); switch (stateIs) { @@ -236,21 +236,21 @@ public abstract class JingleNegotiator { */ public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException; - + public void start() { isStarted = true; doStart(); } - + public boolean isStarted() { return isStarted; } - + /** * Each of the negotiators has their individual behavior when they start. */ protected abstract void doStart(); - + /** * Close the negotiation. */ diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java index ec090387d..8c1c9b913 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java @@ -77,7 +77,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList private String sid; // A unique id that identifies this session ConnectionListener connectionListener; - + StanzaListener packetListener; StanzaFilter packetFilter; @@ -91,7 +91,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList private XMPPConnection connection; private String sessionInitPacketID; - + private Map<String, JingleMediaSession> mediaSessionMap; /** @@ -121,7 +121,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList // Initially, we don't known the session state. setSessionState(JingleSessionStateUnknown.getInstance()); - + contentNegotiators = new ArrayList<ContentNegotiator>(); mediaSessionMap = new HashMap<String, JingleMediaSession>(); @@ -394,7 +394,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList contentNegotiators.add(inContentNegotiator); } - + // ---------------------------------------------------------------------------------------------------------- // Send section @@ -642,11 +642,11 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList connection.addConnectionListener(connectionListener); } } - + private void removeConnectionListener() { if (connectionListener != null) { getConnection().removeConnectionListener(connectionListener); - + LOGGER.fine("JINGLE SESSION: REMOVE CONNECTION LISTENER"); } } @@ -823,17 +823,17 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException { if (isFullyEstablished()) { - + // Indicate that this session is active. setSessionState(JingleSessionStateActive.getInstance()); - + for (ContentNegotiator contentNegotiator : contentNegotiators) { if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED) contentNegotiator.triggerContentEstablished(); } if (getSessionState().equals(JingleSessionStatePending.getInstance())) { - + Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT); // Build up a response packet from each media manager. @@ -1109,7 +1109,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList // Give each of the content negotiators a chance to start // and return a portion of the structure to make the Jingle packet. - + // Don't do this anymore. The problem is that the other side might not be ready. // Later when we receive our first jingle packet from the other side we'll fire-up the negotiators // before processing it. (See receivePacketAndRespond() above. @@ -1125,9 +1125,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList //updatePacketListener(); } - + protected void doStart() { - + } /** @@ -1142,7 +1142,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList transNeg.start(); } } - + /** * The jingle session may have one or more media managers that are trying to establish media sessions. * When the media manager succeeds in creating a media session is registers it with the session by the @@ -1151,7 +1151,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList public void addJingleMediaSession(String mediaManagerName, JingleMediaSession mediaSession) { mediaSessionMap.put(mediaManagerName, mediaSession); } - + /** * The jingle session may have one or more media managers that are trying to establish media sessions. * When the media manager succeeds in creating a media session is registers it with the session by the diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateActive.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateActive.java index a77a8d8de..78adbe8b8 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateActive.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateActive.java @@ -86,7 +86,7 @@ public class JingleSessionStateActive extends JingleSessionState { } return response; } - + /** * Receive and process the <session-terminate> action. */ @@ -103,5 +103,5 @@ public class JingleSessionStateActive extends JingleSessionState { return response; } - + } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java index 1536ba852..9240cf009 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java @@ -27,7 +27,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError; * @see JingleSessionState */ public class JingleSessionStateEnded extends JingleSessionState { - + private static final Logger LOGGER = Logger.getLogger(JingleSessionStateEnded.class.getName()); private static JingleSessionStateEnded INSTANCE = null; @@ -64,7 +64,7 @@ public class JingleSessionStateEnded extends JingleSessionState { */ public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) { IQ response = null; - + response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA); return response; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/CreatedJingleSessionListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/CreatedJingleSessionListener.java index a0a0fc67f..27b53b604 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/CreatedJingleSessionListener.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/CreatedJingleSessionListener.java @@ -26,5 +26,5 @@ import org.jivesoftware.smackx.jingleold.JingleSession; public interface CreatedJingleSessionListener { public void sessionCreated(JingleSession jingleSession); - + } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java index 1aa7f0032..bedbe5ac0 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleSessionListener.java @@ -81,5 +81,5 @@ public interface JingleSessionListener extends JingleListener { * @param participant description of the participant */ public void sessionMediaReceived(JingleSession jingleSession, String participant); - + } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/JingleMediaManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/JingleMediaManager.java index 90eb1a338..c5157472d 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/JingleMediaManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/JingleMediaManager.java @@ -33,7 +33,7 @@ import java.util.List; * @author Thiago Camargo */ public abstract class JingleMediaManager { - + public static final String MEDIA_NAME = "JingleMediaManager"; // Each media manager must keep track of the transport manager that it uses. @@ -42,7 +42,7 @@ public abstract class JingleMediaManager { public JingleMediaManager(JingleTransportManager transportManager) { this.transportManager = transportManager; } - + /** * Return The transport manager that goes with this media manager. */ @@ -76,7 +76,7 @@ public abstract class JingleMediaManager { */ public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, JingleSession jingleSession); - + // This is to set the attributes of the <content> element of the Jingle packet. public String getName() { return MEDIA_NAME; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java index 5a7d979ec..bd5ac37be 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/MediaNegotiator.java @@ -213,10 +213,10 @@ public class MediaNegotiator extends JingleNegotiator { bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads); if (bestCommonAudioPt == null) { - + setNegotiatorState(JingleNegotiatorState.FAILED); response = session.createJingleError(jingle, JingleError.NEGOTIATION_ERROR); - + } else { setNegotiatorState(JingleNegotiatorState.SUCCEEDED); @@ -242,7 +242,7 @@ public class MediaNegotiator extends JingleNegotiator { offeredPayloads = description.getAudioPayloadTypesList(); bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads); - + synchronized (remoteAudioPts) { remoteAudioPts.addAll(offeredPayloads); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java index 54407d480..b29bff5f7 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java @@ -24,7 +24,7 @@ package org.jivesoftware.smackx.jingleold.media; public class PayloadType { public static final String NODENAME = "payload-type"; - + public static int MAX_FIXED_PT = 95; public static int INVALID_PT = 65535; @@ -195,7 +195,7 @@ public class PayloadType { return true; } - + /** * Returns the XML element name of the element. * @@ -204,7 +204,7 @@ public class PayloadType { public static String getElementName() { return NODENAME; } - + public String toXML() { StringBuilder buf = new StringBuilder(); @@ -224,10 +224,10 @@ public class PayloadType { buf.append(getChildAttributes()); } buf.append("/>"); - + return buf.toString(); } - + protected String getChildAttributes() { StringBuilder buf = new StringBuilder(); if (this instanceof PayloadType.Audio) { @@ -235,7 +235,7 @@ public class PayloadType { buf.append(" clockrate=\"").append(pta.getClockRate()).append("\" "); } - + return buf.toString(); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java index 329a17392..8f4e6b881 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java @@ -69,7 +69,7 @@ import org.jivesoftware.smackx.jingleold.media.JingleMediaSession; public class AudioChannel { private static final Logger LOGGER = Logger.getLogger(AudioChannel.class.getName()); - + private MediaLocator locator; private String localIpAddress; private String remoteIpAddress; @@ -215,7 +215,7 @@ public class AudioChannel { if (!result){ return "Couldn't configure processor"; } - + // Get the tracks from the processor TrackControl[] tracks = processor.getTrackControls(); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java index ccac9238a..346fdff11 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/JmfMediaManager.java @@ -43,7 +43,7 @@ public class JmfMediaManager extends JingleMediaManager { public static final String MEDIA_NAME = "JMF"; - + private List<PayloadType> payloads = new ArrayList<PayloadType>(); private String mediaLocator = null; @@ -159,7 +159,7 @@ public class JmfMediaManager extends JingleMediaManager { private static void runLinuxPreInstall() { // @TODO Implement Linux Pre-Install } - + public String getName() { return MEDIA_NAME; } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java index 65de8d19d..e9c74214f 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java @@ -124,7 +124,7 @@ public class SpeexMediaManager extends JingleMediaManager { private static void runLinuxPreInstall() { // @TODO Implement Linux Pre-Install } - + public String getName() { return MEDIA_NAME; } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/multi/MultiMediaManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/multi/MultiMediaManager.java index b948ef8f2..1340c2555 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/multi/MultiMediaManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/multi/MultiMediaManager.java @@ -95,7 +95,7 @@ public class MultiMediaManager extends JingleMediaManager { public void setPreferredPayloadType(PayloadType preferredPayloadType) { this.preferredPayloadType = preferredPayloadType; } - + public String getName() { return MEDIA_NAME; } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/ScreenShareMediaManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/ScreenShareMediaManager.java index 4b4193f85..e1ac80d12 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/ScreenShareMediaManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/ScreenShareMediaManager.java @@ -104,7 +104,7 @@ public class ScreenShareMediaManager extends JingleMediaManager { public void setEncoder(ImageEncoder encoder) { this.encoder = encoder; } - + public String getName() { return MEDIA_NAME; } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/AbstractBufferedImageOp.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/AbstractBufferedImageOp.java index ec12e8c0b..bff2c0c29 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/AbstractBufferedImageOp.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/AbstractBufferedImageOp.java @@ -34,11 +34,11 @@ public abstract class AbstractBufferedImageOp implements BufferedImageOp, Clonea dstCM = src.getColorModel(); return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); } - + public Rectangle2D getBounds2D( BufferedImage src ) { return new Rectangle(0, 0, src.getWidth(), src.getHeight()); } - + public Point2D getPoint2D( Point2D srcPt, Point2D dstPt ) { if ( dstPt == null ) dstPt = new Point2D.Double(); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/OctTreeQuantizer.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/OctTreeQuantizer.java index b67d2a30a..8d67bfa24 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/OctTreeQuantizer.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/OctTreeQuantizer.java @@ -48,7 +48,7 @@ public class OctTreeQuantizer implements Quantizer { int totalGreen; int totalBlue; int index; - + /** * A debugging method which prints the tree out. */ @@ -72,7 +72,7 @@ public class OctTreeQuantizer implements Quantizer { private int maximumColors; private int colors = 0; private Vector<OctTreeNode>[] colorList; - + public OctTreeQuantizer() { setup(256); colorList = new Vector[MAX_LEVEL+1]; @@ -89,7 +89,7 @@ public class OctTreeQuantizer implements Quantizer { maximumColors = numColors; reduceColors = Math.max(512, numColors * 2); } - + /** * Add pixels to the quantizer. * @param pixels the array of ARGB pixels @@ -241,7 +241,7 @@ public class OctTreeQuantizer implements Quantizer { buildColorTable(root, table, 0); return table; } - + /** * A quick way to use the quantizer. Just create a table the right size and pass in the pixels. * @param inPixels the input colors @@ -281,6 +281,6 @@ public class OctTreeQuantizer implements Quantizer { } return index; } - + } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/PixelUtils.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/PixelUtils.java index e1e0e9edf..117ec500e 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/PixelUtils.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/PixelUtils.java @@ -64,14 +64,14 @@ public class PixelUtils { public static int interpolate(int v1, int v2, float f) { return clamp((int)(v1+f*(v2-v1))); } - + public static int brightness(int rgb) { int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = rgb & 0xff; return (r+g+b)/3; } - + public static boolean nearColors(int rgb1, int rgb2, int tolerance) { int r1 = (rgb1 >> 16) & 0xff; int g1 = (rgb1 >> 8) & 0xff; @@ -81,19 +81,19 @@ public class PixelUtils { int b2 = rgb2 & 0xff; return Math.abs(r1-r2) <= tolerance && Math.abs(g1-g2) <= tolerance && Math.abs(b1-b2) <= tolerance; } - + private final static float[] hsb1 = new float[3];//FIXME-not thread safe private final static float[] hsb2 = new float[3];//FIXME-not thread safe - + // Return rgb1 painted onto rgb2 public static int combinePixels(int rgb1, int rgb2, int op) { return combinePixels(rgb1, rgb2, op, 0xff); } - + public static int combinePixels(int rgb1, int rgb2, int op, int extraAlpha, int channelMask) { return (rgb2 & ~channelMask) | combinePixels(rgb1 & channelMask, rgb2, op, extraAlpha); } - + public static int combinePixels(int rgb1, int rgb2, int op, int extraAlpha) { if (op == REPLACE) return rgb1; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/QuantizeFilter.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/QuantizeFilter.java index 5f400921a..3543bd538 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/QuantizeFilter.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/QuantizeFilter.java @@ -82,7 +82,7 @@ public class QuantizeFilter extends WholeImageFilter { public void setSerpentine(boolean serpentine) { this.serpentine = serpentine; } - + /** * Return the serpentine setting * @return the current setting @@ -90,7 +90,7 @@ public class QuantizeFilter extends WholeImageFilter { public boolean getSerpentine() { return serpentine; } - + public void quantize(int[] inPixels, int[] outPixels, int width, int height, int numColors, boolean dither, boolean serpentine) { int count = width*height; Quantizer quantizer = new OctTreeQuantizer(); @@ -165,7 +165,7 @@ public class QuantizeFilter extends WholeImageFilter { protected int[] filterPixels( int width, int height, int[] inPixels, Rectangle transformedSpace ) { int[] outPixels = new int[width*height]; - + quantize(inPixels, outPixels, width, height, numColors, dither, serpentine); return outPixels; @@ -174,5 +174,5 @@ public class QuantizeFilter extends WholeImageFilter { public String toString() { return "Colors/Quantize..."; } - + } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/Quantizer.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/Quantizer.java index 60ace6334..d5eb36cc6 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/Quantizer.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/Quantizer.java @@ -27,7 +27,7 @@ public interface Quantizer { * @param numColors the number of colors we're quantizing to. */ public void setup(int numColors); - + /** * Add pixels to the quantizer. * @param pixels the array of ARGB pixels @@ -35,13 +35,13 @@ public interface Quantizer { * @param count the count of pixels */ public void addPixels(int[] pixels, int offset, int count); - + /** * Build a color table from the added pixels. * @return an array of ARGB pixels representing a color table */ public int[] buildColorTable(); - + /** * Using the previously-built color table, return the index into that table for a pixel. * This is guaranteed to return a valid index - returning the index of a color closer diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/WholeImageFilter.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/WholeImageFilter.java index d3e8ddff1..a94674d50 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/WholeImageFilter.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/sshare/api/WholeImageFilter.java @@ -36,7 +36,7 @@ public abstract class WholeImageFilter extends AbstractBufferedImageOp { * The input image bounds. */ protected Rectangle originalSpace; - + /** * Construct a WholeImageFilter. */ @@ -72,7 +72,7 @@ public abstract class WholeImageFilter extends AbstractBufferedImageOp { */ protected void transformSpace(Rectangle rect) { } - + /** * Actually filter the pixels. * @param width the image width diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/test/TestMediaSession.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/test/TestMediaSession.java index 4b36ac922..4e83a34b8 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/test/TestMediaSession.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/test/TestMediaSession.java @@ -53,7 +53,7 @@ public class TestMediaSession extends JingleMediaSession { * Starts transmission and for NAT Traversal reasons start receiving also. */ public void startTrasmit() { - + } /** @@ -63,7 +63,7 @@ public class TestMediaSession extends JingleMediaSession { * @param active active state */ public void setTrasmit(boolean active) { - + } /** @@ -77,13 +77,13 @@ public class TestMediaSession extends JingleMediaSession { * Stops transmission and for NAT Traversal reasons stop receiving also. */ public void stopTrasmit() { - + } /** * For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf */ public void stopReceive() { - + } } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BasicResolver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BasicResolver.java index cb6e12e17..c0c9a70e2 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BasicResolver.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BasicResolver.java @@ -65,7 +65,7 @@ public class BasicResolver extends TransportResolver { NetworkInterface iface = ifaces.nextElement(); Enumeration<InetAddress> iaddresses = iface.getInetAddresses(); - + while (iaddresses.hasMoreElements()) { InetAddress iaddress = iaddresses.nextElement(); if (!iaddress.isLoopbackAddress() && !iaddress.isLinkLocalAddress() && !iaddress.isSiteLocalAddress()) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedTransportManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedTransportManager.java index 798afe3a8..c7bb5c625 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedTransportManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedTransportManager.java @@ -27,9 +27,9 @@ import org.jivesoftware.smackx.jingleold.media.PayloadType; * */ public class FixedTransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener { - + FixedResolver resolver; - + public FixedTransportManager(FixedResolver inResolver) { resolver = inResolver; } @@ -37,7 +37,7 @@ public class FixedTransportManager extends JingleTransportManager implements Jin protected TransportResolver createResolver(JingleSession session) { return resolver; } - + public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { } @@ -56,7 +56,7 @@ public class FixedTransportManager extends JingleTransportManager implements Jin public void sessionMediaReceived(JingleSession jingleSession, String participant) { // Do Nothing } - + public void sessionCreated(JingleSession jingleSession) { jingleSession.addListener(this); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICEResolver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICEResolver.java index 2eab73d26..56b764100 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICEResolver.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICEResolver.java @@ -73,7 +73,7 @@ public class ICEResolver extends TransportResolver { if (negociatorsMap.get(server) == null) { ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1); negociatorsMap.put(server, iceNegociator); - + // gather candidates iceNegociator.gatherCandidateAddresses(); // priorize candidates @@ -137,7 +137,7 @@ public class ICEResolver extends TransportResolver { } catch (SocketException e1) { e1.printStackTrace(); } - + TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(Math.abs(random.nextLong())), candidate.getPort(), "1", candidate.getPriority(), iceType); transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress()); transportCandidate.setPort(getFreePort()); @@ -166,8 +166,8 @@ public class ICEResolver extends TransportResolver { String localIp; int network; - - + + // JBW/GW - 17JUL08: ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now the API doesn't exist in JSTUN 1.7.1 // if (iceNegociator.getPublicCandidate() != null) { // localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress(); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java index 2c85ea6f8..ed9d42606 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java @@ -439,7 +439,7 @@ public class RTPBridge extends IQ { // return true; // } // } - + DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName()); for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) { if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java index b29f203f7..45ccaca6f 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TcpUdpBridgeClient.java @@ -98,7 +98,7 @@ public class TcpUdpBridgeClient { public void run() { try { - + InputStream in = localTcpSocket.getInputStream(); InetAddress remoteHost = InetAddress.getByName(remoteUdpHost); process.start(); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java index 5eeae2c5d..b641f41a0 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java @@ -354,7 +354,7 @@ public abstract class TransportCandidate { public void run() { boolean isUsable; - + try { InetAddress candAddress = InetAddress.getByName(getIp()); isUsable = true;//candAddress.isReachable(TransportResolver.CHECK_TIMEOUT); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolver.java index d515669e3..0026bf3a1 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolver.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolver.java @@ -40,7 +40,7 @@ import org.jivesoftware.smackx.jingleold.JingleSession; public abstract class TransportResolver { private static final Logger LOGGER = Logger.getLogger(TransportResolver.class.getName()); - + public enum Type { rawupd, ice @@ -304,7 +304,7 @@ public abstract class TransportResolver { if (tpcan instanceof ICECandidate) cands.add((ICECandidate) tpcan); } - + // (ArrayList<ICECandidate>) getCandidatesList(); if (cands.size() > 0) { Collections.sort(cands); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java index 7e47ff069..0f7d0d02f 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java @@ -57,7 +57,7 @@ public class Jingle extends IQ { private Jid responder; // The responder // Sub-elements of a Jingle object. - + private final List<JingleContent> contents = new ArrayList<JingleContent>(); private JingleContentInfo contentInfo; @@ -353,7 +353,7 @@ public class Jingle extends IQ { buf.append(" sid=\"").append(getSid()).append("\""); } buf.append(">"); - + synchronized (contents) { for (JingleContent content : contents) { buf.append(content.toXML()); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java index 7f85649ea..f6853170b 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java @@ -89,7 +89,7 @@ import org.jxmpp.jid.parts.Resourcepart; */ public class AgentSession { private static final Logger LOGGER = Logger.getLogger(AgentSession.class.getName()); - + private XMPPConnection connection; private Jid workgroupJID; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/MacroGroup.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/MacroGroup.java index f46e45003..6b71e972b 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/MacroGroup.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/MacroGroup.java @@ -111,7 +111,7 @@ public class MacroGroup { public void setTitle(String title) { this.title = title; } - + public String toXML() { StringBuilder buf = new StringBuilder(); buf.append("<macrogroup>"); @@ -127,7 +127,7 @@ public class MacroGroup { buf.append("</macro>"); } buf.append("</macros>"); - + if (getMacroGroups().size() > 0) { buf.append("<macroGroups>"); for (MacroGroup groups : getMacroGroups()) { diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java index c98afc9fd..e648d8860 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java @@ -121,7 +121,7 @@ public class Macros extends IQ { return macroGroup; } - + public Macro parseMacro(XmlPullParser parser) throws XmlPullParserException, IOException { Macro macro = new Macro(); boolean done = false; @@ -150,10 +150,10 @@ public class Macros extends IQ { } return macro; } - + public MacroGroup parseMacroGroup(XmlPullParser parser) throws XmlPullParserException, IOException { MacroGroup group = new MacroGroup(); - + boolean done = false; while (!done) { int eventType = parser.next(); @@ -176,7 +176,7 @@ public class Macros extends IQ { } return group; } - + public MacroGroup parseMacroGroups(String macros) throws XmlPullParserException, IOException { MacroGroup group = null; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java index e201daf83..7d605abd9 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java @@ -39,7 +39,7 @@ import java.util.logging.Logger; */ public class QueueDetails implements ExtensionElement { private static final Logger LOGGER = Logger.getLogger(QueueDetails.class.getName()); - + /** * Element name of the packet extension. */ @@ -149,7 +149,7 @@ public class QueueDetails implements ExtensionElement { public QueueDetails parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { - + SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); QueueDetails queueDetails = new QueueDetails(); @@ -165,7 +165,7 @@ public class QueueDetails implements ExtensionElement { Date joinTime = null; uid = parser.getAttributeValue("", "jid"); - + if (uid == null) { // throw exception } diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java index 00d90506c..9a545883b 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java @@ -50,7 +50,7 @@ import org.jxmpp.jid.Jid; */ public class MessageEventManager extends Manager { private static final Logger LOGGER = Logger.getLogger(MessageEventManager.class.getName()); - + private static final Map<XMPPConnection, MessageEventManager> INSTANCES = new WeakHashMap<>(); private static final StanzaFilter PACKET_FILTER = new AndFilter(new StanzaExtensionFilter( diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java index 1baed7bda..50483c890 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java @@ -89,7 +89,7 @@ public class RosterExchange implements ExtensionElement { // Create a new Entry based on the rosterEntry and add it to the packet RemoteRosterEntry remoteRosterEntry = new RemoteRosterEntry(rosterEntry.getUser(), rosterEntry.getName(), groupNames); - + addRosterEntry(remoteRosterEntry); } @@ -103,7 +103,7 @@ public class RosterExchange implements ExtensionElement { remoteRosterEntries.add(remoteRosterEntry); } } - + /** * Returns the XML element name of the extension sub-packet root element. * Always returns "x" diff --git a/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java b/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java index cb4dbe532..3af2f12b5 100644 --- a/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java +++ b/smack-resolver-dnsjava/src/main/java/org/jivesoftware/smack/util/dns/dnsjava/DNSJavaResolver.java @@ -33,7 +33,7 @@ import org.xbill.DNS.Type; * */ public class DNSJavaResolver implements SmackInitializer, DNSResolver { - + private static DNSJavaResolver instance = new DNSJavaResolver(); public static DNSResolver getInstance() { diff --git a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java index b099f05a5..e7c831e4e 100644 --- a/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java +++ b/smack-resolver-javax/src/main/java/org/jivesoftware/smack/util/dns/javax/JavaxResolver.java @@ -39,10 +39,10 @@ import org.jivesoftware.smack.util.dns.SRVRecord; * */ public class JavaxResolver implements SmackInitializer, DNSResolver { - + private static JavaxResolver instance; private static DirContext dirContext; - + static { try { Hashtable<String, String> env = new Hashtable<String, String>(); diff --git a/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java b/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java index 60d268fd4..98322892d 100644 --- a/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java +++ b/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java @@ -102,7 +102,7 @@ public class PacketWriterTest { t.notify(); } } - + public class BlockingStringWriter extends Writer { @Override public void write(char[] cbuf, int off, int len) throws IOException {