1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 07:42:06 +01:00

Limit the scope of local variables in proceedTLSReceived()

This commit is contained in:
Florian Schmaus 2017-11-23 08:15:52 +01:00
parent 32f681c6e5
commit 573358b459

View file

@ -684,10 +684,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* @throws Exception if an exception occurs.
*/
private void proceedTLSReceived() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, NoSuchProviderException, UnrecoverableKeyException, KeyManagementException, SmackException {
SSLContext context = this.config.getCustomSSLContext();
KeyStore ks = null;
KeyManager[] kms = null;
PasswordCallback pcb = null;
SmackDaneVerifier daneVerifier = null;
if (config.getDnssecMode() == DnssecMode.needsDnssecAndDane) {
@ -701,6 +697,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
}
SSLContext context = this.config.getCustomSSLContext();
KeyStore ks = null;
PasswordCallback pcb = null;
if (context == null) {
final String keyStoreType = config.getKeystoreType();
final CallbackHandler callbackHandler = config.getCallbackHandler();
@ -745,6 +745,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
}
KeyManager[] kms = null;
if (ks != null) {
String keyManagerFactoryAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerFactoryAlgorithm);