mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Make sure StanzaCollector is cancelled
even if nextResult(long) throws an InterruptedException when called in nextResultOrThrow(long).
This commit is contained in:
parent
06956a36b9
commit
367580d37b
1 changed files with 6 additions and 2 deletions
|
@ -256,8 +256,12 @@ public class StanzaCollector {
|
||||||
*/
|
*/
|
||||||
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException,
|
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException,
|
||||||
XMPPErrorException, InterruptedException, NotConnectedException {
|
XMPPErrorException, InterruptedException, NotConnectedException {
|
||||||
P result = nextResult(timeout);
|
P result;
|
||||||
cancel();
|
try {
|
||||||
|
result = nextResult(timeout);
|
||||||
|
} finally {
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
if (!connection.isConnected()) {
|
if (!connection.isConnected()) {
|
||||||
throw new NotConnectedException(connection, packetFilter);
|
throw new NotConnectedException(connection, packetFilter);
|
||||||
|
|
Loading…
Reference in a new issue