Merge pull request #394 from vanitasvitae/tlsClose

Prevent NPE when reading trust store stream
This commit is contained in:
Florian Schmaus 2020-05-17 18:14:15 +02:00 committed by GitHub
commit b79ee8f6a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -126,6 +126,7 @@ import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.sasl.core.SASLAnonymous;
import org.jivesoftware.smack.sasl.packet.SaslNonza;
import org.jivesoftware.smack.util.Async;
import org.jivesoftware.smack.util.CloseableUtil;
import org.jivesoftware.smack.util.CollectionUtil;
import org.jivesoftware.smack.util.Consumer;
import org.jivesoftware.smack.util.DNSUtil;
@ -2291,7 +2292,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
try {
ks.load(stream, password);
} finally {
stream.close();
CloseableUtil.maybeClose(stream);
}
} catch (IOException e) {
LOGGER.log(Level.FINE, "KeyStore load() threw, attempting 'jks' fallback", e);
@ -2302,7 +2303,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
try {
ks.load(stream, null);
} finally {
stream.close();
CloseableUtil.maybeClose(stream);
}
}
}