1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-12 05:51:08 +01:00

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

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