}
private static String decryptIfNeeded(final String replace) {
if (replace.startsWith(CIPHER_PREFIX)) {
final String algo = replace.substring(CIPHER_PREFIX.length(), replace.indexOf(':', CIPHER_PREFIX.length() + 1));
PasswordCipher cipher = null;
try {
cipher = PasswordCipherFactory.getPasswordCipher(algo);
} catch (final PasswordCipherException ex) {
try {
cipher = PasswordCipher.class.cast(Thread.currentThread().getContextClassLoader().loadClass(algo).newInstance());
} catch (final Exception e) {
throw new IllegalArgumentException(e);
}
}
return cipher.decrypt(replace.substring(CIPHER_PREFIX.length() + algo.length()).toCharArray());
}
return replace;
}