From 43b99a2a8522c856da4fd419b70ea60833f7c954 Mon Sep 17 00:00:00 2001
From: Florian Schmaus
Date: Sat, 14 Feb 2015 09:36:52 +0100
Subject: [PATCH 0001/2111] Smack 4.2.0-alpha1-SNAPSHOT
---
version.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/version.gradle b/version.gradle
index 42291c08c..f4938188c 100644
--- a/version.gradle
+++ b/version.gradle
@@ -1,7 +1,7 @@
allprojects {
ext {
- shortVersion = '4.1.0-rc1'
- isSnapshot = false
+ shortVersion = '4.2.0-alpha1'
+ isSnapshot = true
jxmppVersion = '0.4.2-beta1'
smackMinAndroidSdk = 8
}
From bc61527bd2b967d71c3b892bffed36832fddfbab Mon Sep 17 00:00:00 2001
From: Florian Schmaus
Date: Sat, 14 Feb 2015 09:43:44 +0100
Subject: [PATCH 0002/2111] Expose InterruptedException
SMACK-632
---
.../smack/bosh/XMPPBOSHConnection.java | 4 +-
.../smack/AbstractXMPPConnection.java | 70 ++++---
.../jivesoftware/smack/PacketCollector.java | 33 ++--
.../jivesoftware/smack/PacketListener.java | 3 +-
.../smack/SASLAuthentication.java | 45 ++---
.../smack/SynchronizationPoint.java | 5 +-
.../jivesoftware/smack/XMPPConnection.java | 31 ++-
.../smack/sasl/SASLMechanism.java | 11 +-
.../util/ArrayBlockingQueueWithShutdown.java | 16 +-
.../jivesoftware/smack/DummyConnection.java | 2 +-
.../smack/PacketCollectorTest.java | 19 +-
.../smack/ThreadedDummyConnection.java | 4 +-
.../smack/sasl/DigestMd5SaslTest.java | 2 +-
.../smackx/debugger/EnhancedDebugger.java | 2 +-
.../smackx/carbons/CarbonManager.java | 15 +-
.../csi/ClientStateIndicationManager.java | 4 +-
.../jivesoftware/smackx/hoxt/HOXTManager.java | 3 +-
.../address/MultipleRecipientManager.java | 16 +-
.../smackx/amp/AMPDeliverCondition.java | 3 +-
.../smackx/amp/AMPExpireAtCondition.java | 3 +-
.../jivesoftware/smackx/amp/AMPManager.java | 8 +-
.../smackx/amp/AMPMatchResourceCondition.java | 3 +-
.../smackx/bookmarks/BookmarkManager.java | 20 +-
.../smackx/bytestreams/BytestreamRequest.java | 3 +-
.../smackx/bytestreams/ibb/CloseListener.java | 4 +-
.../smackx/bytestreams/ibb/DataListener.java | 2 +-
.../ibb/InBandBytestreamManager.java | 15 +-
.../ibb/InBandBytestreamRequest.java | 6 +-
.../ibb/InBandBytestreamSession.java | 12 +-
.../bytestreams/ibb/InitiationListener.java | 4 +-
.../socks5/InitiationListener.java | 4 +-
.../socks5/Socks5BytestreamManager.java | 9 +-
.../socks5/Socks5BytestreamRequest.java | 6 +-
.../socks5/Socks5ClientForInitiator.java | 3 +-
.../smackx/caps/EntityCapsManager.java | 8 +-
.../smackx/chatstates/ChatStateManager.java | 3 +-
.../smackx/commands/AdHocCommand.java | 15 +-
.../smackx/commands/AdHocCommandManager.java | 11 +-
.../smackx/commands/RemoteCommand.java | 18 +-
.../smackx/disco/ServiceDiscoveryManager.java | 30 ++-
.../filetransfer/FaultTolerantNegotiator.java | 4 +-
.../filetransfer/FileTransferManager.java | 3 +-
.../filetransfer/FileTransferNegotiator.java | 6 +-
.../filetransfer/FileTransferRequest.java | 3 +-
.../filetransfer/IBBTransferNegotiator.java | 6 +-
.../filetransfer/IncomingFileTransfer.java | 5 +-
.../filetransfer/OutgoingFileTransfer.java | 5 +-
.../smackx/filetransfer/StreamNegotiator.java | 5 +-
.../smackx/iqlast/LastActivityManager.java | 6 +-
.../smackx/iqprivate/PrivateDataManager.java | 6 +-
.../smackx/iqregister/AccountManager.java | 29 ++-
.../smackx/iqversion/VersionManager.java | 5 +-
.../smackx/muc/MultiUserChat.java | 179 ++++++++++++------
.../smackx/muc/MultiUserChatManager.java | 18 +-
.../smackx/offline/OfflineMessageManager.java | 21 +-
.../jivesoftware/smackx/pep/PEPManager.java | 3 +-
.../jivesoftware/smackx/ping/PingManager.java | 22 ++-
.../smackx/privacy/PrivacyListManager.java | 57 ++++--
.../jivesoftware/smackx/pubsub/LeafNode.java | 52 +++--
.../org/jivesoftware/smackx/pubsub/Node.java | 49 +++--
.../smackx/pubsub/PubSubManager.java | 36 ++--
.../receipts/DeliveryReceiptManager.java | 5 +-
.../smackx/search/UserSearch.java | 9 +-
.../smackx/search/UserSearchManager.java | 9 +-
.../sharedgroups/SharedGroupManager.java | 3 +-
.../smackx/time/EntityTimeManager.java | 4 +-
.../smackx/vcardtemp/VCardManager.java | 15 +-
.../smackx/vcardtemp/packet/VCard.java | 9 +-
.../smackx/xdata/XDataManager.java | 3 +-
.../smackx/xhtmlim/XHTMLManager.java | 3 +-
.../ibb/InBandBytestreamManagerTest.java | 8 +-
.../ibb/InBandBytestreamRequestTest.java | 3 +-
.../InBandBytestreamSessionMessageTest.java | 3 +-
.../ibb/InBandBytestreamSessionTest.java | 3 +-
.../socks5/Socks5ByteStreamManagerTest.java | 3 +-
.../socks5/Socks5ByteStreamRequestTest.java | 3 +-
.../socks5/Socks5ClientForInitiatorTest.java | 3 +-
.../jivesoftware/smackx/ping/PingTest.java | 10 +-
.../smackx/pubsub/ConfigureFormTest.java | 4 +-
.../jivesoftware/util/ConnectionUtils.java | 3 +-
.../org/jivesoftware/smack/chat/Chat.java | 6 +-
.../jivesoftware/smack/chat/ChatManager.java | 2 +-
.../org/jivesoftware/smack/roster/Roster.java | 39 ++--
.../smack/roster/RosterEntry.java | 3 +-
.../smack/roster/RosterGroup.java | 9 +-
.../smackx/jingleold/ContentNegotiator.java | 7 +-
.../smackx/jingleold/JingleManager.java | 3 +-
.../smackx/jingleold/JingleNegotiator.java | 3 +-
.../smackx/jingleold/JingleSession.java | 27 ++-
.../jingleold/JingleSessionRequest.java | 3 +-
.../smackx/jingleold/JingleSessionState.java | 3 +-
.../jingleold/JingleSessionStateUnknown.java | 5 +-
.../listeners/JingleMediaListener.java | 3 +-
.../listeners/JingleSessionListener.java | 3 +-
.../listeners/JingleTransportListener.java | 3 +-
.../jingleold/media/MediaNegotiator.java | 9 +-
.../smackx/jingleold/nat/BasicResolver.java | 3 +-
.../smackx/jingleold/nat/BridgedResolver.java | 5 +-
.../nat/BridgedTransportManager.java | 2 +-
.../smackx/jingleold/nat/FixedResolver.java | 3 +-
.../smackx/jingleold/nat/ICEResolver.java | 3 +-
.../jingleold/nat/ICETransportManager.java | 4 +-
.../jingleold/nat/JingleTransportManager.java | 6 +-
.../smackx/jingleold/nat/RTPBridge.java | 12 +-
.../smackx/jingleold/nat/STUN.java | 6 +-
.../smackx/jingleold/nat/STUNResolver.java | 3 +-
.../jingleold/nat/TransportNegotiator.java | 26 ++-
.../jingleold/nat/TransportResolver.java | 15 +-
.../nat/TransportResolverListener.java | 3 +-
.../smackx/workgroup/agent/Agent.java | 8 +-
.../smackx/workgroup/agent/AgentRoster.java | 6 +-
.../smackx/workgroup/agent/AgentSession.java | 75 +++++---
.../smackx/workgroup/agent/Offer.java | 6 +-
.../workgroup/agent/OfferConfirmation.java | 2 +-
.../workgroup/agent/TranscriptManager.java | 6 +-
.../agent/TranscriptSearchManager.java | 6 +-
.../smackx/workgroup/user/Workgroup.java | 48 +++--
.../DefaultMessageEventRequestListener.java | 2 +-
.../smackx/xevent/MessageEventManager.java | 12 +-
.../xevent/MessageEventRequestListener.java | 3 +-
.../smackx/xroster/RosterExchangeManager.java | 9 +-
.../smack/sasl/javax/SASLDigestMD5Test.java | 2 +-
.../sasl/provided/SASLDigestMD5Test.java | 2 +-
.../smack/tcp/XMPPTCPConnection.java | 70 +++----
124 files changed, 977 insertions(+), 597 deletions(-)
diff --git a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
index e4f203698..bddd37851 100644
--- a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
+++ b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
@@ -212,7 +212,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
@Override
protected void loginNonAnonymously(String username, String password, String resource)
- throws XMPPException, SmackException, IOException {
+ throws XMPPException, SmackException, IOException, InterruptedException {
if (saslAuthentication.hasNonAnonymousAuthentication()) {
// Authenticate using SASL
if (password != null) {
@@ -230,7 +230,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
}
@Override
- protected void loginAnonymously() throws XMPPException, SmackException, IOException {
+ protected void loginAnonymously() throws XMPPException, SmackException, IOException, InterruptedException {
// Wait with SASL auth until the SASL mechanisms have been received
saslFeatureReceived.checkIfSuccessOrWaitOrThrow();
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 36d570533..5bdb0fa60 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
@@ -362,10 +362,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override
public abstract boolean isSecureConnection();
- protected abstract void sendPacketInternal(Stanza packet) throws NotConnectedException;
+ protected abstract void sendPacketInternal(Stanza packet) throws NotConnectedException, InterruptedException;
@Override
- public abstract void send(PlainStreamElement element) throws NotConnectedException;
+ public abstract void send(PlainStreamElement element) throws NotConnectedException, InterruptedException;
@Override
public abstract boolean isUsingCompression();
@@ -382,8 +382,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws IOException
* @throws ConnectionException with detailed information about the failed connection.
* @return a reference to this object, to chain connect()
with login()
.
+ * @throws InterruptedException
*/
- public synchronized AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException {
+ public synchronized AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException, InterruptedException {
// Check if not already connected
throwAlreadyConnectedExceptionIfAppropriate();
@@ -406,8 +407,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws SmackException
* @throws IOException
* @throws XMPPException
+ * @throws InterruptedException
*/
- protected abstract void connectInternal() throws SmackException, IOException, XMPPException;
+ protected abstract void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException;
private String usedUsername, usedPassword, usedResource;
@@ -432,8 +434,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws XMPPException if an error occurs on the XMPP protocol level.
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
* @throws IOException if an I/O error occurs during login.
+ * @throws InterruptedException
*/
- public synchronized void login() throws XMPPException, SmackException, IOException {
+ public synchronized void login() throws XMPPException, SmackException, IOException, InterruptedException {
if (isAnonymous()) {
throwNotConnectedExceptionIfAppropriate();
throwAlreadyLoggedInExceptionIfAppropriate();
@@ -457,10 +460,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws XMPPException
* @throws SmackException
* @throws IOException
+ * @throws InterruptedException
* @see #login
*/
public synchronized void login(CharSequence username, String password) throws XMPPException, SmackException,
- IOException {
+ IOException, InterruptedException {
login(username, password, config.getResource());
}
@@ -474,10 +478,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws XMPPException
* @throws SmackException
* @throws IOException
+ * @throws InterruptedException
* @see #login
*/
public synchronized void login(CharSequence username, String password, String resource) throws XMPPException,
- SmackException, IOException {
+ SmackException, IOException, InterruptedException {
if (!config.allowNullOrEmptyUsername) {
StringUtils.requireNotNullOrEmpty(username, "Username must not be null or empty");
}
@@ -490,9 +495,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
protected abstract void loginNonAnonymously(String username, String password, String resource)
- throws XMPPException, SmackException, IOException;
+ throws XMPPException, SmackException, IOException, InterruptedException;
- protected abstract void loginAnonymously() throws XMPPException, SmackException, IOException;
+ protected abstract void loginAnonymously() throws XMPPException, SmackException, IOException, InterruptedException;
@Override
public final boolean isConnected() {
@@ -520,7 +525,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// TODO remove this suppression once "disable legacy session" code has been removed from Smack
@SuppressWarnings("deprecation")
protected void bindResourceAndEstablishSession(String resource) throws XMPPErrorException,
- IOException, SmackException {
+ IOException, SmackException, InterruptedException {
// Wait until either:
// - the servers last features stanza has been parsed
@@ -557,7 +562,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
}
- protected void afterSuccessfulLogin(final boolean resumed) throws NotConnectedException {
+ protected void afterSuccessfulLogin(final boolean resumed) throws NotConnectedException, InterruptedException {
// Indicate that we're now authenticated.
this.authenticated = true;
@@ -634,7 +639,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
@Override
- public void sendPacket(Stanza packet) throws NotConnectedException {
+ public void sendPacket(Stanza packet) throws NotConnectedException, InterruptedException {
Objects.requireNonNull(packet, "Packet must not be null");
throwNotConnectedExceptionIfAppropriate();
@@ -693,7 +698,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws NotConnectedException
*/
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
- sendPacket(unavailablePresence);
+ try {
+ sendPacket(unavailablePresence);
+ }
+ catch (InterruptedException e) {
+ LOGGER.log(Level.FINE, "Was interrupted while sending unavailable presence. Continuing to disconnect the connection", e);
+ }
shutdown();
callConnectionClosedListener();
}
@@ -717,7 +727,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
@Override
- public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException {
+ public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException {
PacketFilter packetFilter = new IQReplyFilter(packet, this);
// Create the packet collector before sending the packet
PacketCollector packetCollector = createPacketCollectorAndSend(packetFilter, packet);
@@ -726,14 +736,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override
public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Stanza packet)
- throws NotConnectedException {
+ throws NotConnectedException, InterruptedException {
// Create the packet collector before sending the packet
PacketCollector packetCollector = createPacketCollector(packetFilter);
try {
// Now we can send the packet as the collector has been created
sendPacket(packet);
}
- catch (NotConnectedException | RuntimeException e) {
+ catch (InterruptedException | NotConnectedException | RuntimeException e) {
packetCollector.cancel();
throw e;
}
@@ -1062,8 +1072,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
try {
sendPacket(errorIQ);
}
- catch (NotConnectedException e) {
- LOGGER.log(Level.WARNING, "NotConnectedException while sending error IQ to unkown IQ request", e);
+ catch (InterruptedException | NotConnectedException e) {
+ LOGGER.log(Level.WARNING, "Exception while sending error IQ to unkown IQ request", e);
}
} else {
ExecutorService executorService = null;
@@ -1091,8 +1101,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
try {
sendPacket(response);
}
- catch (NotConnectedException e) {
- LOGGER.log(Level.WARNING, "NotConnectedException while sending response to IQ request", e);
+ catch (InterruptedException | NotConnectedException e) {
+ LOGGER.log(Level.WARNING, "Exception while sending response to IQ request", e);
}
}
});
@@ -1334,7 +1344,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
protected final void parseFeatures(XmlPullParser parser) throws XmlPullParserException,
- IOException, SmackException {
+ IOException, SmackException, InterruptedException {
streamFeatures.clear();
final int initialDepth = parser.getDepth();
while (true) {
@@ -1397,7 +1407,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
afterFeaturesReceived();
}
- protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException {
+ protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException, InterruptedException {
// Default implementation does nothing
}
@@ -1419,14 +1429,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
- PacketListener callback) throws NotConnectedException {
+ PacketListener callback) throws NotConnectedException, InterruptedException {
sendStanzaWithResponseCallback(stanza, replyFilter, callback, null);
}
@Override
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
PacketListener callback, ExceptionCallback exceptionCallback)
- throws NotConnectedException {
+ throws NotConnectedException, InterruptedException {
sendStanzaWithResponseCallback(stanza, replyFilter, callback, exceptionCallback,
getPacketReplyTimeout());
}
@@ -1434,7 +1444,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
final PacketListener callback, final ExceptionCallback exceptionCallback,
- long timeout) throws NotConnectedException {
+ long timeout) throws NotConnectedException, InterruptedException {
Objects.requireNonNull(stanza, "stanza must not be null");
// While Smack allows to add PacketListeners with a PacketFilter value of 'null', we
// disallow it here in the async API as it makes no sense
@@ -1443,7 +1453,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
final PacketListener packetListener = new PacketListener() {
@Override
- public void processPacket(Stanza packet) throws NotConnectedException {
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
try {
XMPPErrorException.ifHasErrorThenThrow(packet);
callback.processPacket(packet);
@@ -1475,20 +1485,20 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override
public void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback)
- throws NotConnectedException {
+ throws NotConnectedException, InterruptedException {
sendIqWithResponseCallback(iqRequest, callback, null);
}
@Override
public void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback,
- ExceptionCallback exceptionCallback) throws NotConnectedException {
+ ExceptionCallback exceptionCallback) throws NotConnectedException, InterruptedException {
sendIqWithResponseCallback(iqRequest, callback, exceptionCallback, getPacketReplyTimeout());
}
@Override
public void sendIqWithResponseCallback(IQ iqRequest, final PacketListener callback,
final ExceptionCallback exceptionCallback, long timeout)
- throws NotConnectedException {
+ throws NotConnectedException, InterruptedException {
PacketFilter replyFilter = new IQReplyFilter(iqRequest, this);
sendStanzaWithResponseCallback(iqRequest, replyFilter, callback, exceptionCallback, timeout);
}
@@ -1497,7 +1507,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public void addOneTimeSyncCallback(final PacketListener callback, final PacketFilter packetFilter) {
final PacketListener packetListener = new PacketListener() {
@Override
- public void processPacket(Stanza packet) throws NotConnectedException {
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
try {
callback.processPacket(packet);
} finally {
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 0908b35c2..9143782b0 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
@@ -19,8 +19,6 @@ package org.jivesoftware.smack;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
@@ -43,8 +41,6 @@ import org.jivesoftware.smack.packet.Stanza;
*/
public class PacketCollector {
- private static final Logger LOGGER = Logger.getLogger(PacketCollector.class.getName());
-
private final PacketFilter packetFilter;
private final ArrayBlockingQueue resultQueue;
@@ -131,18 +127,14 @@ public class PacketCollector {
* available.
*
* @return the next available packet.
+ * @throws InterruptedException
*/
@SuppressWarnings("unchecked")
- public P nextResultBlockForever() {
+ public
P nextResultBlockForever() throws InterruptedException {
throwIfCancelled();
P res = null;
while (res == null) {
- try {
- res = (P) resultQueue.take();
- } catch (InterruptedException e) {
- LOGGER.log(Level.FINE,
- "nextResultBlockForever was interrupted", e);
- }
+ res = (P) resultQueue.take();
}
return res;
}
@@ -152,8 +144,9 @@ public class PacketCollector {
* timeout has elapsed.
*
* @return the next available packet.
+ * @throws InterruptedException
*/
- public
P nextResult() {
+ public
P nextResult() throws InterruptedException {
return nextResult(connection.getPacketReplyTimeout());
}
@@ -166,20 +159,16 @@ public class PacketCollector {
*
* @param timeout the timeout in milliseconds.
* @return the next available packet.
+ * @throws InterruptedException
*/
@SuppressWarnings("unchecked")
- public
P nextResult(long timeout) {
+ public
P nextResult(long timeout) throws InterruptedException {
throwIfCancelled();
P res = null;
long remainingWait = timeout;
waitStart = System.currentTimeMillis();
do {
- try {
- res = (P) resultQueue.poll(remainingWait, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e) {
- LOGGER.log(Level.FINE, "nextResult was interrupted", e);
- }
+ res = (P) resultQueue.poll(remainingWait, TimeUnit.MILLISECONDS);
if (res != null) {
return res;
}
@@ -196,8 +185,9 @@ public class PacketCollector {
* @return the next available packet.
* @throws XMPPErrorException in case an error response.
* @throws NoResponseException if there was no response from the server.
+ * @throws InterruptedException
*/
- public
P nextResultOrThrow() throws NoResponseException, XMPPErrorException {
+ public
P nextResultOrThrow() throws NoResponseException, XMPPErrorException, InterruptedException {
return nextResultOrThrow(connection.getPacketReplyTimeout());
}
@@ -209,8 +199,9 @@ public class PacketCollector {
* @return the next available packet.
* @throws NoResponseException if there was no response from the server.
* @throws XMPPErrorException in case an error response.
+ * @throws InterruptedException
*/
- public
P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException {
+ public
P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException, InterruptedException {
P result = nextResult(timeout);
cancel();
if (result == null) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java b/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java
index 56d6b93e2..b6cfc756d 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java
@@ -47,7 +47,8 @@ public interface PacketListener {
*
*
* @param packet the packet to process.
+ * @throws InterruptedException
*/
- public void processPacket(Stanza packet) throws NotConnectedException;
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
index d15e6c446..a632b9f96 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
@@ -180,21 +180,17 @@ public class SASLAuthentication {
* @throws XMPPErrorException
* @throws SASLErrorException
* @throws SmackException
+ * @throws InterruptedException
*/
public void authenticate(String resource, CallbackHandler cbh) throws IOException,
- XMPPErrorException, SASLErrorException, SmackException {
+ XMPPErrorException, SASLErrorException, SmackException, InterruptedException {
SASLMechanism selectedMechanism = selectMechanism();
if (selectedMechanism != null) {
currentMechanism = selectedMechanism;
synchronized (this) {
currentMechanism.authenticate(connection.getHost(), connection.getServiceName(), cbh);
- try {
- // Wait until SASL negotiation finishes
- wait(connection.getPacketReplyTimeout());
- }
- catch (InterruptedException e) {
- // Ignore
- }
+ // Wait until SASL negotiation finishes
+ wait(connection.getPacketReplyTimeout());
}
maybeThrowException();
@@ -224,10 +220,11 @@ public class SASLAuthentication {
* @throws SASLErrorException
* @throws IOException
* @throws SmackException
+ * @throws InterruptedException
*/
public void authenticate(String username, String password, String resource)
throws XMPPErrorException, SASLErrorException, IOException,
- SmackException {
+ SmackException, InterruptedException {
SASLMechanism selectedMechanism = selectMechanism();
if (selectedMechanism != null) {
currentMechanism = selectedMechanism;
@@ -235,13 +232,8 @@ public class SASLAuthentication {
synchronized (this) {
currentMechanism.authenticate(username, connection.getHost(),
connection.getServiceName(), password);
- try {
- // Wait until SASL negotiation finishes
- wait(connection.getPacketReplyTimeout());
- }
- catch (InterruptedException e) {
- // Ignore
- }
+ // Wait until SASL negotiation finishes
+ wait(connection.getPacketReplyTimeout());
}
maybeThrowException();
@@ -267,20 +259,16 @@ public class SASLAuthentication {
* @throws SASLErrorException
* @throws XMPPErrorException if an error occures while authenticating.
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
public void authenticateAnonymously() throws SASLErrorException,
- SmackException, XMPPErrorException {
+ SmackException, XMPPErrorException, InterruptedException {
currentMechanism = (new SASLAnonymous()).instanceForAuthentication(connection);
// Wait until SASL negotiation finishes
synchronized (this) {
currentMechanism.authenticate(null, null, null, "");
- try {
- wait(connection.getPacketReplyTimeout());
- }
- catch (InterruptedException e) {
- // Ignore
- }
+ wait(connection.getPacketReplyTimeout());
}
maybeThrowException();
@@ -308,8 +296,9 @@ public class SASLAuthentication {
*
* @param challenge a base64 encoded string representing the challenge.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void challengeReceived(String challenge) throws SmackException {
+ public void challengeReceived(String challenge) throws SmackException, InterruptedException {
challengeReceived(challenge, false);
}
@@ -322,11 +311,12 @@ public class SASLAuthentication {
* @param challenge a base64 encoded string representing the challenge.
* @param finalChallenge true if this is the last challenge send by the server within the success stanza
* @throws SmackException
+ * @throws InterruptedException
*/
- public void challengeReceived(String challenge, boolean finalChallenge) throws SmackException {
+ public void challengeReceived(String challenge, boolean finalChallenge) throws SmackException, InterruptedException {
try {
currentMechanism.challengeReceived(challenge, finalChallenge);
- } catch (SmackException e) {
+ } catch (InterruptedException | SmackException e) {
authenticationFailed(e);
throw e;
}
@@ -336,8 +326,9 @@ public class SASLAuthentication {
* Notification message saying that SASL authentication was successful. The next step
* would be to bind the resource.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void authenticated(Success success) throws SmackException {
+ public void authenticated(Success success) throws SmackException, InterruptedException {
// RFC6120 6.3.10 "At the end of the authentication exchange, the SASL server (the XMPP
// "receiving entity") can include "additional data with success" if appropriate for the
// SASL mechanism in use. In XMPP, this is done by including the additional data as the XML
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java b/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java
index 7e75a75c1..4b6bd909e 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java
@@ -56,7 +56,7 @@ public class SynchronizationPoint {
}
public void sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
assert (state == State.Initial);
connectionLock.lock();
try {
@@ -80,7 +80,7 @@ public class SynchronizationPoint {
}
public void sendAndWaitForResponseOrThrow(PlainStreamElement request) throws E, NoResponseException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
sendAndWaitForResponse(request);
switch (state) {
case Failure:
@@ -172,6 +172,7 @@ public class SynchronizationPoint {
break;
}
} catch (InterruptedException e) {
+ // This InterruptedException could be "spurious wakeups", see javadoc of awaitNanos()
LOGGER.log(Level.WARNING, "Thread interrupt while waiting for condition or timeout ignored", e);
}
}
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 fd93de2d1..89877edd8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
@@ -158,8 +158,9 @@ public interface XMPPConnection {
*
* @param packet the packet to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendPacket(Stanza packet) throws NotConnectedException;
+ public void sendPacket(Stanza packet) throws NotConnectedException, InterruptedException;
/**
* Send a PlainStreamElement.
@@ -171,8 +172,9 @@ public interface XMPPConnection {
*
* @param element
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void send(PlainStreamElement element) throws NotConnectedException;
+ public void send(PlainStreamElement element) throws NotConnectedException, InterruptedException;
/**
* Adds a connection listener to this connection that will be notified when
@@ -198,8 +200,9 @@ public interface XMPPConnection {
* @param packet the packet to filter responses from
* @return a new packet collector.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException;
+ public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException, InterruptedException;
/**
* Creates a new packet collector for this connection. A packet filter determines
@@ -210,9 +213,11 @@ public interface XMPPConnection {
* @param packetFilter the packet filter to use.
* @param packet the packet to send right after the collector got created
* @return a new packet collector.
+ * @throws InterruptedException
+ * @throws NotConnectedException
*/
public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Stanza packet)
- throws NotConnectedException;
+ throws NotConnectedException, InterruptedException;
/**
* Creates a new packet collector for this connection. A packet filter
@@ -462,9 +467,10 @@ public interface XMPPConnection {
* @param replyFilter the filter used to determine response stanza (required)
* @param callback the callback invoked if there is a response (required)
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
- PacketListener callback) throws NotConnectedException;
+ PacketListener callback) throws NotConnectedException, InterruptedException;
/**
* Send a stanza and wait asynchronously for a response by using replyFilter
.
@@ -479,9 +485,10 @@ public interface XMPPConnection {
* @param callback the callback invoked if there is a response (required)
* @param exceptionCallback the callback invoked if there is an exception (optional)
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, PacketListener callback,
- ExceptionCallback exceptionCallback) throws NotConnectedException;
+ ExceptionCallback exceptionCallback) throws NotConnectedException, InterruptedException;
/**
* Send a stanza and wait asynchronously for a response by using replyFilter
.
@@ -497,10 +504,11 @@ public interface XMPPConnection {
* @param exceptionCallback the callback invoked if there is an exception (optional)
* @param timeout the timeout in milliseconds to wait for a response
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter,
final PacketListener callback, final ExceptionCallback exceptionCallback,
- long timeout) throws NotConnectedException;
+ long timeout) throws NotConnectedException, InterruptedException;
/**
* Send a IQ stanza and invoke callback
if there is a result of
@@ -510,8 +518,9 @@ public interface XMPPConnection {
* @param iqRequest the IQ stanza to send (required)
* @param callback the callback invoked if there is result response (required)
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback) throws NotConnectedException;
+ public void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback) throws NotConnectedException, InterruptedException;
/**
* Send a IQ stanza and invoke callback
if there is a result of
@@ -525,9 +534,10 @@ public interface XMPPConnection {
* @param callback the callback invoked if there is result response (required)
* @param exceptionCallback the callback invoked if there is an Exception optional
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback,
- ExceptionCallback exceptionCallback) throws NotConnectedException;
+ ExceptionCallback exceptionCallback) throws NotConnectedException, InterruptedException;
/**
* Send a IQ stanza and invoke callback
if there is a result of
@@ -542,10 +552,11 @@ public interface XMPPConnection {
* @param exceptionCallback the callback invoked if there is an Exception optional
* @param timeout the timeout in milliseconds to wait for a response
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void sendIqWithResponseCallback(IQ iqRequest, final PacketListener callback,
final ExceptionCallback exceptionCallback, long timeout)
- throws NotConnectedException;
+ throws NotConnectedException, InterruptedException;
/**
* Add a callback that is called exactly once and synchronously with the incoming stanza that matches the given
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
index eba0d7045..bde8b6310 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
@@ -158,9 +158,10 @@ public abstract class SASLMechanism implements Comparable {
* @param password the password for this account.
* @throws SmackException If a network error occurs while authenticating.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public final void authenticate(String username, String host, String serviceName, String password)
- throws SmackException, NotConnectedException {
+ throws SmackException, NotConnectedException, InterruptedException {
this.authenticationId = username;
this.host = host;
this.serviceName = serviceName;
@@ -181,9 +182,10 @@ public abstract class SASLMechanism implements Comparable {
* @param cbh the CallbackHandler to obtain user information.
* @throws SmackException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void authenticate(String host,String serviceName, CallbackHandler cbh)
- throws SmackException, NotConnectedException {
+ throws SmackException, NotConnectedException, InterruptedException {
this.host = host;
this.serviceName = serviceName;
authenticateInternal(cbh);
@@ -192,7 +194,7 @@ public abstract class SASLMechanism implements Comparable {
protected abstract void authenticateInternal(CallbackHandler cbh) throws SmackException;
- private final void authenticate() throws SmackException, NotConnectedException {
+ private final void authenticate() throws SmackException, NotConnectedException, InterruptedException {
byte[] authenticationBytes = getAuthenticationText();
String authenticationText;
if (authenticationBytes != null) {
@@ -224,8 +226,9 @@ public abstract class SASLMechanism implements Comparable {
* @param finalChallenge true if this is the last challenge send by the server within the success stanza
* @throws NotConnectedException
* @throws SmackException
+ * @throws InterruptedException
*/
- public final void challengeReceived(String challengeString, boolean finalChallenge) throws SmackException, NotConnectedException {
+ public final void challengeReceived(String challengeString, boolean finalChallenge) throws SmackException, NotConnectedException, InterruptedException {
byte[] challenge = Base64.decode(challengeString);
byte[] response = evaluateChallenge(challenge);
if (finalChallenge) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java
index 99aa50292..f8be19611 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java
@@ -226,7 +226,21 @@ public class ArrayBlockingQueueWithShutdown extends AbstractQueue implemen
}
}
- @Override
+ /**
+ * Inserts the specified element into this queue, waiting if necessary
+ * for space to become available.
+ *
+ * This may throw an {@link InterruptedException} in two cases
+ *
+ * - If the queue was shut down.
+ * - If the thread was was interrupted.
+ *
+ * So you have to check which is the case, e.g. by calling {@link #isShutdown()}.
+ *
+ *
+ * @param e the element to add.
+ * @throws InterruptedException if interrupted while waiting or if the queue was shut down.
+ */
public void put(E e) throws InterruptedException {
checkNotNull(e);
lock.lockInterruptibly();
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 0b0db518b..bd103c17a 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
@@ -198,7 +198,7 @@ public class DummyConnection extends AbstractXMPPConnection {
dummyConnection.connect();
dummyConnection.login();
}
- catch (SmackException | IOException | XMPPException e) {
+ catch (InterruptedException | SmackException | IOException | XMPPException e) {
throw new IllegalStateException(e);
}
return dummyConnection;
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 e2e3b633b..8c86a5d8c 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java
@@ -27,7 +27,7 @@ public class PacketCollectorTest
{
@Test
- public void verifyRollover()
+ public void verifyRollover() throws InterruptedException
{
TestPacketCollector collector = new TestPacketCollector(null, new OKEverything(), 5);
@@ -92,13 +92,9 @@ public class PacketCollectorTest
// System.out.println(Thread.currentThread().getName() + " packet: " + packet);
}
}
- catch (RuntimeException re)
- {
- if (re.getCause() instanceof InterruptedException)
- {
-// System.out.println(Thread.currentThread().getName() + " has been interupted");
- }
- }
+ catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
}
});
consumer1.setName("consumer 1");
@@ -119,7 +115,12 @@ public class PacketCollectorTest
catch (InterruptedException e)
{
}
- p = collector.nextResult(1);
+ try {
+ p = collector.nextResult(1);
+ }
+ catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
// System.out.println(Thread.currentThread().getName() + " packet: " + p);
}
while (p != null);
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java b/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java
index 5644c66cf..5a2b64ab6 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java
@@ -38,7 +38,7 @@ public class ThreadedDummyConnection extends DummyConnection {
private volatile boolean timeout = false;
@Override
- public void sendPacket(Stanza packet) throws NotConnectedException {
+ public void sendPacket(Stanza packet) throws NotConnectedException, InterruptedException {
super.sendPacket(packet);
if (packet instanceof IQ && !timeout) {
@@ -102,7 +102,7 @@ public class ThreadedDummyConnection extends DummyConnection {
}
}
- public static ThreadedDummyConnection newInstance() throws SmackException, IOException, XMPPException {
+ public static ThreadedDummyConnection newInstance() throws SmackException, IOException, XMPPException, InterruptedException {
ThreadedDummyConnection threadedDummyConnection = new ThreadedDummyConnection();
threadedDummyConnection.connect();
return threadedDummyConnection;
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java b/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
index e8eb6bad9..be61be0b4 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
@@ -35,7 +35,7 @@ public class DigestMd5SaslTest extends AbstractSaslTest {
super(saslMechanism);
}
- protected void runTest() throws NotConnectedException, SmackException {
+ protected void runTest() throws NotConnectedException, SmackException, InterruptedException {
saslMechanism.authenticate("florian", "irrelevant", "xmpp.org", "secret");
byte[] response = saslMechanism.evaluateChallenge(challengeBytes);
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 28deec887..06fa6cbe7 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
@@ -580,7 +580,7 @@ public class EnhancedDebugger implements SmackDebugger {
try {
connection.sendPacket(packetToSend);
}
- catch (NotConnectedException e1) {
+ catch (InterruptedException | NotConnectedException e1) {
e1.printStackTrace();
}
}
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 eadd71137..d07886aff 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
@@ -102,8 +102,9 @@ public class CarbonManager extends Manager {
* @throws NotConnectedException
* @throws XMPPErrorException
* @throws NoResponseException
+ * @throws InterruptedException
*/
- public boolean isSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(CarbonExtension.NAMESPACE);
}
@@ -115,8 +116,9 @@ public class CarbonManager extends Manager {
*
* @param new_state whether carbons should be enabled or disabled
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendCarbonsEnabled(final boolean new_state) throws NotConnectedException {
+ public void sendCarbonsEnabled(final boolean new_state) throws NotConnectedException, InterruptedException {
IQ setIQ = carbonsEnabledIQ(new_state);
connection().sendIqWithResponseCallback(setIQ, new PacketListener() {
@@ -137,10 +139,11 @@ public class CarbonManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
public synchronized void setCarbonsEnabled(final boolean new_state) throws NoResponseException,
- XMPPErrorException, NotConnectedException {
+ XMPPErrorException, NotConnectedException, InterruptedException {
if (enabled_state == new_state)
return;
@@ -155,8 +158,9 @@ public class CarbonManager extends Manager {
*
* @throws XMPPException
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public void enableCarbons() throws XMPPException, SmackException {
+ public void enableCarbons() throws XMPPException, SmackException, InterruptedException {
setCarbonsEnabled(true);
}
@@ -165,8 +169,9 @@ public class CarbonManager extends Manager {
*
* @throws XMPPException
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public void disableCarbons() throws XMPPException, SmackException {
+ public void disableCarbons() throws XMPPException, SmackException, InterruptedException {
setCarbonsEnabled(false);
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/ClientStateIndicationManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/ClientStateIndicationManager.java
index f7d2f9bc4..ad4cf5586 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/ClientStateIndicationManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/ClientStateIndicationManager.java
@@ -27,12 +27,12 @@ import org.jivesoftware.smackx.csi.packet.ClientStateIndication;
*/
public class ClientStateIndicationManager {
- public static void active(XMPPConnection connection) throws NotConnectedException {
+ public static void active(XMPPConnection connection) throws NotConnectedException, InterruptedException {
throwIaeIfNotSupported(connection);
connection.send(ClientStateIndication.Active.INSTANCE);
}
- public static void inactive(XMPPConnection connection) throws NotConnectedException {
+ public static void inactive(XMPPConnection connection) throws NotConnectedException, InterruptedException {
throwIaeIfNotSupported(connection);
connection.send(ClientStateIndication.Inactive.INSTANCE);
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java
index 20b1b4aec..b57f6c5f9 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java
@@ -56,8 +56,9 @@ public class HOXTManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(jid, NAMESPACE);
}
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java
index 944ed181a..a33402c8d 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java
@@ -64,8 +64,9 @@ public class MultipleRecipientManager {
* some XEP-33 specific features were requested.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static void send(XMPPConnection connection, Stanza packet, Collection to, Collection cc, Collection bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException
+ public static void send(XMPPConnection connection, Stanza packet, Collection to, Collection cc, Collection bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException, InterruptedException
{
send(connection, packet, to, cc, bcc, null, null, false);
}
@@ -93,9 +94,10 @@ public class MultipleRecipientManager {
* @throws FeatureNotSupportedException if special XEP-33 features where requested, but the
* server does not support them.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public static void send(XMPPConnection connection, Stanza packet, Collection to, Collection cc, Collection bcc,
- String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException {
+ String replyTo, String replyRoom, boolean noReply) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException, InterruptedException {
// Check if *only* 'to' is set and contains just *one* entry, in this case extended stanzas addressing is not
// required at all and we can send it just as normal stanza without needing to add the extension element
if (to != null && to.size() == 1 && (cc == null || cc.isEmpty()) && (bcc == null || bcc.isEmpty()) && !noReply
@@ -134,8 +136,9 @@ public class MultipleRecipientManager {
* @param reply the new message to send as a reply.
* @throws SmackException
* @throws XMPPErrorException
+ * @throws InterruptedException
*/
- public static void reply(XMPPConnection connection, Message original, Message reply) throws SmackException, XMPPErrorException
+ public static void reply(XMPPConnection connection, Message original, Message reply) throws SmackException, XMPPErrorException, InterruptedException
{
MultipleRecipientInfo info = getMultipleRecipientInfo(original);
if (info == null) {
@@ -199,7 +202,7 @@ public class MultipleRecipientManager {
}
private static void sendToIndividualRecipients(XMPPConnection connection, Stanza packet,
- Collection to, Collection cc, Collection bcc) throws NotConnectedException {
+ Collection to, Collection cc, Collection bcc) throws NotConnectedException, InterruptedException {
if (to != null) {
for (String jid : to) {
packet.setTo(jid);
@@ -222,7 +225,7 @@ public class MultipleRecipientManager {
private static void sendThroughService(XMPPConnection connection, Stanza packet, Collection to,
Collection cc, Collection bcc, String replyTo, String replyRoom, boolean noReply,
- String serviceAddress) throws NotConnectedException {
+ String serviceAddress) throws NotConnectedException, InterruptedException {
// Create multiple recipient extension
MultipleAddresses multipleAddresses = new MultipleAddresses();
if (to != null) {
@@ -273,8 +276,9 @@ public class MultipleRecipientManager {
* @throws NoResponseException if there was no response from the server.
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private static String getMultipleRecipienServiceAddress(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private static String getMultipleRecipienServiceAddress(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
List services = sdm.findServices(MultipleAddresses.NAMESPACE, true, true);
if (services.size() > 0) {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPDeliverCondition.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPDeliverCondition.java
index 6bbade9b0..c664adf1c 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPDeliverCondition.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPDeliverCondition.java
@@ -33,8 +33,9 @@ public class AMPDeliverCondition implements AMPExtension.Condition {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return AMPManager.isConditionSupported(connection, NAME);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPExpireAtCondition.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPExpireAtCondition.java
index 22e6a24d2..a9bec63dc 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPExpireAtCondition.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPExpireAtCondition.java
@@ -37,8 +37,9 @@ public class AMPExpireAtCondition implements AMPExtension.Condition {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return AMPManager.isConditionSupported(connection, NAME);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java
index acd97e48b..cfe412408 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPManager.java
@@ -86,8 +86,9 @@ public class AMPManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isActionSupported(XMPPConnection connection, AMPExtension.Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?action=" + action.toString();
return isFeatureSupportedByServer(connection, featureName, AMPExtension.NAMESPACE);
}
@@ -100,16 +101,17 @@ public class AMPManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @see AMPDeliverCondition
* @see AMPExpireAtCondition
* @see AMPMatchResourceCondition
*/
- public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isConditionSupported(XMPPConnection connection, String conditionName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String featureName = AMPExtension.NAMESPACE + "?condition=" + conditionName;
return isFeatureSupportedByServer(connection, featureName, AMPExtension.NAMESPACE);
}
- private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(node, featureName);
}
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPMatchResourceCondition.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPMatchResourceCondition.java
index 7eee27bf1..ed7a28c5f 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPMatchResourceCondition.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/AMPMatchResourceCondition.java
@@ -33,8 +33,9 @@ public class AMPMatchResourceCondition implements AMPExtension.Condition {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return AMPManager.isConditionSupported(connection, NAME);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java
index ecfb4e73f..24cbe8419 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java
@@ -92,9 +92,10 @@ public class BookmarkManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @see BookmarkedConference
*/
- public List getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
return Collections.unmodifiableList(bookmarks.getBookmarkedConferences());
}
@@ -111,9 +112,10 @@ public class BookmarkManager {
* the server.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void addBookmarkedConference(String name, String jid, boolean isAutoJoin,
- String nickname, String password) throws NoResponseException, XMPPErrorException, NotConnectedException
+ String nickname, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
retrieveBookmarks();
BookmarkedConference bookmark
@@ -143,10 +145,11 @@ public class BookmarkManager {
* retrieve the bookmarks or persist the bookmarks.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
* @throws IllegalArgumentException thrown when the conference being removed is a shared
* conference
*/
- public void removeBookmarkedConference(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void removeBookmarkedConference(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator it = bookmarks.getBookmarkedConferences().iterator();
while(it.hasNext()) {
@@ -169,8 +172,9 @@ public class BookmarkManager {
* @throws XMPPErrorException thrown when there is a problem retriving bookmarks from the server.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
return Collections.unmodifiableList(bookmarks.getBookmarkedURLS());
}
@@ -185,8 +189,9 @@ public class BookmarkManager {
* the server
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void addBookmarkedURL(String URL, String name, boolean isRSS) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void addBookmarkedURL(String URL, String name, boolean isRSS) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
List urls = bookmarks.getBookmarkedURLS();
@@ -212,8 +217,9 @@ public class BookmarkManager {
* the server.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator it = bookmarks.getBookmarkedURLS().iterator();
while(it.hasNext()) {
@@ -229,7 +235,7 @@ public class BookmarkManager {
}
}
- private Bookmarks retrieveBookmarks() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private Bookmarks retrieveBookmarks() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
synchronized(bookmarkLock) {
if(bookmarks == null) {
bookmarks = (Bookmarks) privateDataManager.getPrivateData("storage",
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamRequest.java
index 70e78129d..2593c64fc 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamRequest.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/BytestreamRequest.java
@@ -62,7 +62,8 @@ public interface BytestreamRequest {
/**
* Rejects the bytestream request by sending a reject error to the initiator.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reject() throws NotConnectedException;
+ public void reject() throws NotConnectedException, InterruptedException;
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListener.java
index be0427334..43a545578 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListener.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListener.java
@@ -54,7 +54,7 @@ class CloseListener extends AbstractIqRequestHandler {
try {
this.manager.replyItemNotFoundPacket(closeRequest);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
return null;
}
}
@@ -62,7 +62,7 @@ class CloseListener extends AbstractIqRequestHandler {
try {
ibbSession.closeByPeer(closeRequest);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
return null;
}
this.manager.getSessions().remove(closeRequest.getSessionID());
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
index c4fb9e3b7..0aeba8091 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
@@ -56,7 +56,7 @@ class DataListener implements PacketListener {
this.manager = manager;
}
- public void processPacket(Stanza packet) throws NotConnectedException {
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
Data data = (Data) packet;
InBandBytestreamSession ibbSession = this.manager.getSessions().get(
data.getDataPacketExtension().getSessionID());
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java
index e29fd0ce4..a6c97604b 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManager.java
@@ -399,8 +399,9 @@ public class InBandBytestreamManager implements BytestreamManager {
* @throws XMPPException if the user doesn't support or accept in-band bytestreams, or if the
* user prefers smaller block sizes
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public InBandBytestreamSession establishSession(String targetJID) throws XMPPException, SmackException {
+ public InBandBytestreamSession establishSession(String targetJID) throws XMPPException, SmackException, InterruptedException {
String sessionID = getNextSessionID();
return establishSession(targetJID, sessionID);
}
@@ -416,9 +417,10 @@ public class InBandBytestreamManager implements BytestreamManager {
* user prefers smaller block sizes
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public InBandBytestreamSession establishSession(String targetJID, String sessionID)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Open byteStreamRequest = new Open(sessionID, this.defaultBlockSize, this.stanza);
byteStreamRequest.setTo(targetJID);
@@ -438,8 +440,9 @@ public class InBandBytestreamManager implements BytestreamManager {
*
* @param request IQ packet that should be answered with a not-acceptable error
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void replyRejectPacket(IQ request) throws NotConnectedException {
+ protected void replyRejectPacket(IQ request) throws NotConnectedException, InterruptedException {
XMPPError xmppError = new XMPPError(XMPPError.Condition.not_acceptable);
IQ error = IQ.createErrorResponse(request, xmppError);
this.connection.sendPacket(error);
@@ -451,8 +454,9 @@ public class InBandBytestreamManager implements BytestreamManager {
*
* @param request IQ packet that should be answered with a resource-constraint error
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException {
+ protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException, InterruptedException {
XMPPError xmppError = new XMPPError(XMPPError.Condition.resource_constraint);
IQ error = IQ.createErrorResponse(request, xmppError);
this.connection.sendPacket(error);
@@ -464,8 +468,9 @@ public class InBandBytestreamManager implements BytestreamManager {
*
* @param request IQ packet that should be answered with a item-not-found error
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException {
+ protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException, InterruptedException {
XMPPError xmppError = new XMPPError(XMPPError.Condition.item_not_found);
IQ error = IQ.createErrorResponse(request, xmppError);
this.connection.sendPacket(error);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequest.java
index 1e9483e53..5fa289096 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequest.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequest.java
@@ -68,8 +68,9 @@ public class InBandBytestreamRequest implements BytestreamRequest {
*
* @return the session to send/receive data
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public InBandBytestreamSession accept() throws NotConnectedException {
+ public InBandBytestreamSession accept() throws NotConnectedException, InterruptedException {
XMPPConnection connection = this.manager.getConnection();
// create In-Band Bytestream session and store it
@@ -88,8 +89,9 @@ public class InBandBytestreamRequest implements BytestreamRequest {
* Rejects the In-Band Bytestream request by sending a reject error to the
* initiator.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reject() throws NotConnectedException {
+ public void reject() throws NotConnectedException, InterruptedException {
this.manager.replyRejectPacket(this.byteStreamRequest);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
index f5a0a1719..b6e569c08 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java
@@ -160,8 +160,9 @@ public class InBandBytestreamSession implements BytestreamSession {
*
* @param closeRequest the close request from the remote peer
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void closeByPeer(Close closeRequest) throws NotConnectedException {
+ protected void closeByPeer(Close closeRequest) throws NotConnectedException, InterruptedException {
/*
* close streams without flushing them, because stream is already considered closed on the
@@ -447,7 +448,7 @@ public class InBandBytestreamSession implements BytestreamSession {
private long lastSequence = -1;
- public void processPacket(Stanza packet) throws NotConnectedException {
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
// get data packet extension
DataPacketExtension data = ((Data) packet).getDataPacketExtension();
@@ -613,8 +614,9 @@ public class InBandBytestreamSession implements BytestreamSession {
* @param data the data packet
* @throws IOException if an I/O error occurred while sending or if the stream is closed
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected abstract void writeToXML(DataPacketExtension data) throws IOException, NotConnectedException;
+ protected abstract void writeToXML(DataPacketExtension data) throws IOException, NotConnectedException, InterruptedException;
public synchronized void write(int b) throws IOException {
if (this.isClosed) {
@@ -718,7 +720,7 @@ public class InBandBytestreamSession implements BytestreamSession {
try {
writeToXML(data);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
IOException ioException = new IOException();
ioException.initCause(e);
throw ioException;
@@ -803,7 +805,7 @@ public class InBandBytestreamSession implements BytestreamSession {
private class MessageIBBOutputStream extends IBBOutputStream {
@Override
- protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException {
+ protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException, InterruptedException {
// create message stanza containing data packet
Message message = new Message(remoteJID);
message.addExtension(data);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListener.java
index fc0dd2264..e0578fa1f 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListener.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListener.java
@@ -69,7 +69,7 @@ class InitiationListener extends AbstractIqRequestHandler {
try {
processRequest(packet);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.WARNING, "proccessRequest", e);
}
}
@@ -77,7 +77,7 @@ class InitiationListener extends AbstractIqRequestHandler {
return null;
}
- private void processRequest(Stanza packet) throws NotConnectedException {
+ private void processRequest(Stanza packet) throws NotConnectedException, InterruptedException {
Open ibbRequest = (Open) packet;
// validate that block size is within allowed range
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListener.java
index 27c8a5c11..3b86acab5 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListener.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListener.java
@@ -65,7 +65,7 @@ final class InitiationListener extends AbstractIqRequestHandler {
try {
processRequest(packet);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.WARNING, "process request", e);
}
}
@@ -74,7 +74,7 @@ final class InitiationListener extends AbstractIqRequestHandler {
return null;
}
- private void processRequest(Stanza packet) throws NotConnectedException {
+ private void processRequest(Stanza packet) throws NotConnectedException, InterruptedException {
Bytestream byteStreamRequest = (Bytestream) packet;
// ignore request if in ignore list
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
index eac999397..fcece1406 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
@@ -527,8 +527,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private boolean supportsSocks5(String targetJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private boolean supportsSocks5(String targetJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(targetJID, Bytestream.NAMESPACE);
}
@@ -540,8 +541,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* @throws XMPPErrorException if there was an error querying the XMPP server for SOCKS5 proxies
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private List determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private List determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);
List proxies = new ArrayList();
@@ -700,8 +702,9 @@ public final class Socks5BytestreamManager implements BytestreamManager {
*
* @param packet Packet that should be answered with a not-acceptable error
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void replyRejectPacket(IQ packet) throws NotConnectedException {
+ protected void replyRejectPacket(IQ packet) throws NotConnectedException, InterruptedException {
XMPPError xmppError = new XMPPError(XMPPError.Condition.not_acceptable);
IQ errorIQ = IQ.createErrorResponse(packet, xmppError);
this.connection.sendPacket(errorIQ);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java
index 28fb19c8b..71050178a 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamRequest.java
@@ -267,8 +267,9 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
/**
* Rejects the SOCKS5 Bytestream request by sending a reject error to the initiator.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reject() throws NotConnectedException {
+ public void reject() throws NotConnectedException, InterruptedException {
this.manager.replyRejectPacket(this.bytestreamRequest);
}
@@ -277,8 +278,9 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
* XMPP exception.
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private void cancelRequest() throws XMPPErrorException, NotConnectedException {
+ private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
String errorMessage = "Could not establish socket with any provided host";
XMPPError error = XMPPError.from(XMPPError.Condition.item_not_found, errorMessage);
IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiator.java
index e63aa398b..6849c4f03 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiator.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiator.java
@@ -104,9 +104,10 @@ class Socks5ClientForInitiator extends Socks5Client {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @throws SmackException if there was no response from the server.
*/
- private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Bytestream activate = createStreamHostActivation();
// if activation fails #nextResultOrThrow() throws an exception
connection.createPacketCollectorAndSend(activate).nextResultOrThrow();
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java
index 9bf3370c5..9b41096dc 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java
@@ -434,8 +434,9 @@ public class EntityCapsManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean areEntityCapsSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean areEntityCapsSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return sdm.supportsFeature(jid, NAMESPACE);
}
@@ -446,8 +447,9 @@ public class EntityCapsManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean areEntityCapsSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean areEntityCapsSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return areEntityCapsSupported(connection().getServiceName());
}
@@ -507,7 +509,7 @@ public class EntityCapsManager extends Manager {
try {
connection.sendPacket(presence);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.WARNING, "Could could not update presence with caps info", e);
}
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java
index 0dd4278e7..370cb3d1a 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java
@@ -102,8 +102,9 @@ public class ChatStateManager extends Manager {
* @param newState the new state of the chat
* @param chat the chat.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void setCurrentState(ChatState newState, Chat chat) throws NotConnectedException {
+ public void setCurrentState(ChatState newState, Chat chat) throws NotConnectedException, InterruptedException {
if(chat == null || newState == null) {
throw new IllegalArgumentException("Arguments cannot be null.");
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java
index 461f7a6ba..0b894d7ed 100755
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommand.java
@@ -211,8 +211,9 @@ public abstract class AdHocCommand {
*
* @throws XMPPErrorException if there is an error executing the command.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public abstract void execute() throws NoResponseException, XMPPErrorException, NotConnectedException;
+ public abstract void execute() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
/**
* Executes the next action of the command with the information provided in
@@ -224,8 +225,9 @@ public abstract class AdHocCommand {
* @param response the form answer of the previous stage.
* @throws XMPPErrorException if there is a problem executing the command.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public abstract void next(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException;
+ public abstract void next(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
/**
* Completes the command execution with the information provided in the
@@ -237,8 +239,9 @@ public abstract class AdHocCommand {
* @param response the form answer of the previous stage.
* @throws XMPPErrorException if there is a problem executing the command.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public abstract void complete(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException;
+ public abstract void complete(Form response) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
/**
* Goes to the previous stage. The requester is asking to re-send the
@@ -248,8 +251,9 @@ public abstract class AdHocCommand {
*
* @throws XMPPErrorException if there is a problem executing the command.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public abstract void prev() throws NoResponseException, XMPPErrorException, NotConnectedException;
+ public abstract void prev() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
/**
* Cancels the execution of the command. This can be invoked on any stage of
@@ -258,8 +262,9 @@ public abstract class AdHocCommand {
*
* @throws XMPPErrorException if there is a problem executing the command.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public abstract void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException;
+ public abstract void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException;
/**
* Returns a collection with the allowed actions based on the current stage.
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java
index e6c2add0b..b550a3670 100755
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java
@@ -175,7 +175,7 @@ public class AdHocCommandManager extends Manager {
try {
return processAdHocCommand(requestData);
}
- catch (NoResponseException | NotConnectedException e) {
+ catch (InterruptedException | NoResponseException | NotConnectedException e) {
LOGGER.log(Level.INFO, "processAdHocCommand threw exceptino", e);
return null;
}
@@ -252,8 +252,9 @@ public class AdHocCommandManager extends Manager {
* @return the discovered items.
* @throws XMPPException if the operation failed for some reason.
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public DiscoverItems discoverCommands(String jid) throws XMPPException, SmackException {
+ public DiscoverItems discoverCommands(String jid) throws XMPPException, SmackException, InterruptedException {
return serviceDiscoveryManager.discoverItems(jid, NAMESPACE);
}
@@ -263,8 +264,9 @@ public class AdHocCommandManager extends Manager {
* @param jid the full JID to publish the commands to.
* @throws XMPPException if the operation failed for some reason.
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public void publishCommands(String jid) throws XMPPException, SmackException {
+ public void publishCommands(String jid) throws XMPPException, SmackException, InterruptedException {
// Collects the commands to publish as items
DiscoverItems discoverItems = new DiscoverItems();
Collection xCommandsList = getRegisteredCommands();
@@ -318,8 +320,9 @@ public class AdHocCommandManager extends Manager {
* the packet to process.
* @throws NotConnectedException
* @throws NoResponseException
+ * @throws InterruptedException
*/
- private IQ processAdHocCommand(AdHocCommandData requestData) throws NoResponseException, NotConnectedException {
+ private IQ processAdHocCommand(AdHocCommandData requestData) throws NoResponseException, NotConnectedException, InterruptedException {
// Creates the response with the corresponding data
AdHocCommandData response = new AdHocCommandData();
response.setTo(requestData.getFrom());
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/RemoteCommand.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/RemoteCommand.java
index f4d4d96d2..ff62d5f6c 100755
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/RemoteCommand.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/RemoteCommand.java
@@ -72,17 +72,17 @@ public class RemoteCommand extends AdHocCommand {
}
@Override
- public void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(Action.cancel);
}
@Override
- public void complete(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void complete(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(Action.complete, form);
}
@Override
- public void execute() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void execute() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(Action.execute);
}
@@ -95,22 +95,23 @@ public class RemoteCommand extends AdHocCommand {
* @throws XMPPErrorException if an error occurs.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(Action.execute, form);
}
@Override
- public void next(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void next(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(Action.next, form);
}
@Override
- public void prev() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void prev() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(Action.prev);
}
- private void executeAction(Action action) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private void executeAction(Action action) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
executeAction(action, null);
}
@@ -124,8 +125,9 @@ public class RemoteCommand extends AdHocCommand {
* @throws XMPPErrorException if there is a problem executing the command.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private void executeAction(Action action, Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private void executeAction(Action action, Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// TODO: Check that all the required fields of the form were filled, if
// TODO: not throw the corresponding exeption. This will make a faster response,
// TODO: since the request is stoped before it's sent.
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
index 267bd2e11..0f0eee27d 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
@@ -475,8 +475,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverInfo discoverInfo(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public DiscoverInfo discoverInfo(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (entityID == null)
return discoverInfo(null, null);
@@ -520,8 +521,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException if the operation failed for some reason.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverInfo discoverInfo(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public DiscoverInfo discoverInfo(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Discover the entity's info
DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.get);
@@ -541,8 +543,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException if the operation failed for some reason.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverItems discoverItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public DiscoverItems discoverItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return discoverItems(entityID, null);
}
@@ -557,8 +560,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException if the operation failed for some reason.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverItems discoverItems(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public DiscoverItems discoverItems(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Discover the entity's items
DiscoverItems disco = new DiscoverItems();
disco.setType(IQ.Type.get);
@@ -580,8 +584,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean canPublishItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean canPublishItems(String entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo info = discoverInfo(entityID);
return canPublishItems(info);
}
@@ -610,8 +615,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void publishItems(String entityID, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void publishItems(String entityID, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
publishItems(entityID, null, discoverItems);
}
@@ -627,8 +633,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException if the operation failed for some reason.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
discoverItems.setType(IQ.Type.set);
discoverItems.setTo(entityID);
@@ -645,10 +652,11 @@ public class ServiceDiscoveryManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
* @since 4.1
*/
public boolean serverSupportsFeature(String feature) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
return supportsFeature(connection().getServiceName(), feature);
}
@@ -661,8 +669,9 @@ public class ServiceDiscoveryManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean supportsFeature(String jid, String feature) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean supportsFeature(String jid, String feature) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo result = discoverInfo(jid);
return result.containsFeature(feature);
}
@@ -684,9 +693,10 @@ public class ServiceDiscoveryManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List findServices(String feature, boolean stopOnFirst, boolean useCache)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List serviceAddresses = null;
String serviceName = connection().getServiceName();
if (useCache) {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java
index b93850279..312d48414 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java
@@ -79,7 +79,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
"method");
}
- public InputStream createIncomingStream(StreamInitiation initiation) throws SmackException {
+ public InputStream createIncomingStream(StreamInitiation initiation) throws SmackException, InterruptedException {
PacketCollector collector = connection.createPacketCollectorAndSend(
getInitiationPacketFilter(initiation.getFrom(), initiation.getSessionID()),
super.createInitiationAccept(initiation, getNamespaces()));
@@ -144,7 +144,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
}
public OutputStream createOutgoingStream(String streamID, String initiator, String target)
- throws SmackException, XMPPException {
+ throws SmackException, XMPPException, InterruptedException {
OutputStream stream;
try {
stream = primaryNegotiator.createOutgoingStream(streamID, initiator, target);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java
index 47d80dc5a..05931cb31 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java
@@ -163,8 +163,9 @@ public class FileTransferManager extends Manager {
*
* @param request
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException {
+ protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException, InterruptedException {
StreamInitiation initiation = request.getStreamInitiation();
// Reject as specified in XEP-95 4.2. Note that this is not to be confused with the Socks 5
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java
index 04dd26485..f678c051d 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java
@@ -181,9 +181,10 @@ public class FileTransferNegotiator extends Manager {
* there is not an appropriate stream method.
* @throws NotConnectedException
* @throws NoAcceptableTransferMechanisms
+ * @throws InterruptedException
*/
public StreamNegotiator selectStreamNegotiator(
- FileTransferRequest request) throws NotConnectedException, NoStreamMethodsOfferedException, NoAcceptableTransferMechanisms {
+ FileTransferRequest request) throws NotConnectedException, NoStreamMethodsOfferedException, NoAcceptableTransferMechanisms, InterruptedException {
StreamInitiation si = request.getStreamInitiation();
FormField streamMethodField = getStreamMethodField(si
.getFeatureNegotiationForm());
@@ -299,10 +300,11 @@ public class FileTransferNegotiator extends Manager {
* @throws NotConnectedException
* @throws NoResponseException
* @throws NoAcceptableTransferMechanisms
+ * @throws InterruptedException
*/
public StreamNegotiator negotiateOutgoingTransfer(final String userID,
final String streamID, final String fileName, final long size,
- final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms {
+ final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms, InterruptedException {
StreamInitiation si = new StreamInitiation();
si.setSessionID(streamID);
si.setMimeType(URLConnection.guessContentTypeFromName(fileName));
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferRequest.java
index 43cc7767b..75f672264 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferRequest.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferRequest.java
@@ -129,8 +129,9 @@ public class FileTransferRequest {
/**
* Rejects the file transfer request.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reject() throws NotConnectedException {
+ public void reject() throws NotConnectedException, InterruptedException {
manager.rejectIncomingFileTransfer(this);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java
index 578f5ffdd..2cee14b03 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java
@@ -63,14 +63,14 @@ public class IBBTransferNegotiator extends StreamNegotiator {
}
public OutputStream createOutgoingStream(String streamID, String initiator,
- String target) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ String target) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
InBandBytestreamSession session = this.manager.establishSession(target, streamID);
session.setCloseBothStreamsEnabled(true);
return session.getOutputStream();
}
public InputStream createIncomingStream(StreamInitiation initiation)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
/*
* In-Band Bytestream initiation listener must ignore next in-band bytestream request with
* given session ID
@@ -96,7 +96,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
return new String[] { DataPacketExtension.NAMESPACE };
}
- InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException {
+ InputStream negotiateIncomingStream(Stanza streamInitiation) throws NotConnectedException, InterruptedException {
// build In-Band Bytestream request
InBandBytestreamRequest request = new ByteStreamRequest(this.manager,
(Open) streamInitiation);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java
index 72b843936..d8e63d3db 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java
@@ -76,8 +76,9 @@ public class IncomingFileTransfer extends FileTransfer {
* @throws SmackException
* @throws XMPPErrorException If there is an error in the negotiation process an exception
* is thrown.
+ * @throws InterruptedException
*/
- public InputStream recieveFile() throws SmackException, XMPPErrorException {
+ public InputStream recieveFile() throws SmackException, XMPPErrorException, InterruptedException {
if (inputStream != null) {
throw new IllegalStateException("Transfer already negotiated!");
}
@@ -174,7 +175,7 @@ public class IncomingFileTransfer extends FileTransfer {
transferThread.start();
}
- private InputStream negotiateStream() throws SmackException, XMPPErrorException {
+ private InputStream negotiateStream() throws SmackException, XMPPErrorException, InterruptedException {
setStatus(Status.negotiating_transfer);
final StreamNegotiator streamNegotiator = negotiator
.selectStreamNegotiator(recieveRequest);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java
index 9da7e8c2e..ed7207fe1 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java
@@ -120,9 +120,10 @@ public class OutgoingFileTransfer extends FileTransfer {
* Thrown if an error occurs during the file transfer
* negotiation process.
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
public synchronized OutputStream sendFile(String fileName, long fileSize,
- String description) throws XMPPException, SmackException {
+ String description) throws XMPPException, SmackException, InterruptedException {
if (isDone() || outputStream != null) {
throw new IllegalStateException(
"The negotation process has already"
@@ -373,7 +374,7 @@ public class OutgoingFileTransfer extends FileTransfer {
}
private OutputStream negotiateStream(String fileName, long fileSize,
- String description) throws SmackException, XMPPException {
+ String description) throws SmackException, XMPPException, InterruptedException {
// Negotiate the file transfer profile
if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java
index 66df77f02..50d649857 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java
@@ -72,7 +72,7 @@ public abstract class StreamNegotiator {
return response;
}
- Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ Stanza initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
StreamInitiation response = createInitiationAccept(initiation,
getNamespaces());
@@ -134,9 +134,10 @@ public abstract class StreamNegotiator {
* exception will be thrown.
* @throws SmackException
* @throws XMPPException
+ * @throws InterruptedException
*/
public abstract OutputStream createOutgoingStream(String streamID,
- String initiator, String target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException;
+ String initiator, String target) throws XMPPErrorException, NoResponseException, SmackException, XMPPException, InterruptedException;
/**
* Returns the XMPP namespace reserved for this particular type of file
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java
index b067f4dc2..6e8b03fae 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java
@@ -231,9 +231,10 @@ public class LastActivityManager extends Manager {
* thrown if a server error has occured.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public LastActivity getLastActivity(String jid) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
LastActivity activity = new LastActivity(jid);
return (LastActivity) connection().createPacketCollectorAndSend(activity).nextResultOrThrow();
}
@@ -246,8 +247,9 @@ public class LastActivityManager extends Manager {
* @throws NotConnectedException
* @throws XMPPErrorException
* @throws NoResponseException
+ * @throws InterruptedException
*/
- public boolean isLastActivitySupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isLastActivitySupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, LastActivity.NAMESPACE);
}
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java
index 5c7b910b9..962e7efe2 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java
@@ -153,8 +153,9 @@ public class PrivateDataManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
// Create an IQ packet to get the private data.
IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
@@ -173,8 +174,9 @@ public class PrivateDataManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void setPrivateData(final PrivateData privateData) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void setPrivateData(final PrivateData privateData) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Create an IQ packet to set the private data.
IQ privateDataSet = new PrivateDataIQ(privateData);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
index c701e5105..f3296c867 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
@@ -98,8 +98,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean supportsAccountCreation() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean supportsAccountCreation() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Check if we already know that the server supports creating new accounts
if (accountCreationSupported) {
return true;
@@ -140,8 +141,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Set getAccountAttributes() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Set getAccountAttributes() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (info == null) {
getRegistrationInfo();
}
@@ -163,8 +165,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public String getAccountAttribute(String name) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public String getAccountAttribute(String name) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (info == null) {
getRegistrationInfo();
}
@@ -180,8 +183,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public String getAccountInstructions() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public String getAccountInstructions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (info == null) {
getRegistrationInfo();
}
@@ -201,8 +205,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void createAccount(String username, String password) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void createAccount(String username, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Create a map for all the required attributes, but give them blank values.
Map attributes = new HashMap();
for (String attributeName : getAccountAttributes()) {
@@ -222,10 +227,11 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException if an error occurs creating the account.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
* @see #getAccountAttributes()
*/
public void createAccount(String username, String password, Map attributes)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
attributes.put("username", username);
attributes.put("password", password);
Registration reg = new Registration(attributes);
@@ -243,8 +249,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException if an error occurs when changing the password.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Map map = new HashMap();
map.put("username",XmppStringUtils.parseLocalpart(connection().getUser()));
map.put("password",newPassword);
@@ -263,8 +270,9 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException if an error occurs when deleting the account.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Map attributes = new HashMap();
// To delete an account, we add a single attribute, "remove", that is blank.
attributes.put("remove", "");
@@ -279,17 +287,18 @@ public class AccountManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
* @throws XMPPException if an error occurs.
* @throws SmackException if there was no response from the server.
*/
- private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Registration reg = new Registration();
reg.setTo(connection().getServiceName());
info = createPacketCollectorAndSend(reg).nextResultOrThrow();
}
- private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException {
+ private PacketCollector createPacketCollectorAndSend(IQ req) throws NotConnectedException, InterruptedException {
PacketCollector collector = connection().createPacketCollectorAndSend(new PacketIDFilter(req.getStanzaId()), req);
return collector;
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java
index c060863ec..2681d9b2d 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqversion/VersionManager.java
@@ -124,7 +124,7 @@ public class VersionManager extends Manager {
}
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
Version.NAMESPACE);
}
@@ -137,9 +137,10 @@ public class VersionManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public Version getVersion(String jid) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
if (!isSupported(jid)) {
return null;
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
index 6679f3587..87d26566f 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
@@ -269,11 +269,12 @@ public class MultiUserChat {
* @throws NotConnectedException
* @throws NoResponseException
* @throws XMPPErrorException
+ * @throws InterruptedException
* @see XEP-45 7.2 Entering a Room
*/
private Presence enter(String nickname, String password, DiscussionHistory history,
long timeout) throws NotConnectedException, NoResponseException,
- XMPPErrorException {
+ XMPPErrorException, InterruptedException {
StringUtils.requireNotNullOrEmpty(nickname, "Nickname must not be null or blank.");
// We enter a room by sending a presence packet where the "to"
// field is in the form "roomName@service/nickname"
@@ -310,7 +311,7 @@ public class MultiUserChat {
try {
presence = connection.createPacketCollectorAndSend(responseFilter, joinPresence).nextResultOrThrow(timeout);
}
- catch (NoResponseException | XMPPErrorException e) {
+ catch (InterruptedException | NoResponseException | XMPPErrorException e) {
// Ensure that all callbacks are removed if there is an exception
removeConnectionCallbacks();
throw e;
@@ -345,8 +346,9 @@ public class MultiUserChat {
* @throws NoResponseException if there was no response from the server.
* @throws SmackException If the creation failed because of a missing acknowledge from the
* server, e.g. because the room already existed.
+ * @throws InterruptedException
*/
- public synchronized void create(String nickname) throws NoResponseException, XMPPErrorException, SmackException {
+ public synchronized void create(String nickname) throws NoResponseException, XMPPErrorException, SmackException, InterruptedException {
if (joined) {
throw new IllegalStateException("Creation failed - User already joined the room.");
}
@@ -369,10 +371,11 @@ public class MultiUserChat {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws SmackException
+ * @throws InterruptedException
* @see #createOrJoin(String, String, DiscussionHistory, long)
*/
public synchronized boolean createOrJoin(String nickname) throws NoResponseException, XMPPErrorException,
- SmackException {
+ SmackException, InterruptedException {
return createOrJoin(nickname, null, null, connection.getPacketReplyTimeout());
}
@@ -390,9 +393,10 @@ public class MultiUserChat {
* @throws XMPPErrorException if the room couldn't be created for some reason (e.g. 405 error if
* the user is not allowed to create the room)
* @throws NoResponseException if there was no response from the server.
+ * @throws InterruptedException
*/
public synchronized boolean createOrJoin(String nickname, String password, DiscussionHistory history, long timeout)
- throws NoResponseException, XMPPErrorException, SmackException {
+ throws NoResponseException, XMPPErrorException, SmackException, InterruptedException {
if (joined) {
throw new IllegalStateException("Creation failed - User already joined the room.");
}
@@ -425,8 +429,9 @@ public class MultiUserChat {
* 409 error can occur if someone is already in the group chat with the same nickname.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void join(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void join(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
join(nickname, null, null, connection.getPacketReplyTimeout());
}
@@ -449,8 +454,9 @@ public class MultiUserChat {
* 407 error can occur if user is not on the member list; or a
* 409 error can occur if someone is already in the group chat with the same nickname.
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public void join(String nickname, String password) throws XMPPErrorException, SmackException {
+ public void join(String nickname, String password) throws XMPPErrorException, SmackException, InterruptedException {
join(nickname, password, null, connection.getPacketReplyTimeout());
}
@@ -480,13 +486,14 @@ public class MultiUserChat {
* 409 error can occur if someone is already in the group chat with the same nickname.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public synchronized void join(
String nickname,
String password,
DiscussionHistory history,
long timeout)
- throws XMPPErrorException, NoResponseException, NotConnectedException {
+ throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
// If we've already joined the room, leave it before joining under a new
// nickname.
if (joined) {
@@ -508,8 +515,9 @@ public class MultiUserChat {
/**
* Leave the chat room.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public synchronized void leave() throws NotConnectedException {
+ public synchronized void leave() throws NotConnectedException, InterruptedException {
// If not joined already, do nothing.
if (!joined) {
return;
@@ -536,8 +544,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs asking the configuration form for the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCOwner iq = new MUCOwner();
iq.setTo(room);
iq.setType(IQ.Type.get);
@@ -555,8 +564,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs setting the new rooms' configuration.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCOwner iq = new MUCOwner();
iq.setTo(room);
iq.setType(IQ.Type.set);
@@ -580,8 +590,9 @@ public class MultiUserChat {
* 405 error if the user is not allowed to register with the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Registration reg = new Registration();
reg.setType(IQ.Type.get);
reg.setTo(room);
@@ -605,8 +616,9 @@ public class MultiUserChat {
* or a 503 error can occur if the room does not support registration.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendRegistrationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void sendRegistrationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Registration reg = new Registration();
reg.setType(IQ.Type.set);
reg.setTo(room);
@@ -628,8 +640,9 @@ public class MultiUserChat {
* appropiate error messages to end-users.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void destroy(String reason, String alternateJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void destroy(String reason, String alternateJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCOwner iq = new MUCOwner();
iq.setTo(room);
iq.setType(IQ.Type.set);
@@ -659,8 +672,9 @@ public class MultiUserChat {
* @param user the user to invite to the room.(e.g. hecate@shakespeare.lit)
* @param reason the reason why the user is being invited.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void invite(String user, String reason) throws NotConnectedException {
+ public void invite(String user, String reason) throws NotConnectedException, InterruptedException {
invite(new Message(), user, reason);
}
@@ -675,8 +689,9 @@ public class MultiUserChat {
* @param user the user to invite to the room.(e.g. hecate@shakespeare.lit)
* @param reason the reason why the user is being invited.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void invite(Message message, String user, String reason) throws NotConnectedException {
+ public void invite(Message message, String user, String reason) throws NotConnectedException, InterruptedException {
// TODO listen for 404 error code when inviter supplies a non-existent JID
message.setTo(room);
@@ -800,8 +815,9 @@ public class MultiUserChat {
*
* @return the reserved room nickname or null if none.
* @throws SmackException if there was no response from the server.
+ * @throws InterruptedException
*/
- public String getReservedNickname() throws SmackException {
+ public String getReservedNickname() throws SmackException, InterruptedException {
try {
DiscoverInfo result =
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(
@@ -840,8 +856,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if the new nickname is already in use by another occupant.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void changeNickname(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void changeNickname(String nickname) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
StringUtils.requireNotNullOrEmpty(nickname, "Nickname must not be null or blank.");
// Check that we already have joined the room before attempting to change the
// nickname.
@@ -875,8 +892,9 @@ public class MultiUserChat {
* @param status a text message describing the presence update.
* @param mode the mode type for the presence update.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException {
+ public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException, InterruptedException {
StringUtils.requireNotNullOrEmpty(nickname, "Nickname must not be null or blank.");
// Check that we already have joined the room before attempting to change the
// availability status.
@@ -914,8 +932,9 @@ public class MultiUserChat {
* 400 error can occur if the provided nickname is not present in the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void kickParticipant(String nickname, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void kickParticipant(String nickname, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nickname, MUCRole.none, reason);
}
@@ -923,11 +942,12 @@ public class MultiUserChat {
* Sends a voice request to the MUC. The room moderators usually need to approve this request.
*
* @throws NotConnectedException
+ * @throws InterruptedException
* @see XEP-45 § 7.13 Requesting
* Voice
* @since 4.1
*/
- public void requestVoice() throws NotConnectedException {
+ public void requestVoice() throws NotConnectedException, InterruptedException {
DataForm form = new DataForm(DataForm.Type.submit);
FormField formTypeField = new FormField(FormField.FORM_TYPE);
formTypeField.addValue(MUCInitialPresence.NAMESPACE + "#request");
@@ -954,8 +974,9 @@ public class MultiUserChat {
* 400 error can occur if the provided nickname is not present in the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantVoice(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantVoice(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nicknames, MUCRole.participant);
}
@@ -971,8 +992,9 @@ public class MultiUserChat {
* 400 error can occur if the provided nickname is not present in the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nickname, MUCRole.participant, null);
}
@@ -988,8 +1010,9 @@ public class MultiUserChat {
* 400 error can occur if the provided nickname is not present in the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeVoice(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeVoice(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nicknames, MUCRole.visitor);
}
@@ -1005,8 +1028,9 @@ public class MultiUserChat {
* 400 error can occur if the provided nickname is not present in the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeVoice(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nickname, MUCRole.visitor, null);
}
@@ -1023,8 +1047,9 @@ public class MultiUserChat {
* was tried to be banned (i.e. Not Allowed error).
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void banUsers(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void banUsers(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.outcast);
}
@@ -1042,8 +1067,9 @@ public class MultiUserChat {
* was tried to be banned (i.e. Not Allowed error).
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void banUser(String jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void banUser(String jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.outcast, reason);
}
@@ -1056,8 +1082,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting membership to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantMembership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantMembership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.member);
}
@@ -1070,8 +1097,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting membership to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.member, null);
}
@@ -1085,8 +1113,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking membership to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeMembership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeMembership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.none);
}
@@ -1100,8 +1129,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking membership to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeMembership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.none, null);
}
@@ -1114,8 +1144,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting moderator privileges to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantModerator(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantModerator(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nicknames, MUCRole.moderator);
}
@@ -1128,8 +1159,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting moderator privileges to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nickname, MUCRole.moderator, null);
}
@@ -1143,8 +1175,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking moderator privileges from a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeModerator(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeModerator(Collection nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nicknames, MUCRole.participant);
}
@@ -1158,8 +1191,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking moderator privileges from a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeModerator(String nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeRole(nickname, MUCRole.participant, null);
}
@@ -1173,8 +1207,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting ownership privileges to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantOwnership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantOwnership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.owner);
}
@@ -1188,8 +1223,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting ownership privileges to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.owner, null);
}
@@ -1202,8 +1238,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking ownership privileges from a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeOwnership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeOwnership(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.admin);
}
@@ -1216,8 +1253,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking ownership privileges from a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeOwnership(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.admin, null);
}
@@ -1230,8 +1268,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting administrator privileges to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantAdmin(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantAdmin(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.admin);
}
@@ -1245,8 +1284,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs granting administrator privileges to a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void grantAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void grantAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.admin);
}
@@ -1259,8 +1299,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking administrator privileges from a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeAdmin(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeAdmin(Collection jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jids, MUCAffiliation.admin);
}
@@ -1274,8 +1315,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if an error occurs revoking administrator privileges from a user.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void revokeAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException {
+ public void revokeAdmin(String jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.member);
}
@@ -1287,10 +1329,11 @@ public class MultiUserChat {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
private void changeAffiliationByAdmin(String jid, MUCAffiliation affiliation)
throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, affiliation, null);
}
@@ -1303,8 +1346,9 @@ public class MultiUserChat {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private void changeAffiliationByAdmin(String jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
+ private void changeAffiliationByAdmin(String jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
@@ -1317,7 +1361,7 @@ public class MultiUserChat {
}
private void changeAffiliationByAdmin(Collection jids, MUCAffiliation affiliation)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
iq.setType(IQ.Type.set);
@@ -1330,7 +1374,7 @@ public class MultiUserChat {
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
}
- private void changeRole(String nickname, MUCRole role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private void changeRole(String nickname, MUCRole role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
iq.setType(IQ.Type.set);
@@ -1341,7 +1385,7 @@ public class MultiUserChat {
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
}
- private void changeRole(Collection nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private void changeRole(Collection nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
iq.setType(IQ.Type.set);
@@ -1445,8 +1489,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getOwners() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getOwners() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliatesByAdmin(MUCAffiliation.owner);
}
@@ -1457,8 +1502,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getAdmins() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getAdmins() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliatesByAdmin(MUCAffiliation.admin);
}
@@ -1469,8 +1515,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getMembers() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getMembers() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliatesByAdmin(MUCAffiliation.member);
}
@@ -1481,8 +1528,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getOutcasts() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getOutcasts() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliatesByAdmin(MUCAffiliation.outcast);
}
@@ -1495,8 +1543,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private List getAffiliatesByAdmin(MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private List getAffiliatesByAdmin(MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
iq.setType(IQ.Type.get);
@@ -1521,8 +1570,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getModerators() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getModerators() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getOccupants(MUCRole.moderator);
}
@@ -1533,8 +1583,9 @@ public class MultiUserChat {
* @throws XMPPErrorException if you don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getParticipants() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getParticipants() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getOccupants(MUCRole.participant);
}
@@ -1547,8 +1598,9 @@ public class MultiUserChat {
* don't have enough privileges to get this information.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private List getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private List getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCAdmin iq = new MUCAdmin();
iq.setTo(room);
iq.setType(IQ.Type.get);
@@ -1571,8 +1623,9 @@ public class MultiUserChat {
* @param text the text of the message to send.
* @throws XMPPException if sending the message fails.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendMessage(String text) throws XMPPException, NotConnectedException {
+ public void sendMessage(String text) throws XMPPException, NotConnectedException, InterruptedException {
Message message = createMessage();
message.setBody(text);
connection.sendPacket(message);
@@ -1608,8 +1661,9 @@ public class MultiUserChat {
* @param message the message.
* @throws XMPPException if sending the message fails.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendMessage(Message message) throws XMPPException, NotConnectedException {
+ public void sendMessage(Message message) throws XMPPException, NotConnectedException, InterruptedException {
message.setTo(room);
message.setType(Message.Type.groupchat);
connection.sendPacket(message);
@@ -1640,8 +1694,9 @@ public class MultiUserChat {
*
* @return the next message.
* @throws MUCNotJoinedException
+ * @throws InterruptedException
*/
- public Message nextMessage() throws MUCNotJoinedException {
+ public Message nextMessage() throws MUCNotJoinedException, InterruptedException {
if (messageCollector == null) {
throw new MUCNotJoinedException(this);
}
@@ -1657,8 +1712,9 @@ public class MultiUserChat {
* @return the next message, or null if the timeout elapses without a
* message becoming available.
* @throws MUCNotJoinedException
+ * @throws InterruptedException
*/
- public Message nextMessage(long timeout) throws MUCNotJoinedException {
+ public Message nextMessage(long timeout) throws MUCNotJoinedException, InterruptedException {
if (messageCollector == null) {
throw new MUCNotJoinedException(this);
}
@@ -1702,8 +1758,9 @@ public class MultiUserChat {
* room subject will throw an error with code 403 (i.e. Forbidden)
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void changeSubject(final String subject) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void changeSubject(final String subject) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Message message = createMessage();
message.setSubject(subject);
// Wait for an error or confirmation message back from the server.
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java
index be0a414f5..f55ba50b8 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java
@@ -174,8 +174,9 @@ public class MultiUserChatManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean isServiceEnabled(String user) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isServiceEnabled(String user) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(user, MUCInitialPresence.NAMESPACE);
}
@@ -198,9 +199,10 @@ public class MultiUserChatManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List getJoinedRooms(String user) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
// Send the disco packet to the user
DiscoverItems result = ServiceDiscoveryManager.getInstanceFor(connection()).discoverItems(user, DISCO_NODE);
List items = result.getItems();
@@ -221,8 +223,9 @@ public class MultiUserChatManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public RoomInfo getRoomInfo(String room) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public RoomInfo getRoomInfo(String room) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection()).discoverInfo(room);
return new RoomInfo(info);
}
@@ -234,8 +237,9 @@ public class MultiUserChatManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false);
}
@@ -250,9 +254,10 @@ public class MultiUserChatManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List getHostedRooms(String serviceName) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection());
DiscoverItems discoverItems = discoManager.discoverItems(serviceName);
List items = discoverItems.getItems();
@@ -271,8 +276,9 @@ public class MultiUserChatManager extends Manager {
* @param inviter the inviter of the declined invitation.
* @param reason the reason why the invitee is declining the invitation.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void decline(String room, String inviter, String reason) throws NotConnectedException {
+ public void decline(String room, String inviter, String reason) throws NotConnectedException, InterruptedException {
Message message = new Message(room);
// Create the MUCUser packet that will include the rejection
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
index 8fdf948d0..0e84e6956 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
@@ -76,8 +76,9 @@ public class OfflineMessageManager {
* @throws XMPPErrorException If the user is not allowed to make this request.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean supportsFlexibleRetrieval() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean supportsFlexibleRetrieval() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).serverSupportsFeature(namespace);
}
@@ -89,8 +90,9 @@ public class OfflineMessageManager {
* not support offline message retrieval.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(null,
namespace);
Form extendedInfo = Form.getFormFrom(info);
@@ -112,8 +114,9 @@ public class OfflineMessageManager {
* not support offline message retrieval.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List answer = new ArrayList();
DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
null, namespace);
@@ -136,8 +139,9 @@ public class OfflineMessageManager {
* not support offline message retrieval.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getMessages(final List nodes) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getMessages(final List nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List messages = new ArrayList();
OfflineMessageRequest request = new OfflineMessageRequest();
for (String node : nodes) {
@@ -180,8 +184,9 @@ public class OfflineMessageManager {
* not support offline message retrieval.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
OfflineMessageRequest request = new OfflineMessageRequest();
request.setFetch(true);
@@ -219,8 +224,9 @@ public class OfflineMessageManager {
* not support offline message retrieval.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteMessages(List nodes) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void deleteMessages(List nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
OfflineMessageRequest request = new OfflineMessageRequest();
for (String node : nodes) {
OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node);
@@ -237,8 +243,9 @@ public class OfflineMessageManager {
* not support offline message retrieval.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteMessages() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void deleteMessages() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
OfflineMessageRequest request = new OfflineMessageRequest();
request.setPurge(true);
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
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 3e476b047..0be4e1b51 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
@@ -107,8 +107,9 @@ public class PEPManager {
*
* @param item the item to publish.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void publish(PEPItem item) throws NotConnectedException {
+ public void publish(PEPItem item) throws NotConnectedException, InterruptedException {
// Create a new message to publish the event.
PEPPubSub pubSub = new PEPPubSub(item);
pubSub.setType(Type.set);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java
index 35d9d8593..a8c572827 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/ping/PingManager.java
@@ -155,8 +155,9 @@ public class PingManager extends Manager {
* @return true if a reply was received from the entity, false otherwise.
* @throws NoResponseException if there was no response from the jid.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean ping(String jid, long pingTimeout) throws NotConnectedException, NoResponseException {
+ public boolean ping(String jid, long pingTimeout) throws NotConnectedException, NoResponseException, InterruptedException {
final XMPPConnection connection = connection();
// Packet collector for IQs needs an connection that was at least authenticated once,
// otherwise the client JID will be null causing an NPE
@@ -181,8 +182,9 @@ public class PingManager extends Manager {
* @return true if a reply was received from the entity, false otherwise.
* @throws NotConnectedException
* @throws NoResponseException if there was no response from the jid.
+ * @throws InterruptedException
*/
- public boolean ping(String jid) throws NotConnectedException, NoResponseException {
+ public boolean ping(String jid) throws NotConnectedException, NoResponseException, InterruptedException {
return ping(jid, connection().getPacketReplyTimeout());
}
@@ -194,8 +196,9 @@ public class PingManager extends Manager {
* @throws XMPPErrorException An XMPP related error occurred during the request
* @throws NoResponseException if there was no response from the jid.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean isPingSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isPingSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, Ping.NAMESPACE);
}
@@ -208,8 +211,9 @@ public class PingManager extends Manager {
*
* @return true if a reply was received from the server, false otherwise.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean pingMyServer() throws NotConnectedException {
+ public boolean pingMyServer() throws NotConnectedException, InterruptedException {
return pingMyServer(true);
}
@@ -223,8 +227,9 @@ public class PingManager extends Manager {
* @param notifyListeners Notify the PingFailedListener in case of error if true
* @return true if the user's server could be pinged.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean pingMyServer(boolean notifyListeners) throws NotConnectedException {
+ public boolean pingMyServer(boolean notifyListeners) throws NotConnectedException, InterruptedException {
return pingMyServer(notifyListeners, connection().getPacketReplyTimeout());
}
@@ -239,8 +244,9 @@ public class PingManager extends Manager {
* @param pingTimeout The time to wait for a reply in milliseconds
* @return true if the user's server could be pinged.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException {
+ public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException, InterruptedException {
boolean res;
try {
res = ping(connection().getServiceName(), pingTimeout);
@@ -369,8 +375,8 @@ public class PingManager extends Manager {
try {
res = pingMyServer(false);
}
- catch (SmackException e) {
- LOGGER.log(Level.WARNING, "SmackError while pinging server", e);
+ catch (InterruptedException | SmackException e) {
+ LOGGER.log(Level.WARNING, "Exception while pinging server", e);
res = false;
}
// stop when we receive a pong back
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 3b539d918..6db69d748 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
@@ -224,8 +224,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private Privacy getRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private Privacy getRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request is a get iq type
requestPrivacy.setType(Privacy.Type.get);
@@ -242,8 +243,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private Stanza setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private Stanza setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request is a get iq type
requestPrivacy.setType(Privacy.Type.set);
@@ -257,8 +259,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private Privacy getPrivacyWithListNames() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private Privacy getPrivacyWithListNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an empty privacy message
Privacy request = new Privacy();
@@ -273,8 +276,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = this.getPrivacyWithListNames();
String listName = privacyAnswer.getActiveName();
boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getDefaultName());
@@ -288,9 +292,10 @@ public class PrivacyListManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
* @since 4.1
*/
- public String getActiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public String getActiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (cachedActiveListName != null) {
return cachedActiveListName;
}
@@ -304,8 +309,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = this.getPrivacyWithListNames();
String listName = privacyAnswer.getDefaultName();
boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getActiveName());
@@ -319,9 +325,10 @@ public class PrivacyListManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
* @since 4.1
*/
- public String getDefaultListName() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public String getDefaultListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (cachedDefaultListName != null) {
return cachedDefaultListName;
}
@@ -339,9 +346,10 @@ public class PrivacyListManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
* @since 4.1
*/
- public String getEffectiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public String getEffectiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
String activeListName = getActiveListName();
if (activeListName != null) {
return activeListName;
@@ -357,8 +365,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private List getPrivacyListItems(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private List getPrivacyListItems(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setPrivacyList(listName, new ArrayList());
@@ -377,8 +386,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return new PrivacyList(false, false, listName, getPrivacyListItems(listName));
}
@@ -389,8 +399,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = getPrivacyWithListNames();
Set names = privacyAnswer.getPrivacyListNames();
List lists = new ArrayList<>(names.size());
@@ -410,8 +421,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setActiveName(listName);
@@ -425,8 +437,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void declineActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void declineActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineActiveList(true);
@@ -442,8 +455,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void setDefaultListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void setDefaultListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDefaultName(listName);
@@ -457,8 +471,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineDefaultList(true);
@@ -475,8 +490,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void createPrivacyList(String listName, List privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void createPrivacyList(String listName, List privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
updatePrivacyList(listName, privacyItems);
}
@@ -490,8 +506,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void updatePrivacyList(String listName, List privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void updatePrivacyList(String listName, List privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Build the privacy package to add or update the new list
Privacy request = new Privacy();
request.setPrivacyList(listName, privacyItems);
@@ -507,8 +524,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setPrivacyList(listName, new ArrayList());
@@ -545,8 +563,9 @@ public class PrivacyListManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException{
+ public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException{
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(NAMESPACE);
}
}
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 ee9aa2777..891782e97 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
@@ -52,8 +52,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverItems discoverItems() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public DiscoverItems discoverItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
DiscoverItems items = new DiscoverItems();
items.setTo(to);
@@ -68,8 +69,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getItems() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
return getItems((List) null, (List) null);
}
@@ -85,8 +87,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId));
return getItems(request);
@@ -105,8 +108,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getItems(Collection ids) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getItems(Collection ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
List- itemList = new ArrayList
- (ids.size());
@@ -127,8 +131,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), maxItems));
return getItems(request);
@@ -146,8 +151,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId, maxItems));
return getItems(request);
@@ -168,24 +174,25 @@ public class LeafNode extends Node
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List getItems(List additionalExtensions,
List returnedExtensions) throws NoResponseException,
- XMPPErrorException, NotConnectedException {
+ XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
request.addExtensions(additionalExtensions);
return getItems(request, returnedExtensions);
}
private List getItems(PubSub request) throws NoResponseException,
- XMPPErrorException, NotConnectedException {
+ XMPPErrorException, NotConnectedException, InterruptedException {
return getItems(request, null);
}
@SuppressWarnings("unchecked")
private List getItems(PubSub request,
List returnedExtensions) throws NoResponseException,
- XMPPErrorException, NotConnectedException {
+ XMPPErrorException, NotConnectedException, InterruptedException {
PubSub result = con.createPacketCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
if (returnedExtensions != null) {
@@ -206,8 +213,9 @@ public class LeafNode extends Node
*
* For synchronous calls use {@link #send() send()}.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void publish() throws NotConnectedException
+ public void publish() throws NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
@@ -229,9 +237,10 @@ public class LeafNode extends Node
*
* @param item - The item being sent
* @throws NotConnectedException
+ * @throws InterruptedException
*/
@SuppressWarnings("unchecked")
- public void publish(T item) throws NotConnectedException
+ public void publish(T item) throws NotConnectedException, InterruptedException
{
Collection items = new ArrayList(1);
items.add((T)(item == null ? new Item() : item));
@@ -251,8 +260,9 @@ public class LeafNode extends Node
*
* @param items - The collection of items being sent
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void publish(Collection items) throws NotConnectedException
+ public void publish(Collection items) throws NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new PublishItem(getId(), items));
@@ -273,9 +283,10 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
- public void send() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void send() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
@@ -303,10 +314,11 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
@SuppressWarnings("unchecked")
- public void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
Collection items = new ArrayList(1);
items.add((item == null ? (T)new Item() : item));
@@ -328,9 +340,10 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
- public void send(Collection items) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void send(Collection items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new PublishItem(getId(), items));
@@ -345,8 +358,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace());
@@ -360,8 +374,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
Collection items = new ArrayList(1);
items.add(itemId);
@@ -375,8 +390,9 @@ public class LeafNode extends Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteItem(Collection itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void deleteItem(Collection itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
List
- items = new ArrayList
- (itemIds.size());
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 8c4a57900..239fb84f6 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
@@ -95,8 +95,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ConfigureForm getNodeConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public ConfigureForm getNodeConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(
PubSubElementType.CONFIGURE_OWNER, getId()), PubSubNamespace.OWNER);
@@ -111,8 +112,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
getId(), submitForm), PubSubNamespace.OWNER);
@@ -126,8 +128,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverInfo discoverInfo() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public DiscoverInfo discoverInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
@@ -142,9 +145,10 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
- public List getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
return getSubscriptions(null, null);
}
@@ -163,9 +167,10 @@ abstract public class Node
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List getSubscriptions(List additionalExtensions, Collection returnedExtensions)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getSubscriptions(additionalExtensions, returnedExtensions, null);
}
@@ -176,11 +181,12 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @see #getSubscriptionsAsOwner(List, Collection)
* @since 4.1
*/
public List getSubscriptionsAsOwner() throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
return getSubscriptionsAsOwner(null, null);
}
@@ -202,19 +208,20 @@ abstract public class Node
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
* @see XEP-60 § 8.8.1 -
* Retrieve Subscriptions List
* @since 4.1
*/
public List getSubscriptionsAsOwner(List additionalExtensions,
Collection returnedExtensions) throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
return getSubscriptions(additionalExtensions, returnedExtensions, PubSubNamespace.OWNER);
}
private List getSubscriptions(List additionalExtensions,
Collection returnedExtensions, PubSubNamespace pubSubNamespace)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId()), pubSubNamespace);
if (additionalExtensions != null) {
for (PacketExtension pe : additionalExtensions) {
@@ -236,9 +243,10 @@ abstract public class Node
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List getAffiliations() throws NoResponseException, XMPPErrorException,
- NotConnectedException {
+ NotConnectedException, InterruptedException {
return getAffiliations(null, null);
}
@@ -256,9 +264,10 @@ abstract public class Node
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public List getAffiliations(List additionalExtensions, Collection returnedExtensions)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS, getId()));
if (additionalExtensions != null) {
for (PacketExtension pe : additionalExtensions) {
@@ -289,8 +298,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub pubSub = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
PubSub reply = sendPubsubPacket(pubSub);
@@ -314,8 +324,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
@@ -332,9 +343,10 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
- public void unsubscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void unsubscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
unsubscribe(jid, null);
}
@@ -347,8 +359,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId)));
}
@@ -361,8 +374,9 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public SubscribeForm getSubscriptionOptions(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public SubscribeForm getSubscriptionOptions(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
return getSubscriptionOptions(jid, null);
}
@@ -378,9 +392,10 @@ abstract public class Node
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
- public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId)));
FormNode ext = packet.getExtension(PubSubElementType.OPTIONS);
@@ -486,7 +501,7 @@ abstract public class Node
return PubSub.createPubsubPacket(to, type, ext, ns);
}
- protected PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException
+ protected PubSub sendPubsubPacket(PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
return PubSubManager.sendPubsubPacket(con, packet);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
index 5c12865bf..9ba220a69 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
@@ -86,8 +86,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null);
NodeExtension elem = reply.getExtension("create", PubSubNamespace.BASIC.getXmlns());
@@ -108,8 +109,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public LeafNode createNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public LeafNode createNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
return (LeafNode)createNode(id, null);
}
@@ -126,8 +128,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub request = PubSub.createPubsubPacket(to, Type.set, new NodeExtension(PubSubElementType.CREATE, name), null);
boolean isLeafNode = true;
@@ -160,9 +163,10 @@ final public class PubSubManager
* @throws XMPPErrorException The node does not exist
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
@SuppressWarnings("unchecked")
- public T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
Node node = nodeMap.get(id);
@@ -211,8 +215,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverItems discoverNodes(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public DiscoverItems discoverNodes(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
DiscoverItems items = new DiscoverItems();
@@ -230,8 +235,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
Stanza reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null);
SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
@@ -245,9 +251,10 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*
*/
- public List getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public List getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS), null);
AffiliationsExtension listElem = reply.getExtension(PubSubElementType.AFFILIATIONS);
@@ -261,8 +268,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace());
nodeMap.remove(nodeId);
@@ -275,8 +283,9 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ConfigureForm getDefaultConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public ConfigureForm getDefaultConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
// Errors will cause exceptions in getReply, so it only returns
// on success.
@@ -292,19 +301,20 @@ final public class PubSubManager
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public DiscoverInfo getSupportedFeatures() throws NoResponseException, XMPPErrorException, NotConnectedException
+ public DiscoverInfo getSupportedFeatures() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
ServiceDiscoveryManager mgr = ServiceDiscoveryManager.getInstanceFor(con);
return mgr.discoverInfo(to);
}
private PubSub sendPubsubPacket(Type type, PacketExtension ext, PubSubNamespace ns)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return sendPubsubPacket(con, to, type, Collections.singletonList(ext), ns);
}
- static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException
+ static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub pubSub = new PubSub(to, type, ns);
for (PacketExtension pe : extList) {
@@ -313,7 +323,7 @@ final public class PubSubManager
return sendPubsubPacket(con ,pubSub);
}
- static PubSub sendPubsubPacket(XMPPConnection con, PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException
+ static PubSub sendPubsubPacket(XMPPConnection con, PubSub packet) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
IQ resultIQ = con.createPacketCollectorAndSend(packet).nextResultOrThrow();
if (resultIQ instanceof EmptyResultIQ) {
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java
index 7393c4bd5..bed43508c 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java
@@ -141,7 +141,7 @@ public class DeliveryReceiptManager extends Manager {
// Add the packet listener to handle incoming delivery receipt requests
connection.addAsyncPacketListener(new PacketListener() {
@Override
- public void processPacket(Stanza packet) throws NotConnectedException {
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
final String from = packet.getFrom();
final XMPPConnection connection = connection();
switch (autoReceiptMode) {
@@ -188,8 +188,9 @@ public class DeliveryReceiptManager extends Manager {
* @return true if supported
* @throws SmackException if there was no response from the server.
* @throws XMPPException
+ * @throws InterruptedException
*/
- public boolean isSupported(String jid) throws SmackException, XMPPException {
+ public boolean isSupported(String jid) throws SmackException, XMPPException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
DeliveryReceipt.NAMESPACE);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java
index 5c58aa6dd..f0aa55664 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java
@@ -64,8 +64,9 @@ public class UserSearch extends SimpleIQ {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
UserSearch search = new UserSearch();
search.setType(IQ.Type.get);
search.setTo(searchService);
@@ -84,8 +85,9 @@ public class UserSearch extends SimpleIQ {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
UserSearch search = new UserSearch();
search.setType(IQ.Type.set);
search.setTo(searchService);
@@ -105,8 +107,9 @@ public class UserSearch extends SimpleIQ {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
SimpleUserSearch search = new SimpleUserSearch();
search.setForm(searchForm);
search.setType(IQ.Type.set);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java
index 4b3bcaf6a..3d2944fb8 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java
@@ -66,8 +66,9 @@ public class UserSearchManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Form getSearchForm(String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Form getSearchForm(String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return userSearch.getSearchForm(con, searchService);
}
@@ -81,8 +82,9 @@ public class UserSearchManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ReportedData getSearchResults(Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public ReportedData getSearchResults(Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return userSearch.sendSearchForm(con, searchForm, searchService);
}
@@ -94,8 +96,9 @@ public class UserSearchManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public List getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con);
return discoManager.findServices(UserSearch.NAMESPACE, false, false);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/sharedgroups/SharedGroupManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/sharedgroups/SharedGroupManager.java
index 1900b25a7..53d0adeb2 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/sharedgroups/SharedGroupManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/sharedgroups/SharedGroupManager.java
@@ -44,8 +44,9 @@ public class SharedGroupManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static List getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static List getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Discover the shared groups of the logged user
SharedGroupsInfo info = new SharedGroupsInfo();
info.setType(IQ.Type.get);
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java
index 5af549fc2..03ee6e078 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/time/EntityTimeManager.java
@@ -99,11 +99,11 @@ public class EntityTimeManager extends Manager {
enabled = false;
}
- public boolean isTimeSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isTimeSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, Time.NAMESPACE);
}
- public Time getTime(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Time getTime(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!isTimeSupported(jid))
return null;
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/VCardManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/VCardManager.java
index bc7bf47eb..23f99e33e 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/VCardManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/VCardManager.java
@@ -70,10 +70,11 @@ public class VCardManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @deprecated use {@link #isSupported(String)} instead.
*/
@Deprecated
- public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return VCardManager.getInstanceFor(connection).isSupported(jid);
}
@@ -89,8 +90,9 @@ public class VCardManager extends Manager {
* @throws XMPPErrorException thrown if there was an issue setting the VCard in the server.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void saveVCard(VCard vcard) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void saveVCard(VCard vcard) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
vcard.setType(IQ.Type.set);
connection().createPacketCollectorAndSend(vcard).nextResultOrThrow();
}
@@ -101,8 +103,9 @@ public class VCardManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public VCard loadVCard() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public VCard loadVCard() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return loadVCard(null);
}
@@ -112,8 +115,9 @@ public class VCardManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public VCard loadVCard(String bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public VCard loadVCard(String bareJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
VCard vcardRequest = new VCard();
vcardRequest.setTo(bareJid);
VCard result = connection().createPacketCollectorAndSend(vcardRequest).nextResultOrThrow();
@@ -128,8 +132,9 @@ public class VCardManager extends Manager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, NAMESPACE);
}
}
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 303510031..08db8e932 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
@@ -523,10 +523,11 @@ public class VCard extends IQ {
* @throws XMPPErrorException thrown if there was an issue setting the VCard in the server.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
* @deprecated use {@link VCardManager#saveVCard(VCard)} instead.
*/
@Deprecated
- public void save(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void save(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
VCardManager.getInstanceFor(connection).saveVCard(this);
}
@@ -536,10 +537,11 @@ public class VCard extends IQ {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @deprecated use {@link VCardManager#loadVCard()} instead.
*/
@Deprecated
- public void load(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void load(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
load(connection, null);
}
@@ -548,10 +550,11 @@ public class VCard extends IQ {
* @throws XMPPErrorException
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
* @deprecated use {@link VCardManager#loadVCard(String)} instead.
*/
@Deprecated
- public void load(XMPPConnection connection, String user) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void load(XMPPConnection connection, String user) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
VCard result = VCardManager.getInstanceFor(connection).loadVCard(user);
copyFieldsFrom(result);
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java
index af90282a2..194b12a2d 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java
@@ -76,10 +76,11 @@ public class XDataManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
+ * @throws InterruptedException
* @see XEP-0004: Data Forms § 6. Service Discovery
* @since 4.1
*/
- public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid, NAMESPACE);
}
}
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java
index 9aea9378b..f0ac83b0c 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java
@@ -128,9 +128,10 @@ public class XHTMLManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public static boolean isServiceEnabled(XMPPConnection connection, String userID)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE);
}
}
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java
index b7c9b64fe..902e82b19 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamManagerTest.java
@@ -59,9 +59,10 @@ public class InBandBytestreamManagerTest {
* Initialize fields used in the tests.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
@Before
- public void setup() throws XMPPException, SmackException {
+ public void setup() throws XMPPException, SmackException, InterruptedException {
// build protocol verifier
protocol = new Protocol();
@@ -103,9 +104,10 @@ public class InBandBytestreamManagerTest {
* bytestream.
* @throws SmackException
* @throws XMPPException
+ * @throws InterruptedException
*/
@Test
- public void shouldFailIfTargetDoesNotSupportIBB() throws SmackException, XMPPException {
+ public void shouldFailIfTargetDoesNotSupportIBB() throws SmackException, XMPPException, InterruptedException {
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
try {
@@ -153,7 +155,7 @@ public class InBandBytestreamManagerTest {
}
@Test
- public void shouldUseConfiguredStanzaType() throws SmackException {
+ public void shouldUseConfiguredStanzaType() throws SmackException, InterruptedException {
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
byteStreamManager.setStanza(StanzaType.MESSAGE);
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java
index 057549a2c..b04ed0cf3 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamRequestTest.java
@@ -67,9 +67,10 @@ public class InBandBytestreamRequestTest {
/**
* Test reject() method.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
@Test
- public void shouldReplyWithErrorIfRequestIsRejected() throws NotConnectedException {
+ public void shouldReplyWithErrorIfRequestIsRejected() throws NotConnectedException, InterruptedException {
InBandBytestreamRequest ibbRequest = new InBandBytestreamRequest(
byteStreamManager, initBytestream);
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java
index 094e60787..347a5087a 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java
@@ -75,9 +75,10 @@ public class InBandBytestreamSessionMessageTest {
* Initialize fields used in the tests.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
@Before
- public void setup() throws XMPPException, SmackException {
+ public void setup() throws XMPPException, SmackException, InterruptedException {
// build protocol verifier
protocol = new Protocol();
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 a946c5175..2b066b3f4 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
@@ -76,9 +76,10 @@ public class InBandBytestreamSessionTest {
* Initialize fields used in the tests.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
@Before
- public void setup() throws XMPPException, SmackException {
+ public void setup() throws XMPPException, SmackException, InterruptedException {
// build protocol verifier
protocol = new Protocol();
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
index c88835e18..dc32b8587 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
@@ -76,9 +76,10 @@ public class Socks5ByteStreamManagerTest {
* Initialize fields used in the tests.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
@Before
- public void setup() throws XMPPException, SmackException {
+ public void setup() throws XMPPException, SmackException, InterruptedException {
// build protocol verifier
protocol = new Protocol();
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java
index f443dc9dc..266f229f3 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java
@@ -64,9 +64,10 @@ public class Socks5ByteStreamRequestTest {
* Initialize fields used in the tests.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
@Before
- public void setup() throws XMPPException, SmackException {
+ public void setup() throws XMPPException, SmackException, InterruptedException {
// build protocol verifier
protocol = new Protocol();
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java
index 555398c51..1a19e6d18 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientForInitiatorTest.java
@@ -69,9 +69,10 @@ public class Socks5ClientForInitiatorTest {
* Initialize fields used in the tests.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
@Before
- public void setup() throws XMPPException, SmackException {
+ public void setup() throws XMPPException, SmackException, InterruptedException {
// build protocol verifier
protocol = new Protocol();
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 b9beca71d..3ebab7b09 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
@@ -103,9 +103,10 @@ public class PingTest extends InitExtensions {
* @throws SmackException
* @throws XMPPException
* @throws IOException
+ * @throws InterruptedException
*/
@Test
- public void checkFailedPingOnTimeout() throws SmackException, IOException, XMPPException {
+ public void checkFailedPingOnTimeout() throws SmackException, IOException, XMPPException, InterruptedException {
DummyConnection dummyCon = getAuthenticatedDummyConnectionWithoutIqReplies();
PingManager pinger = PingManager.getInstanceFor(dummyCon);
@@ -181,7 +182,7 @@ public class PingTest extends InitExtensions {
}
@Test
- public void checkPingToServerTimeout() throws SmackException, IOException, XMPPException {
+ public void checkPingToServerTimeout() throws SmackException, IOException, XMPPException, InterruptedException {
DummyConnection con = getAuthenticatedDummyConnectionWithoutIqReplies();
PingManager pinger = PingManager.getInstanceFor(con);
@@ -233,7 +234,7 @@ public class PingTest extends InitExtensions {
assertFalse(pingSupported);
}
- private static ThreadedDummyConnection getAuthentiactedDummyConnection() throws SmackException, IOException, XMPPException {
+ private static ThreadedDummyConnection getAuthentiactedDummyConnection() throws SmackException, IOException, XMPPException, InterruptedException {
ThreadedDummyConnection connection = new ThreadedDummyConnection();
connection.connect();
connection.login();
@@ -247,8 +248,9 @@ public class PingTest extends InitExtensions {
* @throws XMPPException
* @throws IOException
* @throws SmackException
+ * @throws InterruptedException
*/
- private static DummyConnection getAuthenticatedDummyConnectionWithoutIqReplies() throws SmackException, IOException, XMPPException {
+ private static DummyConnection getAuthenticatedDummyConnectionWithoutIqReplies() throws SmackException, IOException, XMPPException, InterruptedException {
DummyConnection con = new DummyConnection();
con.setPacketReplyTimeout(500);
con.connect();
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 dc6074b81..48b382c8a 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
@@ -50,7 +50,7 @@ public class ConfigureFormTest
}
@Test
- public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException
+ public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException, InterruptedException
{
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
PubSubManager mgr = new PubSubManager(con);
@@ -77,7 +77,7 @@ public class ConfigureFormTest
}
@Test (expected=SmackException.class)
- public void getConfigFormWithTimeout() throws XMPPException, SmackException
+ public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
{
ThreadedDummyConnection con = new ThreadedDummyConnection();
PubSubManager mgr = new PubSubManager(con);
diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java b/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java
index bba1cfed2..e6a6e4869 100644
--- a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java
+++ b/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java
@@ -64,9 +64,10 @@ public class ConnectionUtils {
* @return a mocked XMPP connection
* @throws SmackException
* @throws XMPPErrorException
+ * @throws InterruptedException
*/
public static XMPPConnection createMockedConnection(final Protocol protocol,
- String initiatorJID, String xmppServer) throws SmackException, XMPPErrorException {
+ String initiatorJID, String xmppServer) throws SmackException, XMPPErrorException, InterruptedException {
// mock XMPP connection
XMPPConnection connection = mock(XMPPConnection.class);
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 b9465b53b..64a9b875c 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
@@ -91,8 +91,9 @@ public class Chat {
*
* @param text the text to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendMessage(String text) throws NotConnectedException {
+ public void sendMessage(String text) throws NotConnectedException, InterruptedException {
Message message = new Message();
message.setBody(text);
sendMessage(message);
@@ -104,8 +105,9 @@ public class Chat {
*
* @param message the message to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendMessage(Message message) throws NotConnectedException {
+ public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
// Force the recipient, message type, and thread ID since the user elected
// to send the message through this chat object.
message.setTo(participant);
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 778ca8598..0685f5669 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
@@ -351,7 +351,7 @@ public class ChatManager extends Manager{
chat.deliver(message);
}
- void sendMessage(Chat chat, Message message) throws NotConnectedException {
+ void sendMessage(Chat chat, Message message) throws NotConnectedException, InterruptedException {
for(Map.Entry interceptor : interceptors.entrySet()) {
PacketFilter filter = interceptor.getValue();
if(filter != null && filter.accept(message)) {
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 cad183c6b..56e3ea400 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
@@ -211,7 +211,7 @@ public class Roster extends Manager {
try {
Roster.this.reload();
}
- catch (SmackException e) {
+ catch (InterruptedException | SmackException e) {
LOGGER.log(Level.SEVERE, "Could not reload Roster", e);
return;
}
@@ -229,7 +229,7 @@ public class Roster extends Manager {
try {
reload();
}
- catch (SmackException e) {
+ catch (InterruptedException | SmackException e) {
LOGGER.log(Level.SEVERE, "Could not reload Roster", e);
}
}
@@ -271,8 +271,9 @@ public class Roster extends Manager {
* reloaded at a later point when the server responds to the reload request.
* @throws NotLoggedInException If not logged in.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reload() throws NotLoggedInException, NotConnectedException{
+ public void reload() throws NotLoggedInException, NotConnectedException, InterruptedException{
final XMPPConnection connection = connection();
if (!connection.isAuthenticated()) {
throw new NotLoggedInException();
@@ -298,9 +299,10 @@ public class Roster extends Manager {
*
* @throws NotLoggedInException
* @throws NotConnectedException
+ * @throws InterruptedException
* @since 4.1
*/
- public void reloadAndWait() throws NotLoggedInException, NotConnectedException {
+ public void reloadAndWait() throws NotLoggedInException, NotConnectedException, InterruptedException {
reload();
waitUntilLoaded();
}
@@ -317,14 +319,14 @@ public class Roster extends Manager {
try {
reload();
}
- catch (NotLoggedInException | NotConnectedException e) {
+ catch (InterruptedException | NotLoggedInException | NotConnectedException e) {
LOGGER.log(Level.FINER, "Could not reload roster", e);
return false;
}
return true;
}
- protected boolean waitUntilLoaded() {
+ protected boolean waitUntilLoaded() throws InterruptedException {
final XMPPConnection connection = connection();
while (!loaded) {
long waitTime = connection.getPacketReplyTimeout();
@@ -332,17 +334,11 @@ public class Roster extends Manager {
if (waitTime <= 0) {
break;
}
- try {
- synchronized (this) {
- if (!loaded) {
- wait(waitTime);
- }
+ synchronized (this) {
+ if (!loaded) {
+ wait(waitTime);
}
}
- catch (InterruptedException e) {
- LOGGER.log(Level.FINE, "interrupted", e);
- break;
- }
long now = System.currentTimeMillis();
waitTime -= now - start;
start = now;
@@ -423,8 +419,9 @@ public class Roster extends Manager {
* @throws XMPPErrorException if an XMPP exception occurs.
* @throws NotLoggedInException If not logged in.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void createEntry(String user, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException {
+ public void createEntry(String user, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final XMPPConnection connection = connection();
if (!connection.isAuthenticated()) {
throw new NotLoggedInException();
@@ -464,9 +461,10 @@ public class Roster extends Manager {
* @throws NotLoggedInException if not logged in.
* @throws NoResponseException SmackException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
* @throws IllegalStateException if connection is not logged in or logged in anonymously
*/
- public void removeEntry(RosterEntry entry) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException {
+ public void removeEntry(RosterEntry entry) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final XMPPConnection connection = connection();
if (!connection.isAuthenticated()) {
throw new NotLoggedInException();
@@ -913,7 +911,7 @@ public class Roster extends Manager {
*/
private void setOfflinePresencesAndResetLoaded() {
Presence packetUnavailable;
- for (String user : presenceMap.keySet()) {
+ outerloop: for (String user : presenceMap.keySet()) {
Map resources = presenceMap.get(user);
if (resources != null) {
for (String resource : resources.keySet()) {
@@ -927,6 +925,9 @@ public class Roster extends Manager {
"presencePakcetListener should never throw a NotConnectedException when processPacket is called with a presence of type unavailable",
e);
}
+ catch (InterruptedException e) {
+ break outerloop;
+ }
}
}
}
@@ -1140,7 +1141,7 @@ public class Roster extends Manager {
}
@Override
- public void processPacket(Stanza packet) throws NotConnectedException {
+ public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException {
final XMPPConnection connection = connection();
Presence presence = (Presence) packet;
String from = presence.getFrom();
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 f9ff82a97..f87ad50fa 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
@@ -93,8 +93,9 @@ public class RosterEntry {
* @throws NotConnectedException
* @throws XMPPErrorException
* @throws NoResponseException
+ * @throws InterruptedException
*/
- public void setName(String name) throws NotConnectedException, NoResponseException, XMPPErrorException {
+ public void setName(String name) throws NotConnectedException, NoResponseException, XMPPErrorException, InterruptedException {
// Do nothing if the name hasn't changed.
if (name != null && name.equals(this.name)) {
return;
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterGroup.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterGroup.java
index f80f472d9..0508a8ccd 100644
--- a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterGroup.java
+++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterGroup.java
@@ -75,8 +75,9 @@ public class RosterGroup {
* @throws NotConnectedException
* @throws XMPPErrorException
* @throws NoResponseException
+ * @throws InterruptedException
*/
- public void setName(String name) throws NotConnectedException, NoResponseException, XMPPErrorException {
+ public void setName(String name) throws NotConnectedException, NoResponseException, XMPPErrorException, InterruptedException {
synchronized (entries) {
for (RosterEntry entry : entries) {
RosterPacket packet = new RosterPacket();
@@ -169,8 +170,9 @@ public class RosterGroup {
* @throws XMPPErrorException if an error occured while trying to add the entry to the group.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void addEntry(RosterEntry entry) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void addEntry(RosterEntry entry) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PacketCollector collector = null;
// Only add the entry if it isn't already in the list.
synchronized (entries) {
@@ -200,8 +202,9 @@ public class RosterGroup {
* @throws XMPPErrorException if an error occurred while trying to remove the entry from the group.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void removeEntry(RosterEntry entry) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void removeEntry(RosterEntry entry) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PacketCollector collector = null;
// Only remove the entry if it's in the entry list.
// Remove the entry locally, if we wait for RosterPacketListenerprocess>>Packet(Packet)
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java
index 85e2d2b2e..33de499bf 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java
@@ -58,7 +58,7 @@ public class ContentNegotiator extends JingleNegotiator {
transportNegotiators = new ArrayList();
}
- public List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
+ public List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
List responses = new ArrayList();
// First only process IQ packets that contain stanzas that
@@ -255,7 +255,7 @@ public class ContentNegotiator extends JingleNegotiator {
return result;
}
- public void triggerContentEstablished() throws NotConnectedException {
+ public void triggerContentEstablished() throws NotConnectedException, InterruptedException {
PayloadType bestCommonAudioPt = getMediaNegotiator().getBestCommonAudioPt();
TransportCandidate bestRemoteCandidate = getTransportNegotiator().getBestRemoteCandidate();
@@ -268,8 +268,9 @@ public class ContentNegotiator extends JingleNegotiator {
/**
* Trigger a session established event.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException {
+ private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException {
// Let the session know that we've established a content/media segment.
JingleSession session = getSession();
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 fb9f12957..d3cb72c44 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
@@ -312,8 +312,9 @@ public class JingleManager implements JingleSessionListener {
* messages
* @throws SmackException if there was no response from the server.
* @throws XMPPException
+ * @throws InterruptedException
*/
- public static boolean isServiceEnabled(XMPPConnection connection, String userID) throws XMPPException, SmackException {
+ public static boolean isServiceEnabled(XMPPConnection connection, String userID) throws XMPPException, SmackException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, Jingle.NAMESPACE);
}
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 f3c57fd8f..f829d9d57 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
@@ -232,8 +232,9 @@ public abstract class JingleNegotiator {
* @param id the ID of the response that will be sent
* @return the new packet to send (either a Jingle or an IQ error).
* @throws XMPPException
+ * @throws InterruptedException
*/
- public abstract List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException;
+ public abstract List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
public void start() {
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 99606c8b6..d08dbb0b2 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
@@ -276,8 +276,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
* the packet received
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
- public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException {
+ public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException {
List responses = new ArrayList();
String responseId = null;
@@ -344,8 +345,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
* @return the new Jingle packet to send.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
- public List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
+ public List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
List responses = new ArrayList();
IQ response = null;
@@ -397,7 +399,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// Send section
// ----------------------------------------------------------------------------------------------------------
- public void sendPacket(IQ iq) throws NotConnectedException {
+ public void sendPacket(IQ iq) throws NotConnectedException, InterruptedException {
if (iq instanceof Jingle) {
@@ -416,8 +418,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
* @param jout
* the Jingle packet we want to complete and send
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Jingle sendFormattedJingle(Jingle jout) throws NotConnectedException {
+ public Jingle sendFormattedJingle(Jingle jout) throws NotConnectedException, InterruptedException {
return sendFormattedJingle(null, jout);
}
@@ -431,8 +434,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
* @param jout
* the Jingle packet we want to complete and send
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException {
+ public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException, InterruptedException {
if (jout != null) {
if (jout.getInitiator() == null) {
jout.setInitiator(getInitiator());
@@ -795,7 +799,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
public void mediaClosed(PayloadType cand) {
}
- public void mediaEstablished(PayloadType pt) throws NotConnectedException {
+ public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
@@ -816,7 +820,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
JingleTransportListener jingleTransportListener = new JingleTransportListener() {
- public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException {
+ public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
// Indicate that this session is active.
@@ -957,8 +961,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
*
* @throws XMPPException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void terminate() throws XMPPException, NotConnectedException {
+ public void terminate() throws XMPPException, NotConnectedException, InterruptedException {
terminate("Closed Locally");
}
@@ -967,8 +972,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
*
* @throws XMPPException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void terminate(String reason) throws XMPPException, NotConnectedException {
+ public void terminate(String reason) throws XMPPException, NotConnectedException, InterruptedException {
if (isClosed())
return;
LOGGER.fine("Terminate " + reason);
@@ -1053,8 +1059,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
*
* @throws IllegalStateException
* @throws SmackException
+ * @throws InterruptedException
*/
- public void startOutgoing() throws IllegalStateException, SmackException {
+ public void startOutgoing() throws IllegalStateException, SmackException, InterruptedException {
updatePacketListener();
setSessionState(JingleSessionStatePending.getInstance());
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java
index cb611f902..5c51cc68b 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionRequest.java
@@ -107,8 +107,9 @@ public class JingleSessionRequest {
* @return Returns the IncomingJingleSession on which the
* negotiation can be carried out.
* @throws SmackException
+ * @throws InterruptedException
*/
- public synchronized JingleSession accept() throws XMPPException, SmackException {
+ public synchronized JingleSession accept() throws XMPPException, SmackException, InterruptedException {
JingleSession session = null;
synchronized (manager) {
session = manager.createIncomingJingleSession(this);
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionState.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionState.java
index 50232481d..6b7c9d9cd 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionState.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionState.java
@@ -54,8 +54,9 @@ public abstract class JingleSessionState {
/**
* Process an incoming Jingle Packet.
* When you look at the GoF State pattern this method roughly corresponds to example on p310: ProcessOctect().
+ * @throws InterruptedException
*/
- public abstract IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException;
+ public abstract IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException, InterruptedException;
/**
* For debugging just emit the short name of the class.
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateUnknown.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateUnknown.java
index f7e09c160..08002b3c4 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateUnknown.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateUnknown.java
@@ -63,7 +63,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
}
- public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException {
+ public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) throws SmackException, InterruptedException {
IQ response = null;
switch (action) {
@@ -88,9 +88,10 @@ public class JingleSessionStateUnknown extends JingleSessionState {
* In the UNKNOWN state we received a action.
* This method processes that action.
* @throws SmackException
+ * @throws InterruptedException
*/
- private IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle) throws SmackException {
+ private IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle) throws SmackException, InterruptedException {
IQ response = null;
boolean shouldAck = true;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleMediaListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleMediaListener.java
index 49ec6d64e..bfdb1f59c 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleMediaListener.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleMediaListener.java
@@ -30,8 +30,9 @@ public interface JingleMediaListener extends JingleListener {
*
* @param pt The payload type agreed.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void mediaEstablished(PayloadType pt) throws NotConnectedException;
+ public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException;
/**
* Notification that a payload type must be cancelled
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 52d87ee05..1aa7f0032 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
@@ -37,9 +37,10 @@ public interface JingleSessionListener extends JingleListener {
* @param localCandidate the local candidate where we must listen for connections
* @param jingleSession Session that called the method
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
- TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException;
+ TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException;
/**
* Notification that the session was declined.
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java
index cd60a296e..13063697d 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/listeners/JingleTransportListener.java
@@ -35,9 +35,10 @@ public interface JingleTransportListener extends JingleListener {
* @param remote The transport candidate that has been used for
* transmitting to the remote machine
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void transportEstablished(TransportCandidate local,
- TransportCandidate remote) throws NotConnectedException;
+ TransportCandidate remote) throws NotConnectedException, InterruptedException;
/**
* Notification that a transport must be cancelled.
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 65160a9ef..5a7d979ec 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
@@ -103,8 +103,9 @@ public class MediaNegotiator extends JingleNegotiator {
* @return the new Jingle packet to send.
* @throws XMPPException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException {
+ public List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException, InterruptedException {
List responses = new ArrayList();
IQ response = null;
@@ -202,8 +203,9 @@ public class MediaNegotiator extends JingleNegotiator {
* @param jingle
* @return the iq
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException {
+ private IQ receiveContentAcceptAction(Jingle jingle, JingleDescription description) throws XMPPException, NotConnectedException, InterruptedException {
IQ response = null;
List offeredPayloads = new ArrayList();
@@ -477,8 +479,9 @@ public class MediaNegotiator extends JingleNegotiator {
* @param bestPt
* payload type that has been agreed.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void triggerMediaEstablished(PayloadType bestPt) throws NotConnectedException {
+ protected void triggerMediaEstablished(PayloadType bestPt) throws NotConnectedException, InterruptedException {
List listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleMediaListener) {
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 01ae614c4..cb6e12e17 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
@@ -45,8 +45,9 @@ public class BasicResolver extends TransportResolver {
* The BasicResolver takes the IP addresses of the interfaces and uses the
* first non-loopback, non-linklocal and non-sitelocal address.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
+ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
setResolveInit();
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedResolver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedResolver.java
index 78bc8c669..76edad7b3 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedResolver.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedResolver.java
@@ -60,8 +60,9 @@ public class BridgedResolver extends TransportResolver {
*
* The BridgedResolver takes the IP addresse and ports of a jmf proxy service.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
+ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
setResolveInit();
@@ -98,7 +99,7 @@ public class BridgedResolver extends TransportResolver {
setResolveEnd();
}
- public void initialize() throws SmackException, XMPPErrorException {
+ public void initialize() throws SmackException, XMPPErrorException, InterruptedException {
clearCandidates();
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
index c467542ea..8769f49c1 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
@@ -53,7 +53,7 @@ public class BridgedTransportManager extends JingleTransportManager implements J
// Implement a Session Listener to relay candidates after establishment
- public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException {
+ public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
}
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedResolver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedResolver.java
index a7f01faa5..9c6867fd5 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedResolver.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/FixedResolver.java
@@ -52,8 +52,9 @@ public class FixedResolver extends TransportResolver {
/**
* Resolve the IP address.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
+ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
if (!isResolving()) {
setResolveInit();
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 8af201423..2eab73d26 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
@@ -91,8 +91,9 @@ public class ICEResolver extends TransportResolver {
/**
* Resolve the IP and obtain a valid transport method.
* @throws SmackException
+ * @throws InterruptedException
*/
- public synchronized void resolve(JingleSession session) throws XMPPException, SmackException {
+ public synchronized void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException {
this.setResolveInit();
for (TransportCandidate candidate : this.getCandidatesList()) {
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
index 63c81c74c..964e095ce 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
@@ -39,7 +39,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
}
}
- protected TransportResolver createResolver(JingleSession session) throws SmackException {
+ protected TransportResolver createResolver(JingleSession session) throws SmackException, InterruptedException {
try {
iceResolver.resolve(session);
}
@@ -51,7 +51,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
// Implement a Session Listener to relay candidates after establishment
- public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException {
+ public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException {
if (lc instanceof ICECandidate) {
if (((ICECandidate) lc).getType().equals("relay")) {
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/JingleTransportManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/JingleTransportManager.java
index 303ae5fc8..0f04b723c 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/JingleTransportManager.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/JingleTransportManager.java
@@ -51,8 +51,9 @@ public abstract class JingleTransportManager {
* Get a new Transport Resolver to be used in a Jingle Session
*
* @return the TransportResolver to be used
+ * @throws InterruptedException
*/
- public TransportResolver getResolver(JingleSession session) throws XMPPException, SmackException {
+ public TransportResolver getResolver(JingleSession session) throws XMPPException, SmackException, InterruptedException {
TransportResolver resolver = createResolver(session);
if (resolver == null) {
resolver = new BasicResolver();
@@ -66,7 +67,8 @@ public abstract class JingleTransportManager {
* Create a Transport Resolver instance according to the implementation.
*
* @return the TransportResolver
+ * @throws InterruptedException
*/
- protected abstract TransportResolver createResolver(JingleSession session) throws SmackException;
+ protected abstract TransportResolver createResolver(JingleSession session) throws SmackException, InterruptedException;
}
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 307e8c8cd..2c85ea6f8 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
@@ -389,8 +389,9 @@ public class RTPBridge extends IQ {
* @param sessionID
* @return the new RTPBridge
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException {
+ public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
@@ -417,9 +418,10 @@ public class RTPBridge extends IQ {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public static boolean serviceAvailable(XMPPConnection connection) throws NoResponseException,
- XMPPErrorException, NotConnectedException {
+ XMPPErrorException, NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return false;
@@ -454,8 +456,9 @@ public class RTPBridge extends IQ {
* @param connection
* @return the RTPBridge
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException {
+ public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
@@ -489,8 +492,9 @@ public class RTPBridge extends IQ {
* @param xmppConnection
* @return public IP String or null if not found
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException {
+ public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException {
if (!xmppConnection.isConnected()) {
return null;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java
index c4416b4ea..a91c26500 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUN.java
@@ -173,8 +173,9 @@ public class STUN extends SimpleIQ {
* @param connection
* @return the STUN server address
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException {
+ public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
@@ -200,8 +201,9 @@ public class STUN extends SimpleIQ {
* @return true if the server support STUN
* @throws SmackException
* @throws XMPPException
+ * @throws InterruptedException
*/
- public static boolean serviceAvailable(XMPPConnection connection) throws XMPPException, SmackException {
+ public static boolean serviceAvailable(XMPPConnection connection) throws XMPPException, SmackException, InterruptedException {
if (!connection.isConnected()) {
return false;
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUNResolver.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUNResolver.java
index d0d6e7f66..45e9c67ec 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUNResolver.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/STUNResolver.java
@@ -264,8 +264,9 @@ public class STUNResolver extends TransportResolver {
/**
* Resolve the IP and obtain a valid transport method.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException {
+ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
setResolveInit();
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
index a80e4755d..21a362321 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
@@ -323,7 +323,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
try {
js.sendFormattedJingle(jin, jout);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
throw new IllegalStateException(e);
}
acceptedRemoteCandidates.add(bestRemote);
@@ -333,7 +333,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
try {
triggerTransportEstablished(getAcceptedLocalCandidate(), bestRemote);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
throw new IllegalStateException(e);
}
break;
@@ -414,7 +414,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
try {
js.sendFormattedJingle(jin, jout);
}
- catch (NotConnectedException e) {
+ catch (InterruptedException | NotConnectedException e) {
throw new IllegalStateException(e);
}
acceptedRemoteCandidates.add(bestRemote);
@@ -525,8 +525,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
*
* @param cand
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException {
+ private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException, InterruptedException {
if (!cand.isNull()) {
// Offer our new candidate...
addOfferedCandidate(cand);
@@ -547,8 +548,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
*
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
- private void sendTransportCandidatesOffer() throws XMPPException, SmackException {
+ private void sendTransportCandidatesOffer() throws XMPPException, SmackException, InterruptedException {
List notOffered = resolver.getCandidatesList();
notOffered.removeAll(offeredCandidates);
@@ -562,7 +564,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
if (resolverListener == null) {
// Add a listener that sends the offer when the resolver finishes...
resolverListener = new TransportResolverListener.Resolver() {
- public void candidateAdded(TransportCandidate cand) throws NotConnectedException {
+ public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
sendTransportCandidateOffer(cand);
}
@@ -592,8 +594,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @return the new Jingle packet to send.
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
- public final List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
+ public final List dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
List responses = new ArrayList();
IQ response = null;
@@ -662,8 +665,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @return an IQ packet
* @throws XMPPException
* @throws SmackException
+ * @throws InterruptedException
*/
- private Jingle receiveResult(IQ iq) throws XMPPException, SmackException {
+ private Jingle receiveResult(IQ iq) throws XMPPException, SmackException, InterruptedException {
Jingle response = null;
sendTransportCandidatesOffer();
@@ -677,8 +681,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @param jingleTransport
* @return the iq
* @throws SmackException
+ * @throws InterruptedException
*/
- private IQ receiveSessionInitiateAction(Jingle jingle) throws XMPPException, SmackException {
+ private IQ receiveSessionInitiateAction(Jingle jingle) throws XMPPException, SmackException, InterruptedException {
IQ response = null;
// Parse the Jingle and get any proposed transport candidates
@@ -781,8 +786,9 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @param local TransportCandidate that has been agreed.
* @param remote TransportCandidate that has been agreed.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException {
+ private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
List listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleTransportListener) {
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 258fa6514..d515669e3 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
@@ -88,13 +88,15 @@ public abstract class TransportResolver {
/**
* Initialize the Resolver
+ * @throws InterruptedException
*/
- public abstract void initialize() throws XMPPException, SmackException;
+ public abstract void initialize() throws XMPPException, SmackException, InterruptedException;
/**
* Start a the resolution.
+ * @throws InterruptedException
*/
- public abstract void resolve(JingleSession session) throws XMPPException, SmackException;
+ public abstract void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException;
/**
* Clear the list of candidates and start a new resolution process.
@@ -208,8 +210,9 @@ public abstract class TransportResolver {
*
* @param cand The candidate added to the list of candidates.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void triggerCandidateAdded(TransportCandidate cand) throws NotConnectedException {
+ protected void triggerCandidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
Iterator iter = getListenersList().iterator();
while (iter.hasNext()) {
TransportResolverListener trl = iter.next();
@@ -265,8 +268,9 @@ public abstract class TransportResolver {
*
* @param cand The candidate to add
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void addCandidate(TransportCandidate cand) throws NotConnectedException {
+ protected void addCandidate(TransportCandidate cand) throws NotConnectedException, InterruptedException {
synchronized (candidates) {
if (!candidates.contains(cand))
candidates.add(cand);
@@ -355,8 +359,9 @@ public abstract class TransportResolver {
/**
* Initialize Transport Resolver and wait until it is complete unitialized.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void initializeAndWait() throws XMPPException, SmackException {
+ public void initializeAndWait() throws XMPPException, SmackException, InterruptedException {
this.initialize();
try {
LOGGER.fine("Initializing transport resolver...");
diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolverListener.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolverListener.java
index 03257382a..9600cb090 100644
--- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolverListener.java
+++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportResolverListener.java
@@ -36,8 +36,9 @@ public abstract interface TransportResolverListener {
*
* @param cand The transport candidate.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void candidateAdded(TransportCandidate cand) throws NotConnectedException;
+ public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException;
/**
* All the transport candidates have been obtained.
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Agent.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Agent.java
index fd54f58e5..347f7554c 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Agent.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Agent.java
@@ -36,7 +36,7 @@ public class Agent {
private XMPPConnection connection;
private String workgroupJID;
- public static Collection getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public static Collection getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AgentWorkgroups request = new AgentWorkgroups(agentJID);
request.setTo(serviceJID);
AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@@ -67,8 +67,9 @@ public class Agent {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AgentInfo agentInfo = new AgentInfo();
agentInfo.setType(IQ.Type.get);
agentInfo.setTo(workgroupJID);
@@ -87,8 +88,9 @@ public class Agent {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AgentInfo agentInfo = new AgentInfo();
agentInfo.setType(IQ.Type.set);
agentInfo.setTo(workgroupJID);
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java
index f5a475fca..a306faf3e 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java
@@ -65,8 +65,9 @@ public class AgentRoster {
*
* @param connection an XMPP connection.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- AgentRoster(XMPPConnection connection, String workgroupJID) throws NotConnectedException {
+ AgentRoster(XMPPConnection connection, String workgroupJID) throws NotConnectedException, InterruptedException {
this.connection = connection;
this.workgroupJID = workgroupJID;
entries = new ArrayList();
@@ -90,8 +91,9 @@ public class AgentRoster {
* which means the method will return immediately, and the roster will be
* reloaded at a later point when the server responds to the reload request.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reload() throws NotConnectedException {
+ public void reload() throws NotConnectedException, InterruptedException {
AgentStatusRequest request = new AgentStatusRequest();
request.setTo(workgroupJID);
connection.sendPacket(request);
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 b23ccd277..14dc11728 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
@@ -175,8 +175,9 @@ public class AgentSession {
*
* @return the AgentRoster
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public AgentRoster getAgentRoster() throws NotConnectedException {
+ public AgentRoster getAgentRoster() throws NotConnectedException, InterruptedException {
if (agentRoster == null) {
agentRoster = new AgentRoster(connection, workgroupJID);
}
@@ -234,8 +235,9 @@ public class AgentSession {
* @param val the non-null meta data value
* @throws XMPPException if an exception occurs.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void setMetaData(String key, String val) throws XMPPException, SmackException {
+ public void setMetaData(String key, String val) throws XMPPException, SmackException, InterruptedException {
synchronized (this.metaData) {
List oldVals = metaData.get(key);
@@ -254,8 +256,9 @@ public class AgentSession {
* @param key the meta data key.
* @throws XMPPException if an exception occurs.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void removeMetaData(String key) throws XMPPException, SmackException {
+ public void removeMetaData(String key) throws XMPPException, SmackException, InterruptedException {
synchronized (this.metaData) {
List oldVal = metaData.remove(key);
@@ -285,8 +288,9 @@ public class AgentSession {
* @throws XMPPException if an error occurs setting the online status.
* @throws SmackException assertEquals(SmackException.Type.NO_RESPONSE_FROM_SERVER, e.getType());
return;
+ * @throws InterruptedException
*/
- public void setOnline(boolean online) throws XMPPException, SmackException {
+ public void setOnline(boolean online) throws XMPPException, SmackException, InterruptedException {
// If the online status hasn't changed, do nothing.
if (this.online == online) {
return;
@@ -344,9 +348,10 @@ public class AgentSession {
* @param maxChats the maximum number of chats the agent is willing to accept.
* @throws XMPPException if an error occurs setting the agent status.
* @throws SmackException
+ * @throws InterruptedException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
- public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException, SmackException {
+ public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException, SmackException, InterruptedException {
setStatus(presenceMode, maxChats, null);
}
@@ -372,10 +377,11 @@ public class AgentSession {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, int maxChats, String status)
- throws NoResponseException, XMPPErrorException, NotConnectedException {
+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
@@ -423,9 +429,10 @@ public class AgentSession {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
- public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
@@ -459,8 +466,9 @@ public class AgentSession {
* @param userID the ID of the user to remove.
* @throws XMPPException if an exception occurs.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void dequeueUser(String userID) throws XMPPException, NotConnectedException {
+ public void dequeueUser(String userID) throws XMPPException, NotConnectedException, InterruptedException {
// todo: this method simply won't work right now.
DepartQueuePacket departPacket = new DepartQueuePacket(this.workgroupJID);
@@ -476,8 +484,9 @@ public class AgentSession {
* @return the transcripts of a given user.
* @throws XMPPException if an error occurs while getting the information.
* @throws SmackException
+ * @throws InterruptedException
*/
- public Transcripts getTranscripts(String userID) throws XMPPException, SmackException {
+ public Transcripts getTranscripts(String userID) throws XMPPException, SmackException, InterruptedException {
return transcriptManager.getTranscripts(workgroupJID, userID);
}
@@ -488,8 +497,9 @@ public class AgentSession {
* @return the full conversation transcript of a given session.
* @throws XMPPException if an error occurs while getting the information.
* @throws SmackException
+ * @throws InterruptedException
*/
- public Transcript getTranscript(String sessionID) throws XMPPException, SmackException {
+ public Transcript getTranscript(String sessionID) throws XMPPException, SmackException, InterruptedException {
return transcriptManager.getTranscript(workgroupJID, sessionID);
}
@@ -501,8 +511,9 @@ public class AgentSession {
* @return the Form to use for searching transcripts.
* @throws XMPPException if an error occurs while sending the request to the server.
* @throws SmackException
+ * @throws InterruptedException
*/
- public Form getTranscriptSearchForm() throws XMPPException, SmackException {
+ public Form getTranscriptSearchForm() throws XMPPException, SmackException, InterruptedException {
return transcriptSearchManager.getSearchForm(XmppStringUtils.parseDomain(workgroupJID));
}
@@ -515,8 +526,9 @@ public class AgentSession {
* @return the result of the transcript search.
* @throws SmackException
* @throws XMPPException
+ * @throws InterruptedException
*/
- public ReportedData searchTranscripts(Form completedForm) throws XMPPException, SmackException {
+ public ReportedData searchTranscripts(Form completedForm) throws XMPPException, SmackException, InterruptedException {
return transcriptSearchManager.submitSearch(XmppStringUtils.parseDomain(workgroupJID),
completedForm);
}
@@ -531,8 +543,9 @@ public class AgentSession {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
OccupantsInfo request = new OccupantsInfo(roomID);
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -689,7 +702,7 @@ public class AgentSession {
// PacketListener Implementation.
- private void handlePacket(Stanza packet) throws NotConnectedException {
+ private void handlePacket(Stanza packet) throws NotConnectedException, InterruptedException {
if (packet instanceof OfferRequestProvider.OfferRequestPacket) {
// Acknowledge the IQ set.
IQ reply = IQ.createResultIQ((IQ) packet);
@@ -796,8 +809,9 @@ public class AgentSession {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ChatNotes notes = new ChatNotes();
notes.setType(IQ.Type.set);
notes.setTo(workgroupJID);
@@ -814,8 +828,9 @@ public class AgentSession {
* @throws XMPPErrorException if an error occurs while retrieving the ChatNote.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ChatNotes request = new ChatNotes();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -833,8 +848,9 @@ public class AgentSession {
* @return the chat history associated with a given jid.
* @throws XMPPException if an error occurs while retrieving the AgentChatHistory.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public AgentChatHistory getAgentHistory(String jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException {
+ public AgentChatHistory getAgentHistory(String jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException, InterruptedException {
AgentChatHistory request;
if (startDate != null) {
request = new AgentChatHistory(jid, maxSessions, startDate);
@@ -859,8 +875,9 @@ public class AgentSession {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
SearchSettings request = new SearchSettings();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -877,8 +894,9 @@ public class AgentSession {
* @throws XMPPErrorException if an error occurs while getting information from the server.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Macros request = new Macros();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -895,8 +913,9 @@ public class AgentSession {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Macros request = new Macros();
request.setType(IQ.Type.set);
request.setTo(workgroupJID);
@@ -913,8 +932,9 @@ public class AgentSession {
* @return Map a map of all metadata associated with the sessionID.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Map> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException {
+ public Map> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException, InterruptedException {
ChatMetadata request = new ChatMetadata();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -952,8 +972,9 @@ public class AgentSession {
* the request.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
IQ iq = new RoomInvitation.RoomInvitationIQ(invitation);
@@ -989,8 +1010,9 @@ public class AgentSession {
* the request.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
+ public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
final RoomTransfer transfer = new RoomTransfer(type, invitee, sessionID, reason);
IQ iq = new RoomTransfer.RoomTransferIQ(transfer);
@@ -1010,8 +1032,9 @@ public class AgentSession {
* @throws XMPPErrorException if an error occurs while sending the request to the server.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
GenericSettings setting = new GenericSettings();
setting.setType(IQ.Type.get);
setting.setTo(workgroupJID);
@@ -1021,7 +1044,7 @@ public class AgentSession {
return response;
}
- public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MonitorPacket request = new MonitorPacket();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -1030,7 +1053,7 @@ public class AgentSession {
return response.isMonitor();
}
- public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MonitorPacket request = new MonitorPacket();
request.setType(IQ.Type.set);
request.setTo(workgroupJID);
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Offer.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Offer.java
index 374de974e..363d92691 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Offer.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/Offer.java
@@ -81,8 +81,9 @@ public class Offer {
/**
* Accepts the offer.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void accept() throws NotConnectedException {
+ public void accept() throws NotConnectedException, InterruptedException {
Stanza acceptPacket = new AcceptPacket(this.session.getWorkgroupJID());
connection.sendPacket(acceptPacket);
// TODO: listen for a reply.
@@ -92,8 +93,9 @@ public class Offer {
/**
* Rejects the offer.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void reject() throws NotConnectedException {
+ public void reject() throws NotConnectedException, InterruptedException {
RejectPacket rejectPacket = new RejectPacket(this.session.getWorkgroupJID());
connection.sendPacket(rejectPacket);
// TODO: listen for a reply.
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/OfferConfirmation.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/OfferConfirmation.java
index 7cb0d7198..e526ca71e 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/OfferConfirmation.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/OfferConfirmation.java
@@ -53,7 +53,7 @@ public class OfferConfirmation extends SimpleIQ {
}
- public void notifyService(XMPPConnection con, String workgroup, String createdRoomName) throws NotConnectedException {
+ public void notifyService(XMPPConnection con, String workgroup, String createdRoomName) throws NotConnectedException, InterruptedException {
NotifyServicePacket packet = new NotifyServicePacket(workgroup, createdRoomName);
con.sendPacket(packet);
}
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptManager.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptManager.java
index 70181faef..f05d6c07c 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptManager.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptManager.java
@@ -47,8 +47,9 @@ public class TranscriptManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Transcript getTranscript(String workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Transcript getTranscript(String workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcript request = new Transcript(sessionID);
request.setTo(workgroupJID);
Transcript response = (Transcript) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@@ -65,8 +66,9 @@ public class TranscriptManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Transcripts getTranscripts(String workgroupJID, String userID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Transcripts getTranscripts(String workgroupJID, String userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Transcripts request = new Transcripts(userID);
request.setTo(workgroupJID);
Transcripts response = (Transcripts) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptSearchManager.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptSearchManager.java
index faaaeadfe..2dfd15ee8 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptSearchManager.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/TranscriptSearchManager.java
@@ -50,8 +50,9 @@ public class TranscriptSearchManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.get);
search.setTo(serviceJID);
@@ -72,8 +73,9 @@ public class TranscriptSearchManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.get);
search.setTo(serviceJID);
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java
index 25156da22..5b7ae8b93 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java
@@ -175,8 +175,9 @@ public class Workgroup {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Presence directedPresence = new Presence(Presence.Type.available);
directedPresence.setTo(workgroupJID);
PacketFilter typeFilter = new PacketTypeFilter(Presence.class);
@@ -250,8 +251,9 @@ public class Workgroup {
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void joinQueue() throws XMPPException, SmackException {
+ public void joinQueue() throws XMPPException, SmackException, InterruptedException {
joinQueue(null);
}
@@ -288,8 +290,9 @@ public class Workgroup {
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void joinQueue(Form answerForm) throws XMPPException, SmackException {
+ public void joinQueue(Form answerForm) throws XMPPException, SmackException, InterruptedException {
joinQueue(answerForm, null);
}
@@ -327,8 +330,9 @@ public class Workgroup {
* request to join the queue.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void joinQueue(Form answerForm, String userID) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void joinQueue(Form answerForm, String userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);
@@ -374,8 +378,9 @@ public class Workgroup {
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
+ * @throws InterruptedException
*/
- public void joinQueue(Map metadata, String userID) throws XMPPException, SmackException {
+ public void joinQueue(Map metadata, String userID) throws XMPPException, SmackException, InterruptedException {
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);
@@ -408,8 +413,9 @@ public class Workgroup {
* request to the server.
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void departQueue() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public void departQueue() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// If not in the queue ignore the depart request.
if (!inQueue) {
return;
@@ -584,8 +590,9 @@ public class Workgroup {
* @return the ChatSetting if found, otherwise false.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws SmackException
+ * @throws InterruptedException
*/
- public ChatSetting getChatSetting(String key) throws XMPPException, SmackException {
+ public ChatSetting getChatSetting(String key) throws XMPPException, SmackException, InterruptedException {
ChatSettings chatSettings = getChatSettings(key, -1);
return chatSettings.getFirstEntry();
}
@@ -597,8 +604,9 @@ public class Workgroup {
* @return the ChatSettings of given type, otherwise null.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws SmackException
+ * @throws InterruptedException
*/
- public ChatSettings getChatSettings(int type) throws XMPPException, SmackException {
+ public ChatSettings getChatSettings(int type) throws XMPPException, SmackException, InterruptedException {
return getChatSettings(null, type);
}
@@ -608,8 +616,9 @@ public class Workgroup {
* @return all ChatSettings of a given workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws SmackException
+ * @throws InterruptedException
*/
- public ChatSettings getChatSettings() throws XMPPException, SmackException {
+ public ChatSettings getChatSettings() throws XMPPException, SmackException, InterruptedException {
return getChatSettings(null, -1);
}
@@ -621,8 +630,9 @@ public class Workgroup {
* @throws NoResponseException
* @throws XMPPErrorException if an error occurs while getting information from the server.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ChatSettings request = new ChatSettings();
if (key != null) {
request.setKey(key);
@@ -644,8 +654,9 @@ public class Workgroup {
*
* @return true if the email service is available, otherwise return false.
* @throws SmackException
+ * @throws InterruptedException
*/
- public boolean isEmailAvailable() throws SmackException {
+ public boolean isEmailAvailable() throws SmackException, InterruptedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
try {
@@ -665,8 +676,9 @@ public class Workgroup {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
OfflineSettings request = new OfflineSettings();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -683,8 +695,9 @@ public class Workgroup {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
SoundSettings request = new SoundSettings();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -700,8 +713,9 @@ public class Workgroup {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
WorkgroupProperties request = new WorkgroupProperties();
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
@@ -719,8 +733,9 @@ public class Workgroup {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
WorkgroupProperties request = new WorkgroupProperties();
request.setJid(jid);
request.setType(IQ.Type.get);
@@ -741,8 +756,9 @@ public class Workgroup {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
+ public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
WorkgroupForm workgroupForm = new WorkgroupForm();
workgroupForm.setType(IQ.Type.get);
workgroupForm.setTo(workgroupJID);
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/DefaultMessageEventRequestListener.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/DefaultMessageEventRequestListener.java
index bfc7ccc47..965d54619 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/DefaultMessageEventRequestListener.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/DefaultMessageEventRequestListener.java
@@ -31,7 +31,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
public class DefaultMessageEventRequestListener implements MessageEventRequestListener {
public void deliveredNotificationRequested(String from, String packetID,
- MessageEventManager messageEventManager) throws NotConnectedException
+ MessageEventManager messageEventManager) throws NotConnectedException, InterruptedException
{
// Send to the message's sender that the message has been delivered
messageEventManager.sendDeliveredNotification(from, packetID);
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 732307bde..1856120cf 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
@@ -208,8 +208,9 @@ public class MessageEventManager extends Manager {
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendDeliveredNotification(String to, String packetID) throws NotConnectedException {
+ public void sendDeliveredNotification(String to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
@@ -227,8 +228,9 @@ public class MessageEventManager extends Manager {
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendDisplayedNotification(String to, String packetID) throws NotConnectedException {
+ public void sendDisplayedNotification(String to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
@@ -246,8 +248,9 @@ public class MessageEventManager extends Manager {
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendComposingNotification(String to, String packetID) throws NotConnectedException {
+ public void sendComposingNotification(String to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
@@ -265,8 +268,9 @@ public class MessageEventManager extends Manager {
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void sendCancelledNotification(String to, String packetID) throws NotConnectedException {
+ public void sendCancelledNotification(String to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventRequestListener.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventRequestListener.java
index b0fdd3675..71583a428 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventRequestListener.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventRequestListener.java
@@ -48,9 +48,10 @@ public interface MessageEventRequestListener {
* @param packetID the id of the message that was sent.
* @param messageEventManager the messageEventManager that fired the listener.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
public void deliveredNotificationRequested(String from, String packetID,
- MessageEventManager messageEventManager) throws NotConnectedException;
+ MessageEventManager messageEventManager) throws NotConnectedException, InterruptedException;
/**
* Called when a request for message displayed notification is received.
diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java
index 5569c27de..3054026a7 100644
--- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java
+++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java
@@ -115,8 +115,9 @@ public class RosterExchangeManager {
* @param roster the roster to send
* @param targetUserID the user that will receive the roster entries
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void send(Roster roster, String targetUserID) throws NotConnectedException {
+ public void send(Roster roster, String targetUserID) throws NotConnectedException, InterruptedException {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
@@ -134,8 +135,9 @@ public class RosterExchangeManager {
* @param rosterEntry the roster entry to send
* @param targetUserID the user that will receive the roster entries
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void send(RosterEntry rosterEntry, String targetUserID) throws NotConnectedException {
+ public void send(RosterEntry rosterEntry, String targetUserID) throws NotConnectedException, InterruptedException {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
@@ -155,8 +157,9 @@ public class RosterExchangeManager {
* @param rosterGroup the roster group to send
* @param targetUserID the user that will receive the roster entries
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- public void send(RosterGroup rosterGroup, String targetUserID) throws NotConnectedException {
+ public void send(RosterGroup rosterGroup, String targetUserID) throws NotConnectedException, InterruptedException {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
diff --git a/smack-sasl-javax/src/test/java/org/jivesoftware/smack/sasl/javax/SASLDigestMD5Test.java b/smack-sasl-javax/src/test/java/org/jivesoftware/smack/sasl/javax/SASLDigestMD5Test.java
index 3b1659bf2..489c6ff3a 100644
--- a/smack-sasl-javax/src/test/java/org/jivesoftware/smack/sasl/javax/SASLDigestMD5Test.java
+++ b/smack-sasl-javax/src/test/java/org/jivesoftware/smack/sasl/javax/SASLDigestMD5Test.java
@@ -28,7 +28,7 @@ public class SASLDigestMD5Test extends DigestMd5SaslTest {
}
@Test
- public void testDigestMD5() throws NotConnectedException, SmackException {
+ public void testDigestMD5() throws NotConnectedException, SmackException, InterruptedException {
runTest();
}
}
diff --git a/smack-sasl-provided/src/test/java/org/jivesoftware/smack/sasl/provided/SASLDigestMD5Test.java b/smack-sasl-provided/src/test/java/org/jivesoftware/smack/sasl/provided/SASLDigestMD5Test.java
index 0cda8b076..425473945 100644
--- a/smack-sasl-provided/src/test/java/org/jivesoftware/smack/sasl/provided/SASLDigestMD5Test.java
+++ b/smack-sasl-provided/src/test/java/org/jivesoftware/smack/sasl/provided/SASLDigestMD5Test.java
@@ -27,7 +27,7 @@ public class SASLDigestMD5Test extends DigestMd5SaslTest {
}
@Test
- public void testDigestMD5() throws NotConnectedException, SmackException {
+ public void testDigestMD5() throws NotConnectedException, SmackException, InterruptedException {
runTest();
}
}
diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
index be3253191..0b6b8881a 100644
--- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
+++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
@@ -334,14 +334,14 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
@Override
- protected void afterSuccessfulLogin(final boolean resumed) throws NotConnectedException {
+ protected void afterSuccessfulLogin(final boolean resumed) throws NotConnectedException, InterruptedException {
// Reset the flag in case it was set
disconnectedButResumeable = false;
super.afterSuccessfulLogin(resumed);
}
@Override
- protected synchronized void loginNonAnonymously(String username, String password, String resource) throws XMPPException, SmackException, IOException {
+ protected synchronized void loginNonAnonymously(String username, String password, String resource) throws XMPPException, SmackException, IOException, InterruptedException {
if (saslAuthentication.hasNonAnonymousAuthentication()) {
// Authenticate using SASL
if (password != null) {
@@ -406,7 +406,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
@Override
- public synchronized void loginAnonymously() throws XMPPException, SmackException, IOException {
+ public synchronized void loginAnonymously() throws XMPPException, SmackException, IOException, InterruptedException {
// Wait with SASL auth until the SASL mechanisms have been received
saslFeatureReceived.checkIfSuccessOrWaitOrThrow();
@@ -447,7 +447,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// Try to send a last SM Acknowledgement. Most servers won't find this information helpful, as the SM
// state is dropped after a clean disconnect anyways. OTOH it doesn't hurt much either.
sendSmAcknowledgementInternal();
- } catch (NotConnectedException e) {
+ } catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.FINE, "Can not send final SM ack as connection is not connected", e);
}
}
@@ -509,12 +509,12 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
@Override
- public void send(PlainStreamElement element) throws NotConnectedException {
+ public void send(PlainStreamElement element) throws NotConnectedException, InterruptedException {
packetWriter.sendStreamElement(element);
}
@Override
- protected void sendPacketInternal(Stanza packet) throws NotConnectedException {
+ protected void sendPacketInternal(Stanza packet) throws NotConnectedException, InterruptedException {
packetWriter.sendStreamElement(packet);
if (isSmEnabled()) {
for (PacketFilter requestAckPredicate : requestAckPredicates) {
@@ -777,8 +777,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* @throws NotConnectedException
* @throws XMPPException
* @throws NoResponseException
+ * @throws InterruptedException
*/
- private void useCompression() throws NotConnectedException, NoResponseException, XMPPException {
+ private void useCompression() throws NotConnectedException, NoResponseException, XMPPException, InterruptedException {
maybeCompressFeaturesReceived.checkIfSuccessOrWait();
// If stream compression was offered by the server and we want to use
// compression then send compression request to the server
@@ -800,9 +801,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* @throws XMPPException if an error occurs while trying to establish the connection.
* @throws SmackException
* @throws IOException
+ * @throws InterruptedException
*/
@Override
- protected void connectInternal() throws SmackException, IOException, XMPPException {
+ protected void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException {
// Establishes the TCP connection to the server and does setup the reader and writer. Throws an exception if
// there is an error establishing the connection
connectUsingConfiguration();
@@ -854,7 +856,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
@Override
- protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException {
+ protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException, InterruptedException {
StartTls startTlsFeature = getFeature(StartTls.ELEMENT, StartTls.NAMESPACE);
if (startTlsFeature != null) {
if (startTlsFeature.required() && config.getSecurityMode() == SecurityMode.disabled) {
@@ -890,8 +892,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* to be sent by the server.
*
* @throws SmackException if the parser could not be reset.
+ * @throws InterruptedException
*/
- void openStream() throws SmackException {
+ void openStream() throws SmackException, InterruptedException {
// If possible, provide the receiving entity of the stream open tag, i.e. the server, as much information as
// possible. The 'to' attribute is *always* available. The 'from' attribute if set by the user and no external
// mechanism is used to determine the local entity (user). And the 'id' attribute is available after the first
@@ -1200,24 +1203,21 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
*
* @param element the element to send.
* @throws NotConnectedException
+ * @throws InterruptedException
*/
- protected void sendStreamElement(Element element) throws NotConnectedException {
+ protected void sendStreamElement(Element element) throws NotConnectedException, InterruptedException {
throwNotConnectedExceptionIfDoneAndResumptionNotPossible();
-
- boolean enqueued = false;
- while (!enqueued) {
- try {
- queue.put(element);
- enqueued = true;
- }
- catch (InterruptedException e) {
- throwNotConnectedExceptionIfDoneAndResumptionNotPossible();
- // If the method above did not throw, then the sending thread was interrupted
- // TODO in a later version of Smack the InterruptedException should be thrown to
- // allow users to interrupt a sending thread that is currently blocking because
- // the queue is full.
- LOGGER.log(Level.WARNING, "Sending thread was interrupted", e);
- }
+ try {
+ queue.put(element);
+ }
+ catch (InterruptedException e) {
+ // put() may throw an InterruptedException for two reasons:
+ // 1. If the queue was shut down
+ // 2. If the thread was interrupted
+ // so we have to check which is the case
+ throwNotConnectedExceptionIfDoneAndResumptionNotPossible();
+ // If the method above did not throw, then the sending thread was interrupted
+ throw e;
}
}
@@ -1457,15 +1457,16 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
*
* @throws StreamManagementNotEnabledException if Stream Mangement is not enabled.
* @throws NotConnectedException if the connection is not connected.
+ * @throws InterruptedException
*/
- public void requestSmAcknowledgement() throws StreamManagementNotEnabledException, NotConnectedException {
+ public void requestSmAcknowledgement() throws StreamManagementNotEnabledException, NotConnectedException, InterruptedException {
if (!isSmEnabled()) {
throw new StreamManagementException.StreamManagementNotEnabledException();
}
requestSmAcknowledgementInternal();
}
- private void requestSmAcknowledgementInternal() throws NotConnectedException {
+ private void requestSmAcknowledgementInternal() throws NotConnectedException, InterruptedException {
packetWriter.sendStreamElement(AckRequest.INSTANCE);
}
@@ -1479,15 +1480,16 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
*
* @throws StreamManagementNotEnabledException if Stream Management is not enabled.
* @throws NotConnectedException if the connection is not connected.
+ * @throws InterruptedException
*/
- public void sendSmAcknowledgement() throws StreamManagementNotEnabledException, NotConnectedException {
+ public void sendSmAcknowledgement() throws StreamManagementNotEnabledException, NotConnectedException, InterruptedException {
if (!isSmEnabled()) {
throw new StreamManagementException.StreamManagementNotEnabledException();
}
sendSmAcknowledgementInternal();
}
- private void sendSmAcknowledgementInternal() throws NotConnectedException {
+ private void sendSmAcknowledgementInternal() throws NotConnectedException, InterruptedException {
packetWriter.sendStreamElement(new AckAnswer(clientHandledStanzasCount));
}
@@ -1679,8 +1681,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try {
listener.processPacket(ackedStanza);
}
- catch (NotConnectedException e) {
- LOGGER.log(Level.FINER, "Received not connected exception", e);
+ catch (InterruptedException | NotConnectedException e) {
+ LOGGER.log(Level.FINER, "Received exception", e);
}
}
String id = ackedStanza.getStanzaId();
@@ -1692,8 +1694,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
try {
listener.processPacket(ackedStanza);
}
- catch (NotConnectedException e) {
- LOGGER.log(Level.FINER, "Received not connected exception", e);
+ catch (InterruptedException | NotConnectedException e) {
+ LOGGER.log(Level.FINER, "Received exception", e);
}
}
}
From 0ee2d9ed1e8ce9d599226896670b6c270d61496e Mon Sep 17 00:00:00 2001
From: Florian Schmaus
Date: Sat, 14 Feb 2015 16:21:26 +0100
Subject: [PATCH 0003/2111] Remove deprecated Packet class
---
.../org/jivesoftware/smack/packet/Packet.java | 232 ------------------
.../org/jivesoftware/smack/packet/Stanza.java | 3 +-
2 files changed, 1 insertion(+), 234 deletions(-)
delete mode 100644 smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java
deleted file mode 100644
index 55f301ed4..000000000
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/**
- *
- * Copyright 2003-2007 Jive Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jivesoftware.smack.packet;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Deprecated interface of pre Smack 4.1 Stanzas.
- * @deprecated use {@link Stanza} instead
- */
-@Deprecated
-public interface Packet extends TopLevelStreamElement {
-
- public static final String TEXT = "text";
- public static final String ITEM = "item";
-
- /**
- * Returns the unique ID of the stanza. The returned value could be
null
.
- *
- * @return the packet's unique ID or null
if the id is not available.
- */
- public String getStanzaId();
-
- /**
- *
- * @return the stanza id.
- * @deprecated use {@link #getStanzaId()} instead.
- */
- @Deprecated
- public String getPacketID();
-
- /**
- * Sets the unique ID of the packet. To indicate that a packet has no id
- * pass null
as the packet's id value.
- *
- * @param id the unique ID for the packet.
- */
- public void setStanzaId(String id);
-
- /**
- *
- * @param packetID
- * @deprecated use {@link #setStanzaId(String)} instead.
- */
- @Deprecated
- public void setPacketID(String packetID);
-
- /**
- * Returns who the packet is being sent "to", or null if
- * the value is not set. The XMPP protocol often makes the "to"
- * attribute optional, so it does not always need to be set.
- *
- * @return who the packet is being sent to, or null if the
- * value has not been set.
- */
- public String getTo();
-
- /**
- * Sets who the packet is being sent "to". The XMPP protocol often makes
- * the "to" attribute optional, so it does not always need to be set.
- *
- * @param to who the packet is being sent to.
- */
- public void setTo(String to);
-
- /**
- * Returns who the packet is being sent "from" or null if
- * the value is not set. The XMPP protocol often makes the "from"
- * attribute optional, so it does not always need to be set.
- *
- * @return who the packet is being sent from, or null if the
- * value has not been set.
- */
- public String getFrom();
-
- /**
- * Sets who the packet is being sent "from". The XMPP protocol often
- * makes the "from" attribute optional, so it does not always need to
- * be set.
- *
- * @param from who the packet is being sent to.
- */
- public void setFrom(String from);
-
- /**
- * Returns the error associated with this packet, or null if there are
- * no errors.
- *
- * @return the error sub-packet or null if there isn't an error.
- */
- public XMPPError getError();
- /**
- * Sets the error for this packet.
- *
- * @param error the error to associate with this packet.
- */
- public void setError(XMPPError error);
-
- /**
- * Returns the xml:lang of this Stanza, or null if one has not been set.
- *
- * @return the xml:lang of this Stanza, or null.
- */
- public String getLanguage();
-
- /**
- * Sets the xml:lang of this Stanza.
- *
- * @param language the xml:lang of this Stanza.
- */
- public void setLanguage(String language);
-
- /**
- * Returns a copy of the packet extensions attached to the packet.
- *
- * @return the packet extensions.
- */
- public List getExtensions();
-
- /**
- * Return a set of all extensions with the given element name and namespace.
- *
- * Changes to the returned set will update the packet extensions, if the returned set is not the empty set.
- *
- *
- * @param elementName the element name, must not be null.
- * @param namespace the namespace of the element(s), must not be null.
- * @return a set of all matching extensions.
- * @since 4.1
- */
- public Set getExtensions(String elementName, String namespace);
-
- /**
- * Returns the first extension of this packet that has the given namespace.
- *
- * When possible, use {@link #getExtension(String,String)} instead.
- *
- *
- * @param namespace the namespace of the extension that is desired.
- * @return the packet extension with the given namespace.
- */
- public PacketExtension getExtension(String namespace);
-
- /**
- * Returns the first packet extension that matches the specified element name and
- * namespace, or null if it doesn't exist. If the provided elementName is null,
- * only the namespace is matched. Packet extensions are
- * are arbitrary XML sub-documents in standard XMPP packets. By default, a
- * DefaultPacketExtension instance will be returned for each extension. However,
- * PacketExtensionProvider instances can be registered with the
- * {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}
- * class to handle custom parsing. In that case, the type of the Object
- * will be determined by the provider.
- *
- * @param elementName the XML element name of the packet extension. (May be null)
- * @param namespace the XML element namespace of the packet extension.
- * @return the extension, or null if it doesn't exist.
- */
- public PE getExtension(String elementName, String namespace);
- /**
- * Adds a packet extension to the packet. Does nothing if extension is null.
- *
- * @param extension a packet extension.
- */
- public void addExtension(PacketExtension extension);
-
- /**
- * Adds a collection of packet extensions to the packet. Does nothing if extensions is null.
- *
- * @param extensions a collection of packet extensions
- */
- public void addExtensions(Collection extensions);
-
- /**
- * Check if a packet extension with the given element and namespace exists.
- *
- * The argument elementName
may be null.
- *
- *
- * @param elementName
- * @param namespace
- * @return true if a packet extension exists, false otherwise.
- */
- public boolean hasExtension(String elementName, String namespace);
-
- /**
- * Check if a packet extension with the given namespace exists.
- *
- * @param namespace
- * @return true if a packet extension exists, false otherwise.
- */
- public boolean hasExtension(String namespace);
-
- /**
- * Remove the packet extension with the given elementName and namespace.
- *
- * @param elementName
- * @param namespace
- * @return the removed packet extension or null.
- */
- public PacketExtension removeExtension(String elementName, String namespace);
-
- /**
- * Removes a packet extension from the packet.
- *
- * @param extension the packet extension to remove.
- * @return the removed packet extension or null.
- */
- public PacketExtension removeExtension(PacketExtension extension);
-
- @Override
- // NOTE When Smack is using Java 8, then this method should be moved in Element as "Default Method".
- public String toString();
-
-}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
index 4e341b023..205ce160b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
@@ -45,8 +45,7 @@ import java.util.Set;
* @author Matt Tucker
* @see RFC 6120 § 8. XML Stanzas
*/
-@SuppressWarnings("deprecation") // FIXME Remove when 'Packet' is removed from Smack
-public abstract class Stanza implements TopLevelStreamElement, Packet {
+public abstract class Stanza implements TopLevelStreamElement {
public static final String TEXT = "text";
public static final String ITEM = "item";
From 5bb4727c5755972b31cd1f969fe86311036488ee Mon Sep 17 00:00:00 2001
From: Florian Schmaus
Date: Sat, 14 Feb 2015 17:15:02 +0100
Subject: [PATCH 0004/2111] Use Jid (and subclasses) from jxmpp-jid
Fixes SMACK-634
---
.../smack/bosh/XMPPBOSHConnection.java | 7 +-
smack-core/build.gradle | 3 +-
.../smack/AbstractXMPPConnection.java | 17 +-
.../smack/ConnectionConfiguration.java | 9 +-
.../jivesoftware/smack/SmackException.java | 7 +-
.../jivesoftware/smack/XMPPConnection.java | 6 +-
.../smack/debugger/AbstractDebugger.java | 9 +-
.../smack/debugger/SmackDebugger.java | 3 +-
.../smack/filter/FromMatchesFilter.java | 42 ++---
.../smack/filter/IQReplyFilter.java | 26 ++-
.../jivesoftware/smack/filter/ToFilter.java | 12 +-
.../org/jivesoftware/smack/packet/Bind.java | 10 +-
.../jivesoftware/smack/packet/Message.java | 7 +-
.../org/jivesoftware/smack/packet/Stanza.java | 52 +++++-
.../smack/provider/BindIQProvider.java | 5 +-
.../smack/sasl/SASLMechanism.java | 13 +-
.../smack/util/PacketParserUtils.java | 13 +-
.../jivesoftware/smack/util/ParserUtils.java | 24 +++
.../smack/util/XmlStringBuilder.java | 32 ++++
.../jivesoftware/smack/DummyConnection.java | 31 ++--
.../smack/filters/FromMatchesFilterTest.java | 19 ++-
.../smack/packet/IQResponseTest.java | 30 ++--
.../smack/sasl/DigestMd5SaslTest.java | 6 +-
.../sasl/core/SCRAMSHA1MechanismTest.java | 3 +-
.../test/util/WaitForPacketListener.java | 2 +-
.../debugger/slf4j/SLF4JSmackDebugger.java | 15 +-
.../smackx/debugger/EnhancedDebugger.java | 13 +-
.../smackx/debugger/LiteDebugger.java | 13 +-
.../jivesoftware/smackx/hoxt/HOXTManager.java | 3 +-
.../smackx/carbons/CarbonTest.java | 4 +-
.../smackx/address/MultipleRecipientInfo.java | 4 +-
.../address/MultipleRecipientManager.java | 55 ++++---
.../address/packet/MultipleAddresses.java | 9 +-
.../provider/MultipleAddressesProvider.java | 4 +-
.../jivesoftware/smackx/amp/AMPManager.java | 8 +-
.../bytestreams/BytestreamListener.java | 2 +-
.../smackx/bytestreams/BytestreamManager.java | 21 +--
.../smackx/bytestreams/BytestreamRequest.java | 3 +-
.../ibb/InBandBytestreamListener.java | 2 +-
.../ibb/InBandBytestreamManager.java | 19 +--
.../ibb/InBandBytestreamRequest.java | 3 +-
.../ibb/InBandBytestreamSession.java | 7 +-
.../socks5/Socks5BytestreamListener.java | 2 +-
.../socks5/Socks5BytestreamManager.java | 41 ++---
.../socks5/Socks5BytestreamRequest.java | 3 +-
.../socks5/Socks5ClientForInitiator.java | 6 +-
.../bytestreams/socks5/Socks5Proxy.java | 2 +-
.../bytestreams/socks5/Socks5Utils.java | 3 +-
.../bytestreams/socks5/packet/Bytestream.java | 31 ++--
.../socks5/provider/BytestreamsProvider.java | 10 +-
.../smackx/caps/EntityCapsManager.java | 18 ++-
.../smackx/commands/AdHocCommand.java | 3 +-
.../smackx/commands/AdHocCommandManager.java | 13 +-
.../smackx/commands/LocalCommand.java | 9 +-
.../smackx/commands/RemoteCommand.java | 7 +-
.../commands/packet/AdHocCommandData.java | 7 +-
.../smackx/disco/ServiceDiscoveryManager.java | 32 ++--
.../smackx/disco/packet/DiscoverItems.java | 7 +-
.../disco/provider/DiscoverItemsProvider.java | 6 +-
.../filetransfer/FaultTolerantNegotiator.java | 5 +-
.../smackx/filetransfer/FileTransfer.java | 8 +-
.../filetransfer/FileTransferManager.java | 13 +-
.../filetransfer/FileTransferNegotiator.java | 3 +-
.../filetransfer/FileTransferRequest.java | 3 +-
.../filetransfer/IBBTransferNegotiator.java | 7 +-
.../filetransfer/OutgoingFileTransfer.java | 5 +-
.../Socks5TransferNegotiator.java | 5 +-
.../smackx/filetransfer/StreamNegotiator.java | 5 +-
.../smackx/iqlast/LastActivityManager.java | 5 +-
.../smackx/iqlast/packet/LastActivity.java | 3 +-
.../smackx/iqregister/AccountManager.java | 3 +-
.../smackx/iqversion/VersionManager.java | 5 +-
.../smackx/iqversion/packet/Version.java | 3 +-
.../jivesoftware/smackx/muc/Affiliate.java | 10 +-
.../muc/DefaultParticipantStatusListener.java | 34 ++--
.../smackx/muc/DefaultUserStatusListener.java | 6 +-
.../jivesoftware/smackx/muc/HostedRoom.java | 11 +-
.../smackx/muc/MultiUserChat.java | 150 ++++++++++--------
.../smackx/muc/MultiUserChatManager.java | 55 ++++---
.../org/jivesoftware/smackx/muc/Occupant.java | 25 ++-
.../smackx/muc/ParticipantStatusListener.java | 34 ++--
.../org/jivesoftware/smackx/muc/RoomInfo.java | 15 +-
.../smackx/muc/SubjectUpdatedListener.java | 4 +-
.../smackx/muc/UserStatusListener.java | 6 +-
.../smackx/muc/packet/MUCItem.java | 26 +--
.../smackx/muc/provider/MUCParserUtils.java | 11 +-
.../smackx/offline/OfflineMessageHeader.java | 5 +-
.../jivesoftware/smackx/pep/PEPListener.java | 3 +-
.../jivesoftware/smackx/pep/PEPManager.java | 3 +-
.../jivesoftware/smackx/ping/PingManager.java | 23 +--
.../jivesoftware/smackx/ping/packet/Ping.java | 5 +-
.../smackx/privacy/packet/PrivacyItem.java | 18 +++
.../org/jivesoftware/smackx/pubsub/Node.java | 5 +-
.../smackx/pubsub/PubSubManager.java | 15 +-
.../smackx/pubsub/packet/PubSub.java | 5 +-
.../receipts/DeliveryReceiptManager.java | 5 +-
.../receipts/ReceiptReceivedListener.java | 3 +-
.../smackx/search/UserSearch.java | 7 +-
.../smackx/search/UserSearchManager.java | 7 +-
.../smackx/time/EntityTimeManager.java | 5 +-
.../smackx/vcardtemp/VCardManager.java | 10 +-
.../smackx/vcardtemp/packet/VCard.java | 5 +-
.../smackx/xdata/XDataManager.java | 3 +-
.../smackx/xhtmlim/XHTMLManager.java | 3 +-
.../bytestreams/ibb/CloseListenerTest.java | 6 +-
.../bytestreams/ibb/DataListenerTest.java | 6 +-
.../bytestreams/ibb/IBBPacketUtils.java | 5 +-
.../ibb/InBandBytestreamManagerTest.java | 11 +-
.../ibb/InBandBytestreamRequestTest.java | 6 +-
.../InBandBytestreamSessionMessageTest.java | 9 +-
.../ibb/InBandBytestreamSessionTest.java | 9 +-
.../ibb/InitiationListenerTest.java | 13 +-
.../bytestreams/ibb/packet/CloseTest.java | 6 +-
.../bytestreams/ibb/packet/DataTest.java | 5 +-
.../bytestreams/ibb/packet/OpenTest.java | 5 +-
.../socks5/InitiationListenerTest.java | 18 ++-
.../socks5/Socks5ByteStreamManagerTest.java | 62 ++++----
.../socks5/Socks5ByteStreamRequestTest.java | 16 +-
.../socks5/Socks5ClientForInitiatorTest.java | 11 +-
.../bytestreams/socks5/Socks5ClientTest.java | 4 +-
.../bytestreams/socks5/Socks5PacketUtils.java | 11 +-
.../smackx/caps/EntityCapsManagerTest.java | 21 +--
.../FileTransferNegotiatorTest.java | 3 +-
.../smackx/forward/ForwardedTest.java | 6 +-
.../smackx/iqversion/VersionTest.java | 4 +-
.../jivesoftware/smackx/ping/PingTest.java | 17 +-
.../smackx/pubsub/ConfigureFormTest.java | 3 +-
.../smackx/receipts/DeliveryReceiptTest.java | 22 +--
.../jivesoftware/util/ConnectionUtils.java | 4 +-
.../org/jivesoftware/smack/chat/Chat.java | 7 +-
.../jivesoftware/smack/chat/ChatManager.java | 38 +++--
.../org/jivesoftware/smack/roster/Roster.java | 145 +++++++++--------
.../smack/roster/RosterEntry.java | 7 +-
.../smack/roster/RosterListener.java | 9 +-
.../smack/roster/packet/RosterPacket.java | 10 +-
.../roster/provider/RosterPacketProvider.java | 5 +-
.../rosterstore/DirectoryRosterStore.java | 17 +-
.../smack/roster/rosterstore/RosterStore.java | 5 +-
.../smack/chat/ChatConnectionTest.java | 24 ++-
.../smack/roster/RosterOfflineTest.java | 5 -
.../jivesoftware/smack/roster/RosterTest.java | 135 ++++++++++------
.../smack/roster/RosterVersioningTest.java | 25 +--
.../rosterstore/DirectoryRosterStoreTest.java | 17 +-
.../smackx/jingleold/JingleManager.java | 20 +--
.../smackx/jingleold/JingleSession.java | 27 ++--
.../jingleold/JingleSessionRequest.java | 3 +-
.../jingleold/nat/TransportCandidate.java | 5 +-
.../smackx/jingleold/packet/Jingle.java | 15 +-
.../jingleold/provider/JingleProvider.java | 10 +-
.../smackx/workgroup/WorkgroupInvitation.java | 26 +--
.../smackx/workgroup/agent/Agent.java | 9 +-
.../smackx/workgroup/agent/AgentRoster.java | 51 +++---
.../smackx/workgroup/agent/AgentSession.java | 27 ++--
.../smackx/workgroup/agent/Offer.java | 21 +--
.../workgroup/agent/OfferConfirmation.java | 5 +-
.../smackx/workgroup/agent/RevokedOffer.java | 16 +-
.../workgroup/agent/TranscriptManager.java | 9 +-
.../agent/TranscriptSearchManager.java | 9 +-
.../workgroup/agent/WorkgroupQueue.java | 7 +-
.../workgroup/packet/AgentWorkgroups.java | 12 +-
.../workgroup/packet/DepartQueuePacket.java | 7 +-
.../packet/OfferRequestProvider.java | 18 ++-
.../workgroup/packet/OfferRevokeProvider.java | 18 ++-
.../smackx/workgroup/packet/Transcripts.java | 9 +-
.../workgroup/packet/TranscriptsProvider.java | 4 +-
.../smackx/workgroup/packet/UserID.java | 10 +-
.../smackx/workgroup/user/Workgroup.java | 23 +--
.../DefaultMessageEventRequestListener.java | 9 +-
.../smackx/xevent/MessageEventManager.java | 13 +-
.../xevent/MessageEventRequestListener.java | 9 +-
.../smackx/xroster/RemoteRosterEntry.java | 8 +-
.../xroster/RosterExchangeListener.java | 4 +-
.../smackx/xroster/RosterExchangeManager.java | 9 +-
.../provider/RosterExchangeProvider.java | 6 +-
.../smack/sasl/javax/SASLJavaXMechanism.java | 4 +-
.../smack/sasl/javax/SASLDigestMD5Test.java | 3 +-
.../sasl/provided/SASLDigestMD5Test.java | 3 +-
.../smack/tcp/XMPPTCPConnection.java | 12 +-
.../smack/tcp/PacketWriterTest.java | 4 +-
version.gradle | 2 +-
180 files changed, 1510 insertions(+), 1032 deletions(-)
diff --git a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
index bddd37851..39ec4b976 100644
--- a/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
+++ b/smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java
@@ -43,6 +43,7 @@ import org.jivesoftware.smack.packet.Presence.Type;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
import org.jivesoftware.smack.util.PacketParserUtils;
+import org.jxmpp.jid.DomainBareJid;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
import org.igniterealtime.jbosh.AbstractBody;
@@ -116,7 +117,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
* @param xmppDomain the XMPP service name
* (e.g. domain.lt for the user alice@domain.lt)
*/
- public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, String xmppDomain) {
+ public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, DomainBareJid xmppDomain) {
this(BOSHConfiguration.builder().setUseHttps(https).setHost(host)
.setPort(port).setFile(filePath).setServiceName(xmppDomain)
.setUsernameAndPassword(username, password).build());
@@ -145,7 +146,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
// Initialize BOSH client
BOSHClientConfig.Builder cfgBuilder = BOSHClientConfig.Builder
- .create(config.getURI(), config.getServiceName());
+ .create(config.getURI(), config.getServiceName().toString());
if (config.isProxyEnabled()) {
cfgBuilder.setProxy(config.getProxyAddress(), config.getProxyPort());
}
@@ -537,7 +538,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
XMPPBOSHConnection.XMPP_BOSH_NS).setAttribute(
BodyQName.createWithPrefix(XMPPBOSHConnection.XMPP_BOSH_NS, "restart",
"xmpp"), "true").setAttribute(
- BodyQName.create(XMPPBOSHConnection.BOSH_URI, "to"), getServiceName()).build());
+ BodyQName.create(XMPPBOSHConnection.BOSH_URI, "to"), getServiceName().toString()).build());
Success success = new Success(parser.nextText());
getSASLAuthentication().authenticated(success);
break;
diff --git a/smack-core/build.gradle b/smack-core/build.gradle
index c350291bb..9b2f6c973 100644
--- a/smack-core/build.gradle
+++ b/smack-core/build.gradle
@@ -9,7 +9,8 @@ Smack core components."""
dependencies {
compile 'xpp3:xpp3:1.1.4c'
compile "org.jxmpp:jxmpp-core:$jxmppVersion"
- // compile "org.igniterealtime.jxmpp:jxmpp-jid:$jxmppVersion"
+ compile "org.jxmpp:jxmpp-jid:$jxmppVersion"
+ testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
testCompile 'junit:junit:4.11'
testCompile 'xmlunit:xmlunit:1.5'
testCompile 'org.powermock:powermock-module-junit4:1.5.5'
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 5bdb0fa60..7ab1e558f 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
@@ -81,6 +81,9 @@ import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.util.SmackExecutorThreadFactory;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.dns.HostAddress;
+import org.jxmpp.jid.DomainBareJid;
+import org.jxmpp.jid.FullJid;
+import org.jxmpp.jid.Jid;
import org.jxmpp.util.XmppStringUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -164,7 +167,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* certificate.
*
*/
- protected String user;
+ protected FullJid user;
protected boolean connected = false;
@@ -342,7 +345,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
@Override
- public String getServiceName() {
+ public DomainBareJid getServiceName() {
if (serviceName != null) {
return serviceName;
}
@@ -510,7 +513,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
@Override
- public final String getUser() {
+ public final FullJid getUser() {
return user;
}
@@ -550,7 +553,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// from the login() arguments and the configurations service name, as, for example, when SASL External is used,
// the username is not given to login but taken from the 'external' certificate.
user = response.getJid();
- serviceName = XmppStringUtils.parseDomain(user);
+ serviceName = user.asDomainBareJid();
Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE);
// Only bind the session if it's announced as stream feature by the server, is not optional and not disabled
@@ -590,7 +593,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
&& !config.allowNullOrEmptyUsername;
}
- private String serviceName;
+ private DomainBareJid serviceName;
protected List hostAddresses;
@@ -608,7 +611,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
hostAddress = new HostAddress(config.host, config.port);
hostAddresses.add(hostAddress);
} else {
- hostAddresses = DNSUtil.resolveXMPPDomain(config.serviceName, failedAddresses);
+ hostAddresses = DNSUtil.resolveXMPPDomain(config.serviceName.toString(), failedAddresses);
}
// If we reach this, then hostAddresses *must not* be empty, i.e. there is at least one host added, either the
// config.host one or the host representing the service name by DNSUtil
@@ -645,7 +648,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
throwNotConnectedExceptionIfAppropriate();
switch (fromMode) {
case OMITTED:
- packet.setFrom(null);
+ packet.setFrom((Jid) null);
break;
case USER:
packet.setFrom(getUser());
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java
index 125c691ed..e40d7c3f1 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java
@@ -19,6 +19,7 @@ package org.jivesoftware.smack;
import org.jivesoftware.smack.packet.Session;
import org.jivesoftware.smack.proxy.ProxyInfo;
+import org.jxmpp.jid.DomainBareJid;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
@@ -43,7 +44,7 @@ public abstract class ConnectionConfiguration {
* of the server. However, there are some servers like google where host would be
* talk.google.com and the serviceName would be gmail.com.
*/
- protected final String serviceName;
+ protected final DomainBareJid serviceName;
protected final String host;
protected final int port;
@@ -136,7 +137,7 @@ public abstract class ConnectionConfiguration {
*
* @return the server name of the target server.
*/
- public String getServiceName() {
+ public DomainBareJid getServiceName() {
return serviceName;
}
@@ -382,7 +383,7 @@ public abstract class ConnectionConfiguration {
private CallbackHandler callbackHandler;
private boolean debuggerEnabled = SmackConfiguration.DEBUG;
private SocketFactory socketFactory;
- private String serviceName;
+ private DomainBareJid serviceName;
private String host;
private int port = 5222;
private boolean allowEmptyOrNullUsername = false;
@@ -413,7 +414,7 @@ public abstract class ConnectionConfiguration {
* @param serviceName the service name
* @return a reference to this builder.
*/
- public B setServiceName(String serviceName) {
+ public B setServiceName(DomainBareJid serviceName) {
this.serviceName = serviceName;
return getThis();
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java
index 807f68ef1..d0c747800 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.util.dns.HostAddress;
+import org.jxmpp.jid.Jid;
/**
* Smack uses SmackExceptions for errors that are not defined by any XMPP specification.
@@ -225,13 +226,13 @@ public class SmackException extends Exception {
private static final long serialVersionUID = 4713404802621452016L;
private final String feature;
- private final String jid;
+ private final Jid jid;
public FeatureNotSupportedException(String feature) {
this(feature, null);
}
- public FeatureNotSupportedException(String feature, String jid) {
+ public FeatureNotSupportedException(String feature, Jid jid) {
super(feature + " not supported" + (jid == null ? "" : " by '" + jid + "'"));
this.jid = jid;
this.feature = feature;
@@ -252,7 +253,7 @@ public class SmackException extends Exception {
*
* @return the JID which does not support the feature, or null
*/
- public String getJid() {
+ public Jid getJid() {
return jid;
}
}
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 89877edd8..4cc9de333 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
@@ -26,6 +26,8 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.packet.PlainStreamElement;
+import org.jxmpp.jid.DomainBareJid;
+import org.jxmpp.jid.FullJid;
/**
* The XMPPConnection interface provides an interface for connections to an XMPP server and
@@ -78,7 +80,7 @@ public interface XMPPConnection {
*
* @return the name of the service provided by the XMPP server.
*/
- public String getServiceName();
+ public DomainBareJid getServiceName();
/**
* Returns the host name of the server where the XMPP server is running. This would be the
@@ -103,7 +105,7 @@ public interface XMPPConnection {
*
* @return the full XMPP address of the user logged in.
*/
- public String getUser();
+ public FullJid getUser();
/**
* Returns the stream ID for this connection, which is the value set by the server
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java b/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java
index 199167f02..758738fc8 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java
@@ -24,7 +24,7 @@ import org.jivesoftware.smack.util.ObservableReader;
import org.jivesoftware.smack.util.ObservableWriter;
import org.jivesoftware.smack.util.ReaderListener;
import org.jivesoftware.smack.util.WriterListener;
-import org.jxmpp.util.XmppStringUtils;
+import org.jxmpp.jid.FullJid;
import java.io.Reader;
import java.io.Writer;
@@ -141,8 +141,9 @@ public abstract class AbstractDebugger implements SmackDebugger {
return writer;
}
- public void userHasLogged(String user) {
- String localpart = XmppStringUtils.parseLocalpart(user);
+ @Override
+ public void userHasLogged(FullJid user) {
+ String localpart = user.getLocalpart().toString();
boolean isAnonymous = "".equals(localpart);
String title =
"User logged (" + connection.getConnectionCounter() + "): "
@@ -151,7 +152,7 @@ public abstract class AbstractDebugger implements SmackDebugger {
+ connection.getServiceName()
+ ":"
+ connection.getPort();
- title += "/" + XmppStringUtils.parseResource(user);
+ title += "/" + user.getResourcepart();
log(title);
// Add the connection listener to the connection so that the debugger can be notified
// whenever the connection is closed.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/debugger/SmackDebugger.java b/smack-core/src/main/java/org/jivesoftware/smack/debugger/SmackDebugger.java
index 6bef09459..b4f85d857 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/debugger/SmackDebugger.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/debugger/SmackDebugger.java
@@ -21,6 +21,7 @@ import java.io.Reader;
import java.io.Writer;
import org.jivesoftware.smack.PacketListener;
+import org.jxmpp.jid.FullJid;
/**
* Interface that allows for implementing classes to debug XML traffic. That is a GUI window that
@@ -40,7 +41,7 @@ public interface SmackDebugger {
*
* @param user the user@host/resource that has just logged in
*/
- public abstract void userHasLogged(String user);
+ public abstract void userHasLogged(FullJid user);
/**
* Returns the special Reader that wraps the main Reader and logs data to the GUI.
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java
index ee570aa78..78af6cdca 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java
@@ -17,10 +17,8 @@
package org.jivesoftware.smack.filter;
-import java.util.Locale;
-
import org.jivesoftware.smack.packet.Stanza;
-import org.jxmpp.util.XmppStringUtils;
+import org.jxmpp.jid.Jid;
/**
* Filter for packets where the "from" field exactly matches a specified JID. If the specified
@@ -32,12 +30,12 @@ import org.jxmpp.util.XmppStringUtils;
*/
public class FromMatchesFilter implements PacketFilter {
- private final String address;
+ private final Jid address;
/**
* Flag that indicates if the checking will be done against bare JID addresses or full JIDs.
*/
- private final boolean matchBareJID;
+ private final boolean ignoreResourcepart;
/**
* Creates a filter matching on the "from" field. The from address must be the same as the
@@ -46,11 +44,16 @@ public class FromMatchesFilter implements PacketFilter {
*
* @param address The address to filter for. If null
is given, the packet must not
* have a from address.
- * @param matchBare
+ * @param ignoreResourcepart
*/
- public FromMatchesFilter(String address, boolean matchBare) {
- this.address = (address == null) ? null : address.toLowerCase(Locale.US);
- matchBareJID = matchBare;
+ public FromMatchesFilter(Jid address, boolean ignoreResourcepart) {
+ if (address != null && ignoreResourcepart) {
+ this.address = address.withoutResource();
+ }
+ else {
+ this.address = address;
+ }
+ this.ignoreResourcepart = ignoreResourcepart;
}
/**
@@ -61,8 +64,8 @@ public class FromMatchesFilter implements PacketFilter {
* @param address The address to filter for. If null
is given, the packet must not
* have a from address.
*/
- public static FromMatchesFilter create(String address) {
- return new FromMatchesFilter(address, "".equals(XmppStringUtils.parseResource(address))) ;
+ public static FromMatchesFilter create(Jid address) {
+ return new FromMatchesFilter(address, address.hasNoResource()) ;
}
/**
@@ -72,8 +75,8 @@ public class FromMatchesFilter implements PacketFilter {
* @param address The address to filter for. If null
is given, the packet must not
* have a from address.
*/
- public static FromMatchesFilter createBare(String address) {
- address = (address == null) ? null : XmppStringUtils.parseBareJid(address);
+ public static FromMatchesFilter createBare(Jid address) {
+ address = (address == null) ? null : address;
return new FromMatchesFilter(address, true);
}
@@ -85,25 +88,24 @@ public class FromMatchesFilter implements PacketFilter {
* @param address The address to filter for. If null
is given, the packet must not
* have a from address.
*/
- public static FromMatchesFilter createFull(String address) {
+ public static FromMatchesFilter createFull(Jid address) {
return new FromMatchesFilter(address, false);
}
public boolean accept(Stanza packet) {
- String from = packet.getFrom();
+ Jid from = packet.getFrom();
if (from == null) {
return address == null;
}
- // Simplest form of NAMEPREP/STRINGPREP
- from = from.toLowerCase(Locale.US);
- if (matchBareJID) {
- from = XmppStringUtils.parseBareJid(from);
+
+ if (ignoreResourcepart) {
+ from = from.withoutResource();
}
return from.equals(address);
}
public String toString() {
- String matchMode = matchBareJID ? "bare" : "full";
+ String matchMode = ignoreResourcepart ? "ignoreResourcepart" : "full";
return "FromMatchesFilter (" +matchMode + "): " + address;
}
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java
index fc0673548..499029563 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java
@@ -16,14 +16,15 @@
*/
package org.jivesoftware.smack.filter;
-import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Stanza;
-import org.jxmpp.util.XmppStringUtils;
+import org.jxmpp.jid.DomainBareJid;
+import org.jxmpp.jid.FullJid;
+import org.jxmpp.jid.Jid;
/**
* Filters for packets which are a valid reply to an IQ request.
@@ -53,9 +54,9 @@ public class IQReplyFilter implements PacketFilter {
private final PacketFilter iqAndIdFilter;
private final OrFilter fromFilter;
- private final String to;
- private final String local;
- private final String server;
+ private final Jid to;
+ private final FullJid local;
+ private final DomainBareJid server;
private final String packetId;
/**
@@ -84,18 +85,13 @@ public class IQReplyFilter implements PacketFilter {
if (!iqPacket.isRequestIQ()) {
throw new IllegalArgumentException("IQ must be a request IQ, i.e. of type 'get' or 'set'.");
}
- if (iqPacket.getTo() != null) {
- to = iqPacket.getTo().toLowerCase(Locale.US);
- } else {
- to = null;
- }
- final String localJid = conn.getUser();
- if (localJid == null) {
+ to = iqPacket.getTo();
+ local = conn.getUser();
+ if (local == null) {
throw new IllegalArgumentException("Must have a local (user) JID set. Either you didn't configure one or you where not connected at least once");
}
- local = localJid.toLowerCase(Locale.US);
- server = conn.getServiceName().toLowerCase(Locale.US);
+ server = conn.getServiceName();
packetId = iqPacket.getStanzaId();
PacketFilter iqFilter = new OrFilter(IQTypeFilter.ERROR, IQTypeFilter.RESULT);
@@ -107,7 +103,7 @@ public class IQReplyFilter implements PacketFilter {
fromFilter.addFilter(FromMatchesFilter.createBare(local));
fromFilter.addFilter(FromMatchesFilter.createFull(server));
}
- else if (to.equals(XmppStringUtils.parseBareJid(local))) {
+ else if (to.equals(local.asBareJid())) {
fromFilter.addFilter(FromMatchesFilter.createFull(null));
}
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java
index cfb0d3ed4..e0fd2f900 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java
@@ -16,25 +16,23 @@
*/
package org.jivesoftware.smack.filter;
-import java.util.Locale;
-
import org.jivesoftware.smack.packet.Stanza;
+import org.jxmpp.jid.Jid;
public class ToFilter implements PacketFilter {
- private final String to;
+ private final Jid to;
- public ToFilter(String to) {
- this.to = to.toLowerCase(Locale.US);
+ public ToFilter(Jid to) {
+ this.to = to;
}
@Override
public boolean accept(Stanza packet) {
- String packetTo = packet.getTo();
+ Jid packetTo = packet.getTo();
if (packetTo == null) {
return false;
}
- packetTo = packetTo.toLowerCase(Locale.US);
return packetTo.equals(to);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java
index df59cc5f6..5001bcc1f 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java
@@ -17,6 +17,8 @@
package org.jivesoftware.smack.packet;
+import org.jxmpp.jid.FullJid;
+
/**
* IQ packet used by Smack to bind a resource and to obtain the jid assigned by the server.
* There are two ways to bind a resource. One is simply sending an empty Bind packet where the
@@ -34,9 +36,9 @@ public class Bind extends IQ {
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-bind";
private final String resource;
- private final String jid;
+ private final FullJid jid;
- public Bind(String resource, String jid) {
+ public Bind(String resource, FullJid jid) {
super(ELEMENT, NAMESPACE);
this.resource = resource;
this.jid = jid;
@@ -46,7 +48,7 @@ public class Bind extends IQ {
return resource;
}
- public String getJid() {
+ public FullJid getJid() {
return jid;
}
@@ -56,7 +58,7 @@ public class Bind extends IQ {
return bind;
}
- public static Bind newResult(String jid) {
+ public static Bind newResult(FullJid jid) {
return new Bind(null, jid);
}
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 22b25a810..2cd9e9209 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
@@ -25,6 +25,7 @@ import java.util.Locale;
import java.util.Set;
import org.jivesoftware.smack.util.XmlStringBuilder;
+import org.jxmpp.jid.Jid;
/**
* Represents XMPP message packets. A message can be one of several types:
@@ -72,7 +73,7 @@ public final class Message extends Stanza {
*
* @param to the recipient of the message.
*/
- public Message(String to) {
+ public Message(Jid to) {
setTo(to);
}
@@ -82,7 +83,7 @@ public final class Message extends Stanza {
* @param to the user to send the message to.
* @param type the message type.
*/
- public Message(String to, Type type) {
+ public Message(Jid to, Type type) {
this(to);
setType(type);
}
@@ -93,7 +94,7 @@ public final class Message extends Stanza {
* @param to the user to send the message to.
* @param body the body of the message.
*/
- public Message(String to, String body) {
+ public Message(Jid to, String body) {
this(to);
setBody(body);
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
index 205ce160b..09f91452b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
@@ -23,6 +23,9 @@ import org.jivesoftware.smack.packet.id.StanzaIdUtil;
import org.jivesoftware.smack.util.MultiMap;
import org.jivesoftware.smack.util.PacketUtil;
import org.jivesoftware.smack.util.XmlStringBuilder;
+import org.jxmpp.jid.Jid;
+import org.jxmpp.jid.impl.JidCreate;
+import org.jxmpp.stringprep.XmppStringprepException;
import org.jxmpp.util.XmppStringUtils;
import java.util.Collection;
@@ -56,8 +59,8 @@ public abstract class Stanza implements TopLevelStreamElement {
private final MultiMap packetExtensions = new MultiMap<>();
private String id = null;
- private String to = null;
- private String from = null;
+ private Jid to;
+ private Jid from;
private XMPPError error = null;
/**
@@ -154,7 +157,7 @@ public abstract class Stanza implements TopLevelStreamElement {
* @return who the packet is being sent to, or null if the
* value has not been set.
*/
- public String getTo() {
+ public Jid getTo() {
return to;
}
@@ -163,8 +166,28 @@ public abstract class Stanza implements TopLevelStreamElement {
* the "to" attribute optional, so it does not always need to be set.
*
* @param to who the packet is being sent to.
+ * @throws IllegalArgumentException if to is not a valid JID String.
+ * @deprecated use {@link #setTo(Jid)} instead.
*/
+ @Deprecated
public void setTo(String to) {
+ Jid jid;
+ try {
+ jid = JidCreate.from(to);
+ }
+ catch (XmppStringprepException e) {
+ throw new IllegalArgumentException(e);
+ }
+ setTo(jid);
+ }
+
+ /**
+ * Sets who the packet is being sent "to". The XMPP protocol often makes
+ * the "to" attribute optional, so it does not always need to be set.
+ *
+ * @param to who the packet is being sent to.
+ */
+ public void setTo(Jid to) {
this.to = to;
}
@@ -176,7 +199,7 @@ public abstract class Stanza implements TopLevelStreamElement {
* @return who the packet is being sent from, or null if the
* value has not been set.
*/
- public String getFrom() {
+ public Jid getFrom() {
return from;
}
@@ -186,8 +209,29 @@ public abstract class Stanza implements TopLevelStreamElement {
* be set.
*
* @param from who the packet is being sent to.
+ * @throws IllegalArgumentException if from is not a valid JID String.
+ * @deprecated use {@link #setFrom(Jid)} instead.
*/
+ @Deprecated
public void setFrom(String from) {
+ Jid jid;
+ try {
+ jid = JidCreate.from(from);
+ }
+ catch (XmppStringprepException e) {
+ throw new IllegalArgumentException(e);
+ }
+ setFrom(jid);
+ }
+
+ /**
+ * Sets who the packet is being sent "from". The XMPP protocol often
+ * makes the "from" attribute optional, so it does not always need to
+ * be set.
+ *
+ * @param from who the packet is being sent to.
+ */
+ public void setFrom(Jid from) {
this.from = from;
}
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java
index ea78378dc..031d130be 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/BindIQProvider.java
@@ -20,6 +20,8 @@ import java.io.IOException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.packet.Bind;
+import org.jxmpp.jid.FullJid;
+import org.jxmpp.jid.impl.JidCreate;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -40,7 +42,8 @@ public class BindIQProvider extends IQProvider {
bind = Bind.newSet(parser.nextText());
break;
case "jid":
- bind = Bind.newResult(parser.nextText());
+ FullJid fullJid = JidCreate.fullFrom(parser.nextText());
+ bind = Bind.newResult(fullJid);
break;
}
break;
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
index bde8b6310..b476186fa 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/SASLMechanism.java
@@ -24,6 +24,7 @@ import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Response;
import org.jivesoftware.smack.util.StringTransformer;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.stringencoder.Base64;
+import org.jxmpp.jid.DomainBareJid;
import javax.security.auth.callback.CallbackHandler;
@@ -33,9 +34,9 @@ import javax.security.auth.callback.CallbackHandler;
* {@link #getName()} -- returns the common name of the SASL mechanism.
*
* Subclasses will likely want to implement their own versions of these methods:
- * {@link #authenticate(String, String, String, String)} -- Initiate authentication stanza using the
+ * {@link #authenticate(String, String, DomainBareJid, String)} -- Initiate authentication stanza using the
* deprecated method.
- * {@link #authenticate(String, String, CallbackHandler)} -- Initiate authentication stanza
+ * {@link #authenticate(String, DomainBareJid, CallbackHandler)} -- Initiate authentication stanza
* using the CallbackHandler method.
* {@link #challengeReceived(String, boolean)} -- Handle a challenge from the server.
*
@@ -104,7 +105,7 @@ public abstract class SASLMechanism implements Comparable {
/**
* The name of the XMPP service
*/
- protected String serviceName;
+ protected DomainBareJid serviceName;
/**
* The users password
@@ -115,7 +116,7 @@ public abstract class SASLMechanism implements Comparable {
/**
* Builds and sends the auth stanza to the server. Note that this method of
* authentication is not recommended, since it is very inflexible. Use
- * {@link #authenticate(String, String, CallbackHandler)} whenever possible.
+ * {@link #authenticate(String, DomainBareJid, CallbackHandler)} whenever possible.
*
* Explanation of auth stanza:
*
@@ -160,7 +161,7 @@ public abstract class SASLMechanism implements Comparable {
* @throws NotConnectedException
* @throws InterruptedException
*/
- public final void authenticate(String username, String host, String serviceName, String password)
+ public final void authenticate(String username, String host, DomainBareJid serviceName, String password)
throws SmackException, NotConnectedException, InterruptedException {
this.authenticationId = username;
this.host = host;
@@ -184,7 +185,7 @@ public abstract class SASLMechanism implements Comparable {
* @throws NotConnectedException
* @throws InterruptedException
*/
- public void authenticate(String host,String serviceName, CallbackHandler cbh)
+ public void authenticate(String host, DomainBareJid serviceName, CallbackHandler cbh)
throws SmackException, NotConnectedException, InterruptedException {
this.host = host;
this.serviceName = serviceName;
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 54f994609..3652a974a 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
@@ -47,6 +47,7 @@ import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
+import org.jxmpp.jid.Jid;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
@@ -222,8 +223,8 @@ public class PacketParserUtils {
final int initialDepth = parser.getDepth();
Message message = new Message();
message.setStanzaId(parser.getAttributeValue("", "id"));
- message.setTo(parser.getAttributeValue("", "to"));
- message.setFrom(parser.getAttributeValue("", "from"));
+ message.setTo(ParserUtils.getJidAttribute(parser, "to"));
+ message.setFrom(ParserUtils.getJidAttribute(parser, "from"));
String typeString = parser.getAttributeValue("", "type");
if (typeString != null) {
message.setType(Message.Type.fromString(typeString));
@@ -527,8 +528,8 @@ public class PacketParserUtils {
type = Presence.Type.fromString(typeString);
}
Presence presence = new Presence(type);
- presence.setTo(parser.getAttributeValue("", "to"));
- presence.setFrom(parser.getAttributeValue("", "from"));
+ presence.setTo(ParserUtils.getJidAttribute(parser, "to"));
+ presence.setFrom(ParserUtils.getJidAttribute(parser, "from"));
presence.setStanzaId(parser.getAttributeValue("", "id"));
String language = getLanguageAttribute(parser);
@@ -606,8 +607,8 @@ public class PacketParserUtils {
XMPPError error = null;
final String id = parser.getAttributeValue("", "id");
- final String to = parser.getAttributeValue("", "to");
- final String from = parser.getAttributeValue("", "from");
+ final Jid to = ParserUtils.getJidAttribute(parser, "to");
+ final Jid from = ParserUtils.getJidAttribute(parser, "from");
final IQ.Type type = IQ.Type.fromString(parser.getAttributeValue("", "type"));
outerloop: while (true) {
diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
index acd2829f3..9091b4688 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
@@ -19,6 +19,10 @@ package org.jivesoftware.smack.util;
import java.io.IOException;
import java.util.Locale;
+import org.jxmpp.jid.Jid;
+import org.jxmpp.jid.impl.JidCreate;
+import org.jxmpp.jid.parts.Resourcepart;
+import org.jxmpp.stringprep.XmppStringprepException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -39,6 +43,26 @@ public class ParserUtils {
}
}
+ public static Jid getJidAttribute(XmlPullParser parser) throws XmppStringprepException {
+ return getJidAttribute(parser, "jid");
+ }
+
+ public static Jid getJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException {
+ final String jidString = parser.getAttributeValue("", name);
+ if (jidString == null) {
+ return null;
+ }
+ return JidCreate.from(jidString);
+ }
+
+ public static Resourcepart getResourcepartAttribute(XmlPullParser parser, String name) throws XmppStringprepException {
+ final String resourcepartString = parser.getAttributeValue("", name);
+ if (resourcepartString == null) {
+ return null;
+ }
+ return Resourcepart.from(resourcepartString);
+ }
+
/**
* Get the boolean value of an argument.
*
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 0f7ebe138..9de90788c 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
@@ -63,6 +63,16 @@ public class XmlStringBuilder implements Appendable, CharSequence {
return this;
}
+ /**
+ *
+ * @param name
+ * @param content
+ * @return the XmlStringBuilder
+ */
+ public XmlStringBuilder element(String name, CharSequence content) {
+ return element(name, content.toString());
+ }
+
public XmlStringBuilder element(String name, Enum> content) {
assert content != null;
element(name, content.name());
@@ -81,6 +91,13 @@ public class XmlStringBuilder implements Appendable, CharSequence {
return this;
}
+ public XmlStringBuilder optElement(String name, CharSequence content) {
+ if (content != null) {
+ element(name, content.toString());
+ }
+ return this;
+ }
+
public XmlStringBuilder optElement(Element element) {
if (element != null) {
append(element.toXML());
@@ -168,6 +185,10 @@ public class XmlStringBuilder implements Appendable, CharSequence {
return this;
}
+ public XmlStringBuilder attribute(String name, CharSequence value) {
+ return attribute(name, value.toString());
+ }
+
public XmlStringBuilder attribute(String name, Enum> value) {
assert value != null;
attribute(name, value.name());
@@ -186,6 +207,13 @@ public class XmlStringBuilder implements Appendable, CharSequence {
return this;
}
+ public XmlStringBuilder optAttribute(String name, CharSequence value) {
+ if (value != null) {
+ attribute(name, value.toString());
+ }
+ return this;
+ }
+
public XmlStringBuilder optAttribute(String name, Enum> value) {
if (value != null) {
attribute(name, value.toString());
@@ -244,6 +272,10 @@ public class XmlStringBuilder implements Appendable, CharSequence {
return this;
}
+ public XmlStringBuilder escape(CharSequence text) {
+ return escape(text.toString());
+ }
+
public XmlStringBuilder prelude(PacketExtension pe) {
return prelude(pe.getElementName(), pe.getNamespace());
}
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 bd103c17a..68e9438b9 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java
@@ -27,6 +27,10 @@ import java.util.concurrent.TimeUnit;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.PlainStreamElement;
import org.jivesoftware.smack.packet.TopLevelStreamElement;
+import org.jxmpp.jid.FullJid;
+import org.jxmpp.jid.JidTestUtil;
+import org.jxmpp.jid.impl.JidCreate;
+import org.jxmpp.stringprep.XmppStringprepException;
/**
* A dummy implementation of {@link XMPPConnection}, intended to be used during
@@ -51,7 +55,7 @@ public class DummyConnection extends AbstractXMPPConnection {
private final BlockingQueue queue = new LinkedBlockingQueue();
public static ConnectionConfiguration.Builder,?> getDummyConfigurationBuilder() {
- return DummyConnectionConfiguration.builder().setServiceName("example.org").setUsernameAndPassword("dummy",
+ return DummyConnectionConfiguration.builder().setServiceName(JidTestUtil.EXAMPLE_ORG).setUsernameAndPassword("dummy",
"dummypass");
}
@@ -59,17 +63,26 @@ public class DummyConnection extends AbstractXMPPConnection {
this(getDummyConfigurationBuilder().build());
}
+ private FullJid getUserJid() {
+ try {
+ return JidCreate.fullFrom(config.getUsername()
+ + "@"
+ + config.getServiceName()
+ + "/"
+ + (config.getResource() != null ? config.getResource() : "Test"));
+ }
+ catch (XmppStringprepException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
public DummyConnection(ConnectionConfiguration configuration) {
super(configuration);
for (ConnectionCreationListener listener : XMPPConnectionRegistry.getConnectionCreationListeners()) {
listener.connectionCreated(this);
}
- user = config.getUsername()
- + "@"
- + config.getServiceName()
- + "/"
- + (config.getResource() != null ? config.getResource() : "Test");
+ user = getUserJid();
}
@Override
@@ -104,11 +117,7 @@ public class DummyConnection extends AbstractXMPPConnection {
@Override
protected void loginNonAnonymously(String username, String password, String resource)
throws XMPPException {
- user = username
- + "@"
- + config.getServiceName()
- + "/"
- + (resource != null ? resource : "Test");
+ user = getUserJid();
authenticated = true;
}
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/filters/FromMatchesFilterTest.java b/smack-core/src/test/java/org/jivesoftware/smack/filters/FromMatchesFilterTest.java
index bc4077b89..d9bb8938e 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/filters/FromMatchesFilterTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/filters/FromMatchesFilterTest.java
@@ -22,6 +22,9 @@ import static org.junit.Assert.assertFalse;
import org.jivesoftware.smack.filter.FromMatchesFilter;
import org.jivesoftware.smack.packet.Stanza;
import org.junit.Test;
+import org.jxmpp.jid.FullJid;
+import org.jxmpp.jid.Jid;
+import org.jxmpp.jid.JidTestUtil;
/**
*
@@ -29,16 +32,16 @@ import org.junit.Test;
*
*/
public class FromMatchesFilterTest {
- private static final String BASE_JID1 = "ss@muc.myserver.com";
- private static final String FULL_JID1_R1 = BASE_JID1 + "/resource";
- private static final String FULL_JID1_R2 = BASE_JID1 + "/resource2";
- private static final String BASE_JID2 = "sss@muc.myserver.com";
- private static final String FULL_JID2 = BASE_JID2 + "/resource";
+ private static final Jid BASE_JID1 = JidTestUtil.BARE_JID_1;
+ private static final FullJid FULL_JID1_R1 = JidTestUtil.FULL_JID_1_RESOURCE_1;
+ private static final FullJid FULL_JID1_R2 = JidTestUtil.FULL_JID_1_RESOURCE_2;
+ private static final Jid BASE_JID2 = JidTestUtil.BARE_JID_2;
+ private static final Jid FULL_JID2 = JidTestUtil.FULL_JID_2_RESOURCE_1;
- private static final String BASE_JID3 = "ss@muc.myserver.comm.net";
+ private static final Jid BASE_JID3 = JidTestUtil.DUMMY_AT_EXAMPLE_ORG;
- private static final String SERVICE_JID1 = "muc.myserver.com";
- private static final String SERVICE_JID2 = "pubsub.myserver.com";
+ private static final Jid SERVICE_JID1 = JidTestUtil.MUC_EXAMPLE_ORG;
+ private static final Jid SERVICE_JID2 = JidTestUtil.PUBSUB_EXAMPLE_ORG;
@Test
public void autoCompareMatchingFullJid()
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java
index 10bfa0205..26d3827f4 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java
@@ -22,6 +22,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import org.junit.Test;
+import org.jxmpp.jid.impl.JidCreate;
+import org.jxmpp.stringprep.XmppStringprepException;
/**
* Tests that verifies the correct behavior of creating result and error IQ packets.
@@ -36,12 +38,13 @@ public class IQResponseTest {
/**
* Test creating a simple and empty IQ response.
+ * @throws XmppStringprepException
*/
@Test
- public void testGeneratingSimpleResponse() {
+ public void testGeneratingSimpleResponse() throws XmppStringprepException {
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
- request.setFrom("sender@test/Smack");
- request.setTo("receiver@test/Smack");
+ request.setFrom(JidCreate.from("sender@test/Smack"));
+ request.setTo(JidCreate.from("receiver@test/Smack"));
final IQ result = IQ.createResultIQ(request);
@@ -55,15 +58,16 @@ public class IQResponseTest {
/**
* Test creating a error response based on an IQ request.
+ * @throws XmppStringprepException
*/
@Test
- public void testGeneratingValidErrorResponse() {
+ public void testGeneratingValidErrorResponse() throws XmppStringprepException {
final XMPPError error = new XMPPError(XMPPError.Condition.bad_request);
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
request.setType(IQ.Type.set);
- request.setFrom("sender@test/Smack");
- request.setTo("receiver@test/Smack");
+ request.setFrom(JidCreate.from("sender@test/Smack"));
+ request.setTo(JidCreate.from("receiver@test/Smack"));
final IQ result = IQ.createErrorResponse(request, error);
@@ -79,14 +83,15 @@ public class IQResponseTest {
/**
* According to RFC3920: IQ Semantics we shouldn't respond to an IQ of type result.
+ * @throws XmppStringprepException
*/
@Test
- public void testGeneratingResponseBasedOnResult() {
+ public void testGeneratingResponseBasedOnResult() throws XmppStringprepException {
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
request.setType(IQ.Type.result);
- request.setFrom("sender@test/Smack");
- request.setTo("receiver@test/Smack");
+ request.setFrom(JidCreate.from("sender@test/Smack"));
+ request.setTo(JidCreate.from("receiver@test/Smack"));
try {
IQ.createResultIQ(request);
@@ -101,15 +106,16 @@ public class IQResponseTest {
/**
* According to RFC3920: IQ Semantics we shouldn't respond to an IQ of type error.
+ * @throws XmppStringprepException
*/
@Test
- public void testGeneratingErrorBasedOnError() {
+ public void testGeneratingErrorBasedOnError() throws XmppStringprepException {
final XMPPError error = new XMPPError(XMPPError.Condition.bad_request);
final IQ request = new TestIQ(ELEMENT, NAMESPACE);
request.setType(IQ.Type.error);
- request.setFrom("sender@test/Smack");
- request.setTo("receiver@test/Smack");
+ request.setFrom(JidCreate.from("sender@test/Smack"));
+ request.setTo(JidCreate.from("receiver@test/Smack"));
request.setError(error);
try {
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java b/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
index be61be0b4..19e3936c7 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
@@ -25,6 +25,8 @@ import java.util.Map;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.util.StringUtils;
+import org.jxmpp.jid.impl.JidCreate;
+import org.jxmpp.stringprep.XmppStringprepException;
public class DigestMd5SaslTest extends AbstractSaslTest {
@@ -35,8 +37,8 @@ public class DigestMd5SaslTest extends AbstractSaslTest {
super(saslMechanism);
}
- protected void runTest() throws NotConnectedException, SmackException, InterruptedException {
- saslMechanism.authenticate("florian", "irrelevant", "xmpp.org", "secret");
+ protected void runTest() throws NotConnectedException, SmackException, InterruptedException, XmppStringprepException {
+ saslMechanism.authenticate("florian", "irrelevant", JidCreate.domainBareFrom("xmpp.org"), "secret");
byte[] response = saslMechanism.evaluateChallenge(challengeBytes);
String responseString = new String(response);
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java b/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java
index fe8c808a9..46e359895 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java
@@ -27,6 +27,7 @@ import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.junit.Before;
import org.junit.Test;
+import org.jxmpp.jid.JidTestUtil;
public class SCRAMSHA1MechanismTest {
@@ -53,7 +54,7 @@ public class SCRAMSHA1MechanismTest {
}
};
- mech.authenticate(USERNAME, "unusedFoo", "unusedBar", PASSWORD);
+ mech.authenticate(USERNAME, "unusedFoo", JidTestUtil.DOMAIN_BARE_JID_1, PASSWORD);
AuthMechanism authMechanism = con.getSentPacket();
assertEquals(SCRAMSHA1Mechanism.NAME, authMechanism.getMechanism());
assertEquals(CLIENT_FIRST_MESSAGE, saslLayerString(authMechanism.getAuthenticationText()));
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java b/smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java
index 2e2c02425..05118b168 100644
--- a/smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java
+++ b/smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java
@@ -43,7 +43,7 @@ public class WaitForPacketListener implements PacketListener {
public void waitUntilInvocationOrTimeout() {
try {
- boolean res = latch.await(30, TimeUnit.SECONDS);
+ boolean res = latch.await(300, TimeUnit.SECONDS);
if (!res) {
throw new IllegalStateException("Latch timed out before it reached zero");
}
diff --git a/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java b/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java
index c9dd213d8..ee628c3e8 100644
--- a/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java
+++ b/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java
@@ -23,7 +23,7 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.debugger.SmackDebugger;
import org.jivesoftware.smack.util.ObservableReader;
import org.jivesoftware.smack.util.ObservableWriter;
-import org.jxmpp.util.XmppStringUtils;
+import org.jxmpp.jid.FullJid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,18 +93,9 @@ public class SLF4JSmackDebugger implements SmackDebugger {
}
@Override
- public void userHasLogged(String user) {
+ public void userHasLogged(FullJid user) {
if (logger.isDebugEnabled()) {
- String userTitle = getUserTitle(user);
- logger.debug("({}) User logged in {}", connection.hashCode(), userTitle);
- }
- }
-
- private String getUserTitle(String user) {
- if (("@" + connection.getServiceName()).equals(XmppStringUtils.parseBareJid(user))) {
- return "@" + connection.getServiceName();
- } else {
- return user;
+ logger.debug("({}) User logged in {}", connection.hashCode(), user.toString());
}
}
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 06fa6cbe7..1449c2a34 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
@@ -32,6 +32,8 @@ import org.jivesoftware.smack.util.ObservableWriter;
import org.jivesoftware.smack.util.ReaderListener;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.WriterListener;
+import org.jxmpp.jid.FullJid;
+import org.jxmpp.jid.Jid;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
@@ -735,12 +737,13 @@ public class EnhancedDebugger implements SmackDebugger {
return writer;
}
- public void userHasLogged(final String user) {
+ @Override
+ public void userHasLogged(final FullJid user) {
final EnhancedDebugger debugger = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- userField.setText(user);
- EnhancedDebuggerWindow.userHasLogged(debugger, user);
+ userField.setText(user.toString());
+ EnhancedDebuggerWindow.userHasLogged(debugger, user.toString());
// Add the connection listener to the connection so that the debugger can be notified
// whenever the connection is closed.
connection.addConnectionListener(connListener);
@@ -795,7 +798,7 @@ public class EnhancedDebugger implements SmackDebugger {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
String messageType;
- String from = packet.getFrom();
+ Jid from = packet.getFrom();
String type = "";
Icon packetTypeIcon;
receivedPackets++;
@@ -856,7 +859,7 @@ public class EnhancedDebugger implements SmackDebugger {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
String messageType;
- String to = packet.getTo();
+ Jid to = packet.getTo();
String type = "";
Icon packetTypeIcon;
sentPackets++;
diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java
index 259ca7900..f9892f14e 100644
--- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java
+++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java
@@ -48,7 +48,7 @@ import org.jivesoftware.smack.util.ObservableReader;
import org.jivesoftware.smack.util.ObservableWriter;
import org.jivesoftware.smack.util.ReaderListener;
import org.jivesoftware.smack.util.WriterListener;
-import org.jxmpp.util.XmppStringUtils;
+import org.jxmpp.jid.FullJid;
/**
* The LiteDebugger is a very simple debugger that allows to debug sent, received and
@@ -324,16 +324,11 @@ public class LiteDebugger implements SmackDebugger {
return writer;
}
- public void userHasLogged(String user) {
- boolean isAnonymous = "".equals(XmppStringUtils.parseLocalpart(user));
+ @Override
+ public void userHasLogged(FullJid user) {
String title =
"Smack Debug Window -- "
- + (isAnonymous ? "" : XmppStringUtils.parseBareJid(user))
- + "@"
- + connection.getServiceName()
- + ":"
- + connection.getPort();
- title += "/" + XmppStringUtils.parseResource(user);
+ + user;
frame.setTitle(title);
}
diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java
index b57f6c5f9..a99132630 100644
--- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java
+++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/HOXTManager.java
@@ -24,6 +24,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.hoxt.packet.AbstractHttpOverXmpp;
+import org.jxmpp.jid.Jid;
/**
* Manager for HTTP ove XMPP transport (XEP-0332) extension.
@@ -58,7 +59,7 @@ public class HOXTManager {
* @throws NotConnectedException
* @throws InterruptedException
*/
- public static boolean isSupported(String jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
+ public static boolean isSupported(Jid jid, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(jid, NAMESPACE);
}
}
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 7f9b97f05..c0f9e3e07 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
@@ -17,6 +17,8 @@
package org.jivesoftware.smackx.carbons;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.jivesoftware.smack.test.util.CharsequenceEquals.equalsCharSequence;
import java.util.Properties;
@@ -62,7 +64,7 @@ public class CarbonTest extends ExperimentalInitializerTest {
assertEquals(null, fwd.getDelayInformation());
// check message
- assertEquals("romeo@montague.com", fwd.getForwardedPacket().getFrom());
+ assertThat("romeo@montague.com", equalsCharSequence(fwd.getForwardedPacket().getFrom()));
// check end of tag
assertEquals(XmlPullParser.END_TAG, parser.getEventType());
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientInfo.java
index 0b64bf2d0..41caa4595 100644
--- a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientInfo.java
+++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientInfo.java
@@ -18,6 +18,7 @@
package org.jivesoftware.smackx.address;
import org.jivesoftware.smackx.address.packet.MultipleAddresses;
+import org.jxmpp.jid.Jid;
import java.util.List;
@@ -64,7 +65,8 @@ public class MultipleRecipientInfo {
* @return the JID of a MUC room to which responses should be sent or