Source:
private void initKeyStore() throws Exception { LOG.debug("SamlCallbackHandler.initKeyStore() -- Begin"); InputStream is = null; HashMap<String, String> keyStoreProperties = getKeyStoreSystemProperties(); String storeType = keyStoreProperties.get(KEY_STORE_TYPE_KEY); String password = keyStoreProperties.get(KEY_STORE_PASSWORD_KEY); String storeLoc = keyStoreProperties.get(KEY_STORE_KEY); if (storeType == null) { LOG.error("javax.net.ssl.keyStoreType is not defined"); LOG.warn("Default to JKS keyStoreType"); storeType = "JKS"; } if (password == null || storeLoc == null) { LOG.error("Store password or store location not defined"); LOG.error("Please define javax.net.ssl.keyStorePassword and javax.net.ssl.keyStore"); } if ("JKS".equals(storeType) && storeLoc == null) { LOG.error("javax.net.ssl.keyStore is not defined"); } else { try { keyStore = KeyStore.getInstance(storeType); if (JKS_TYPE.equalsIgnoreCase(storeType)) { is = new FileInputStream(storeLoc); keyStore.load(is, password.toCharArray()); } else if (PKCS_TYPE.equalsIgnoreCase(storeType)) { keyStore.load(is, password.toCharArray()); } else { throw new Exception("Unsupported Keystore Type: " + storeType); } } catch (NoSuchAlgorithmException ex) { LOG.error("Error initializing KeyStore: " + ex); throw new Exception(ex.getMessage()); } catch (CertificateException ex) { LOG.error("Error initializing KeyStore: " + ex); throw new Exception(ex.getMessage()); } catch (KeyStoreException ex) { LOG.error("Error initializing KeyStore: " + ex); throw new Exception(ex.getMessage()); } finally { try { if (is != null) { is.close(); } } catch (IOException ex) { LOG.debug("KeyStoreCallbackHandler " + ex); } } } LOG.debug("SamlCallbackHandler.initKeyStore() -- End"); }

Target:
private void initKeyStore() throws Exception { LOG.debug("SamlCallbackHandler.initKeyStore() -- Begin"); InputStream is = null; HashMap<String, String> keyStoreProperties = getKeyStoreSystemProperties(); String storeType = keyStoreProperties.get(KEY_STORE_TYPE_KEY); String password = keyStoreProperties.get(KEY_STORE_PASSWORD_KEY); String storeLoc = keyStoreProperties.get(KEY_STORE_KEY); if (storeType == null) { LOG.error("javax.net.ssl.keyStoreType is not defined"); LOG.warn("Default to JKS keyStoreType"); storeType = JKS_TYPE; } if (password == null || storeLoc == null) { LOG.error("Store password or store location not defined"); LOG.error("Please define javax.net.ssl.keyStorePassword and javax.net.ssl.keyStore"); } if (JKS_TYPE.equals(storeType) && storeLoc == null) { LOG.error("javax.net.ssl.keyStore is not defined"); } else { try { keyStore = KeyStore.getInstance(storeType); if (!PKCS11_TYPE.equalsIgnoreCase(storeType)) { is = new FileInputStream(storeLoc); } keyStore.load(is, password.toCharArray()); } catch (NoSuchAlgorithmException ex) { LOG.error("Error initializing KeyStore: " + ex); throw new Exception(ex.getMessage()); } catch (CertificateException ex) { LOG.error("Error initializing KeyStore: " + ex); throw new Exception(ex.getMessage()); } catch (KeyStoreException ex) { LOG.error("Error initializing KeyStore: " + ex); throw new Exception(ex.getMessage()); } finally { try { if (is != null) { is.close(); } } catch (IOException ex) { LOG.debug("KeyStoreCallbackHandler " + ex); } } } LOG.debug("SamlCallbackHandler.initKeyStore() -- End"); }