Expose InterruptedException

SMACK-632
This commit is contained in:
Florian Schmaus 2015-02-14 09:43:44 +01:00
parent 43b99a2a85
commit bc61527bd2
124 changed files with 977 additions and 597 deletions

View File

@ -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();

View File

@ -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 <code>connect()</code> with <code>login()</code>.
* @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 {

View File

@ -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<Stanza> resultQueue;
@ -131,18 +127,14 @@ public class PacketCollector {
* available.
*
* @return the next available packet.
* @throws InterruptedException
*/
@SuppressWarnings("unchecked")
public <P extends Stanza> P nextResultBlockForever() {
public <P extends Stanza> 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 extends Stanza> P nextResult() {
public <P extends Stanza> 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 extends Stanza> P nextResult(long timeout) {
public <P extends Stanza> 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 extends Stanza> P nextResultOrThrow() throws NoResponseException, XMPPErrorException {
public <P extends Stanza> 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 extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException {
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException, InterruptedException {
P result = nextResult(timeout);
cancel();
if (result == null) {

View File

@ -47,7 +47,8 @@ public interface PacketListener {
* </p>
*
* @param packet the packet to process.
* @throws InterruptedException
*/
public void processPacket(Stanza packet) throws NotConnectedException;
public void processPacket(Stanza packet) throws NotConnectedException, InterruptedException;
}

View File

@ -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

View File

@ -56,7 +56,7 @@ public class SynchronizationPoint<E extends Exception> {
}
public void sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
NotConnectedException {
NotConnectedException, InterruptedException {
assert (state == State.Initial);
connectionLock.lock();
try {
@ -80,7 +80,7 @@ public class SynchronizationPoint<E extends Exception> {
}
public void sendAndWaitForResponseOrThrow(PlainStreamElement request) throws E, NoResponseException,
NotConnectedException {
NotConnectedException, InterruptedException {
sendAndWaitForResponse(request);
switch (state) {
case Failure:
@ -172,6 +172,7 @@ public class SynchronizationPoint<E extends Exception> {
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);
}
}

View File

@ -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 <code>replyFilter</code>.
@ -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 <code>replyFilter</code>.
@ -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 <code>callback</code> 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 <code>callback</code> 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 <code>callback</code> 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

View File

@ -158,9 +158,10 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
* @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<SASLMechanism> {
* @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<SASLMechanism> {
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<SASLMechanism> {
* @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) {

View File

@ -226,7 +226,21 @@ public class ArrayBlockingQueueWithShutdown<E> extends AbstractQueue<E> implemen
}
}
@Override
/**
* Inserts the specified element into this queue, waiting if necessary
* for space to become available.
* <p>
* This may throw an {@link InterruptedException} in two cases
* <ol>
* <li>If the queue was shut down.</li>
* <li>If the thread was was interrupted.</li>
* </ol>
* So you have to check which is the case, e.g. by calling {@link #isShutdown()}.
* </p>
*
* @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();

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -580,7 +580,7 @@ public class EnhancedDebugger implements SmackDebugger {
try {
connection.sendPacket(packetToSend);
}
catch (NotConnectedException e1) {
catch (InterruptedException | NotConnectedException e1) {
e1.printStackTrace();
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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<String> to, Collection<String> cc, Collection<String> bcc) throws NoResponseException, XMPPErrorException, FeatureNotSupportedException, NotConnectedException
public static void send(XMPPConnection connection, Stanza packet, Collection<String> to, Collection<String> cc, Collection<String> 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<String> to, Collection<String> cc, Collection<String> 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<String> to, Collection<String> cc, Collection<String> bcc) throws NotConnectedException {
Collection<String> to, Collection<String> cc, Collection<String> 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<String> to,
Collection<String> cc, Collection<String> 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<String> services = sdm.findServices(MultipleAddresses.NAMESPACE, true, true);
if (services.size() > 0) {

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -92,9 +92,10 @@ public class BookmarkManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
* @see BookmarkedConference
*/
public List<BookmarkedConference> getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<BookmarkedConference> 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<BookmarkedConference> 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<BookmarkedURL> getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<BookmarkedURL> 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<BookmarkedURL> 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<BookmarkedURL> 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",

View File

@ -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;
}

View File

@ -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());

View File

@ -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());

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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<String> determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException {
private List<String> determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);
List<String> proxies = new ArrayList<String>();
@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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);
}
}

View File

@ -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.");
}

View File

@ -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.

View File

@ -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<AdHocCommandInfo> 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());

View File

@ -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.

View File

@ -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<String> findServices(String feature, boolean stopOnFirst, boolean useCache)
throws NoResponseException, XMPPErrorException, NotConnectedException {
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<String> serviceAddresses = null;
String serviceName = connection().getServiceName();
if (useCache) {

View File

@ -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);

View File

@ -163,8 +163,9 @@ public class FileTransferManager extends Manager {
* </p>
* @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

View File

@ -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));

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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)) {

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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<String> getAccountAttributes() throws NoResponseException, XMPPErrorException, NotConnectedException {
public Set<String> 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<String, String> attributes = new HashMap<String, String>();
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<String, String> 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<String, String> map = new HashMap<String, String>();
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<String, String> attributes = new HashMap<String, String>();
// 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;
}

View File

@ -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;
}

View File

@ -269,11 +269,12 @@ public class MultiUserChat {
* @throws NotConnectedException
* @throws NoResponseException
* @throws XMPPErrorException
* @throws InterruptedException
* @see <a href="http://xmpp.org/extensions/xep-0045.html#enter">XEP-45 7.2 Entering a Room</a>
*/
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 <tt>null</tt> 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 <a href="http://xmpp.org/extensions/xep-0045.html#requestvoice">XEP-45 § 7.13 Requesting
* Voice</a>
* @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<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void grantVoice(Collection<String> 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<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void revokeVoice(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void banUsers(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void grantMembership(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void revokeMembership(Collection<String> 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<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void grantModerator(Collection<String> 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<String> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void revokeModerator(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void grantOwnership(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void revokeOwnership(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void grantAdmin(Collection<String> 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<String> jids) throws XMPPErrorException, NoResponseException, NotConnectedException {
public void revokeAdmin(Collection<String> 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<String> 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<String> nicknames, MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException {
private void changeRole(Collection<String> 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<Affiliate> getOwners() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Affiliate> 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<Affiliate> getAdmins() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Affiliate> 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<Affiliate> getMembers() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Affiliate> 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<Affiliate> getOutcasts() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Affiliate> 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<Affiliate> getAffiliatesByAdmin(MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException {
private List<Affiliate> 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<Occupant> getModerators() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Occupant> 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<Occupant> getParticipants() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Occupant> 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<Occupant> getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException {
private List<Occupant> 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 <tt>null</tt> 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.

View File

@ -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<String> 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<DiscoverItems.Item> 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<String> getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<String> 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<HostedRoom> getHostedRooms(String serviceName) throws NoResponseException, XMPPErrorException,
NotConnectedException {
NotConnectedException, InterruptedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection());
DiscoverItems discoverItems = discoManager.discoverItems(serviceName);
List<DiscoverItems.Item> 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

View File

@ -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<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<OfflineMessageHeader> answer = new ArrayList<OfflineMessageHeader>();
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<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Message> messages = new ArrayList<Message>();
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<Message> getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<Message> 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<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException {
public void deleteMessages(List<String> 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();

View File

@ -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);

View File

@ -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

View File

@ -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<PrivacyItem> getPrivacyListItems(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException {
private List<PrivacyItem> 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<PrivacyItem>());
@ -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<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = getPrivacyWithListNames();
Set<String> names = privacyAnswer.getPrivacyListNames();
List<PrivacyList> 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<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
public void createPrivacyList(String listName, List<PrivacyItem> 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<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException {
public void updatePrivacyList(String listName, List<PrivacyItem> 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<PrivacyItem>());
@ -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);
}
}

View File

@ -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 <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
return getItems((List<PacketExtension>) null, (List<PacketExtension>) 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 <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> List<T> 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 <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
List<Item> itemList = new ArrayList<Item>(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 <T extends Item> List<T> getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> List<T> 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 <T extends Item> List<T> getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> List<T> 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 <T extends Item> List<T> getItems(List<PacketExtension> additionalExtensions,
List<PacketExtension> returnedExtensions) throws NoResponseException,
XMPPErrorException, NotConnectedException {
XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
request.addExtensions(additionalExtensions);
return getItems(request, returnedExtensions);
}
private <T extends Item> List<T> getItems(PubSub request) throws NoResponseException,
XMPPErrorException, NotConnectedException {
XMPPErrorException, NotConnectedException, InterruptedException {
return getItems(request, null);
}
@SuppressWarnings("unchecked")
private <T extends Item> List<T> getItems(PubSub request,
List<PacketExtension> 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 <T extends Item> void publish(T item) throws NotConnectedException
public <T extends Item> void publish(T item) throws NotConnectedException, InterruptedException
{
Collection<T> items = new ArrayList<T>(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 <T extends Item> void publish(Collection<T> items) throws NotConnectedException
public <T extends Item> void publish(Collection<T> items) throws NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(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 <T extends Item> void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> void send(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
Collection<T> items = new ArrayList<T>(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 <T extends Item> void send(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Item> void send(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(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<String> items = new ArrayList<String>(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<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException
public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{
List<Item> items = new ArrayList<Item>(itemIds.size());

View File

@ -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<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
public List<Subscription> 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<Subscription> getSubscriptions(List<PacketExtension> additionalExtensions, Collection<PacketExtension> 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<Subscription> 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 <a href="http://www.xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve">XEP-60 § 8.8.1 -
* Retrieve Subscriptions List</a>
* @since 4.1
*/
public List<Subscription> getSubscriptionsAsOwner(List<PacketExtension> additionalExtensions,
Collection<PacketExtension> returnedExtensions) throws NoResponseException, XMPPErrorException,
NotConnectedException {
NotConnectedException, InterruptedException {
return getSubscriptions(additionalExtensions, returnedExtensions, PubSubNamespace.OWNER);
}
private List<Subscription> getSubscriptions(List<PacketExtension> additionalExtensions,
Collection<PacketExtension> 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<Affiliation> 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<Affiliation> getAffiliations(List<PacketExtension> additionalExtensions, Collection<PacketExtension> 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);
}

View File

@ -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 extends Node> T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException
public <T extends Node> 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<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
public List<Subscription> 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<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException
public List<Affiliation> 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<PacketExtension> extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException
static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List<PacketExtension> 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) {

View File

@ -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);
}

View File

@ -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);

View File

@ -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<String> getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException {
public List<String> getSearchServices() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con);
return discoManager.findServices(UserSearch.NAMESPACE, false, false);
}

View File

@ -44,8 +44,9 @@ public class SharedGroupManager {
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public static List<String> getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
public static List<String> 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);

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -76,10 +76,11 @@ public class XDataManager extends Manager {
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @see <a href="http://xmpp.org/extensions/xep-0004.html#disco">XEP-0004: Data Forms § 6. Service Discovery</a>
* @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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<MessageListener, PacketFilter> interceptor : interceptors.entrySet()) {
PacketFilter filter = interceptor.getValue();
if(filter != null && filter.accept(message)) {

View File

@ -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<String, Presence> 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();

View File

@ -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;

View File

@ -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)

View File

@ -58,7 +58,7 @@ public class ContentNegotiator extends JingleNegotiator {
transportNegotiators = new ArrayList<TransportNegotiator>();
}
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
List<IQ> responses = new ArrayList<IQ>();
// First only process IQ packets that contain <content> 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();

View File

@ -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);
}

View File

@ -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<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException;
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
public void start() {

View File

@ -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<IQ> responses = new ArrayList<IQ>();
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<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException {
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException {
List<IQ> responses = new ArrayList<IQ>();
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());

View File

@ -107,8 +107,9 @@ public class JingleSessionRequest {
* @return Returns the <b><i>IncomingJingleSession</b></i> 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);

View File

@ -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.

View File

@ -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 <session-initiate> 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;

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -103,8 +103,9 @@ public class MediaNegotiator extends JingleNegotiator {
* @return the new Jingle packet to send.
* @throws XMPPException
* @throws NotConnectedException
* @throws InterruptedException
*/
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException {
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, NotConnectedException, InterruptedException {
List<IQ> responses = new ArrayList<IQ>();
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<PayloadType> offeredPayloads = new ArrayList<PayloadType>();
@ -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<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleMediaListener) {

View File

@ -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();

View File

@ -60,8 +60,9 @@ public class BridgedResolver extends TransportResolver {
* <p/>
* 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();

View File

@ -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);
}

View File

@ -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();

Some files were not shown because too many files have changed in this diff Show More