* Create the redirector to use, if any.
*
* @return a configured RedirectorElement.
*/
private RedirectorElement createRedirector() {
RedirectorElement result = new RedirectorElement();
if (storepass != null) {
StringBuffer input = new StringBuffer(storepass).append('\n');
if (keypass != null) {
input.append(keypass).append('\n');
}
result.setInputString(input.toString());
result.setLogInputString(false);
// Try to avoid showing password prompts on log output, as they would be confusing.
LineContainsRegExp filter = new LineContainsRegExp();
RegularExpression rx = new RegularExpression();
// TODO only handles English locale, not ja or zh_CN
rx.setPattern("^(Enter Passphrase for keystore: |Enter key password for .+: )$");
filter.addConfiguredRegexp(rx);
filter.setNegate(true);
result.createErrorFilterChain().addLineContainsRegExp(filter);
}
return result;
}