}
public static String getKeystorePassword() throws IOException {
if (pass_phrase == null) {
BrokerConfig bcfg;
Password pw = null;
bcfg = Globals.getConfig();
// Get Passphrase from property setting
pass_phrase = bcfg.getProperty(KEYSTORE_PASSWORD_PROP);
// if passphrase is null then get it thro' user interaction
int retry = 0;
pw = new Password();
if (pw.echoPassword()) {
System.err.println(Globals.getBrokerResources().
getString(BrokerResources.W_ECHO_PASSWORD));
}
while ((pass_phrase == null || pass_phrase.equals("")) &&
retry <= 5) {
System.err.print(br.getString(
BrokerResources.M_ENTER_KEY_PWD,
getKeystoreLocation()));
System.err.flush();
if (Broker.getBroker().background) {
// We're running in the background and can't
// read the password. We still prompt for it
// so it's more obvious what's going on
// (instead of just silently failing)
// See 4451214
System.err.print("\n");
break;
}
pass_phrase = pw.getPassword();
// Limit the number of times we try reading the passwd.
// If the VM is run in the background the readLine()
// will always return null and we'd get stuck
// in the loop