1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Make sure StanzaCollector is cancelled

even if nextResult(long) throws an InterruptedException when called in
nextResultOrThrow(long).
This commit is contained in:
Florian Schmaus 2018-10-22 11:34:49 +02:00
parent 06956a36b9
commit 367580d37b

View file

@ -256,8 +256,12 @@ public class StanzaCollector {
*/
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException,
XMPPErrorException, InterruptedException, NotConnectedException {
P result = nextResult(timeout);
cancel();
P result;
try {
result = nextResult(timeout);
} finally {
cancel();
}
if (result == null) {
if (!connection.isConnected()) {
throw new NotConnectedException(connection, packetFilter);