mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 15:32:06 +01:00
Prevent NPE when closing trust store stream
This commit is contained in:
parent
f00acbff89
commit
dc64a43f12
1 changed files with 3 additions and 2 deletions
|
@ -126,6 +126,7 @@ import org.jivesoftware.smack.sasl.SASLMechanism;
|
||||||
import org.jivesoftware.smack.sasl.core.SASLAnonymous;
|
import org.jivesoftware.smack.sasl.core.SASLAnonymous;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslNonza;
|
import org.jivesoftware.smack.sasl.packet.SaslNonza;
|
||||||
import org.jivesoftware.smack.util.Async;
|
import org.jivesoftware.smack.util.Async;
|
||||||
|
import org.jivesoftware.smack.util.CloseableUtil;
|
||||||
import org.jivesoftware.smack.util.CollectionUtil;
|
import org.jivesoftware.smack.util.CollectionUtil;
|
||||||
import org.jivesoftware.smack.util.Consumer;
|
import org.jivesoftware.smack.util.Consumer;
|
||||||
import org.jivesoftware.smack.util.DNSUtil;
|
import org.jivesoftware.smack.util.DNSUtil;
|
||||||
|
@ -2291,7 +2292,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
try {
|
try {
|
||||||
ks.load(stream, password);
|
ks.load(stream, password);
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
CloseableUtil.maybeClose(stream);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.log(Level.FINE, "KeyStore load() threw, attempting 'jks' fallback", e);
|
LOGGER.log(Level.FINE, "KeyStore load() threw, attempting 'jks' fallback", e);
|
||||||
|
@ -2302,7 +2303,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
try {
|
try {
|
||||||
ks.load(stream, null);
|
ks.load(stream, null);
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
CloseableUtil.maybeClose(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue