// to avoid putting commas in the port number (e.g., "4,848")...
String sport = Integer.toString(port);
try {
// By definition, the host name will default to "localhost" and
// entry is overwritten
final LoginInfoStore store = LoginInfoStoreFactory.getStore(null);
final LoginInfo login = new LoginInfo(host, port, user, passwd);
if (store.exists(login.getHost(), login.getPort())) {
// Let the user know that the user has chosen to overwrite the
// login information. This is non-interactive, on purpose
logger.info(strings.get("OverwriteLoginMsgCreateDomain",
login.getHost(), "" + login.getPort()));
}
store.store(login, true);
logger.info(strings.get("LoginInfoStored",
user, login.getHost(), sport, store.getName()));
} catch (final Exception e) {
logger.warning(
strings.get("LoginInfoNotStored", host, sport));
printExceptionStackTrace(e);
}