{
try {
//Ensure that the entity is stopped
final int status = getInstancesManager(config).getInstanceStatus();
if (status != Status.kInstanceNotRunningCode) {
throw new DomainException(
strMgr.getString("cannotChangePassword_invalidState",
config.getDisplayName(), Status.getStatusString(status)));
}
String oldPass = getMasterPasswordClear(config);
String newPass = getNewMasterPasswordClear(config);
//Change the password of the keystore alias file
changePasswordAliasKeystorePassword(config, oldPass, newPass);
//Change the password of the keystore and truststore
changeSSLCertificateDatabasePassword(config, oldPass, newPass);
//Change the password in the masterpassword file or delete the file if it is
//not to be saved.
changeMasterPasswordInMasterPasswordFile(config, newPass, saveMasterPassword(config));
} catch (Exception ex) {
throw new DomainException(
strMgr.getString("masterPasswordNotChanged"), ex);
}
}