Source:
public KeyStore loadkeystore(final Object locationOfKeyStore, String type, String provider, final String keyStorePass) throws ScriptSignatureException, IOException { KeyStore keyStore; InputStream inputStream = ResourceTools.getInputStream(locationOfKeyStore); if (inputStream == null) throw new ScriptSignatureException("Given location of keystore can't be accessed.", null); if ("Default".equals(type)) type = KeyStore.getDefaultType(); if ("Preferred".equals(provider)) provider = null; try { if (provider == null) keyStore = KeyStore.getInstance(type); else keyStore = KeyStore.getInstance(type, provider); keyStore.load(inputStream, keyStorePass.toCharArray()); Logger.info(Activator.PLUGIN_ID, "Keystore loaded"); return keyStore; } catch (KeyStoreException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); throw new ScriptSignatureException("No provider support '"+type+"' type of keystore.", e); } catch (NoSuchProviderException e) { throw new ScriptSignatureException("No such provider available.", e); } catch (IOException e) { if(e.getCause() instanceof UnrecoverableKeyException) throw new ScriptSignatureException("Invalid Keystore Password", e); else if(e.getCause() instanceof FileNotFoundException || e.getCause() instanceof SecurityException) throw new ScriptSignatureException("File can't be read. Chose another keystore or try again.", e); Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); throw new ScriptSignatureException("Error loading keystore. Try again.", e); } catch (NoSuchAlgorithmException e) { throw new ScriptSignatureException("Algorithm used for securing keystore can't be found. Chose another Keystore", e); } catch (CertificateException e) { throw new ScriptSignatureException("Some certificate/s in keystore can't be loaded", e); } finally { if (inputStream != null) inputStream.close(); } }

Target:
public KeyStore loadkeystore(final Object locationOfKeyStore, String type, String provider, final String keyStorePass) throws ScriptSignatureException { KeyStore keyStore; InputStream inputStream = ResourceTools.getInputStream(locationOfKeyStore); if (inputStream == null) throw new ScriptSignatureException("Given location of keystore can't be accessed."); if (type == null || "".equals(type) || "default".equalsIgnoreCase(type)) type = KeyStore.getDefaultType(); if ("".equals(provider) || "preferred".equalsIgnoreCase(provider)) provider = null; try { if (provider == null) keyStore = KeyStore.getInstance(type); else keyStore = KeyStore.getInstance(type, provider); keyStore.load(inputStream, keyStorePass.toCharArray()); Logger.info(Activator.PLUGIN_ID, "Keystore loaded"); return keyStore; } catch (KeyStoreException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); throw new ScriptSignatureException("No provider support '" + type + "' type of keystore.", e); } catch (NoSuchProviderException e) { throw new ScriptSignatureException("No such provider available.", e); } catch (IOException e) { if (e.getCause() instanceof UnrecoverableKeyException) throw new ScriptSignatureException("Invalid Keystore Password", e); else if (e.getCause() instanceof FileNotFoundException || e.getCause() instanceof SecurityException) throw new ScriptSignatureException("File can't be read. Chose another keystore or try again.", e); Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); throw new ScriptSignatureException("Error loading keystore. Try again.", e); } catch (NoSuchAlgorithmException e) { throw new ScriptSignatureException("Algorithm used for securing keystore can't be found. Chose another Keystore", e); } catch (CertificateException e) { throw new ScriptSignatureException("Some certificate/s in keystore can't be loaded", e); } finally { try { if (inputStream != null) inputStream.close(); } catch (IOException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); } } }