Source:
<code>protected void runInternal() { while (username == null || username.isEmpty()) { username = System.console().readLine("Username: "); } File confDir = new File(serverRoot, Server.DEFAULT_SERVER_CONFIG); Properties users = new Properties(); File usersFile = new File(confDir, usersFileName); if (usersFile.exists()) { try (FileReader reader = new FileReader(usersFile)) { users.load(reader); } catch (IOException e) { throw new RuntimeException(e); } } Properties groups = new Properties(); File groupsFile = new File(confDir, groupsFileName); if (groupsFile.exists()) { try (FileReader reader = new FileReader(groupsFile)) { groups.load(reader); } catch (IOException e) { throw new RuntimeException(e); } } if (password == null && !users.containsKey(username)) { if (!batchMode) { while (password == null || password.isEmpty()) { password = new String(System.console().readPassword("Password: ")); } } else { <START> stdErr.printf("Cannot add user '%s' without a password.\n", username); <END> exit(1); } } if (!batchMode && users.containsKey(username)) { String answer; do { answer = System.console().readLine("User '%s' already exists. Overwrite (y/n) ? ", username); } while (!"Y".equalsIgnoreCase(answer) && !"N".equalsIgnoreCase(answer)); if ("N".equalsIgnoreCase(answer)) { exit(0); } } users.put(username, hashPassword(username, password, realm)); groups.put(username, addGroups.stream().collect(Collectors.joining(","))); try (FileWriter writer = new FileWriter(usersFile)) { users.store(writer, "$REALM_NAME=" + realm + "$"); } catch (IOException e) { throw new RuntimeException(e); } try (FileWriter writer = new FileWriter(groupsFile)) { groups.store(writer, null); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>Long term messages a format internationalised</technical_language>

Target:
protected void runInternal() { while (username == null || username.isEmpty()) { username = System.console().readLine(MSG.userToolUsername()); } File confDir = new File(serverRoot, Server.DEFAULT_SERVER_CONFIG); Properties users = new Properties(); File usersFile = new File(confDir, usersFileName); if (usersFile.exists()) { try (FileReader reader = new FileReader(usersFile)) { users.load(reader); } catch (IOException e) { throw new RuntimeException(e); } } Properties groups = new Properties(); File groupsFile = new File(confDir, groupsFileName); if (groupsFile.exists()) { try (FileReader reader = new FileReader(groupsFile)) { groups.load(reader); } catch (IOException e) { throw new RuntimeException(e); } } if (password == null && !users.containsKey(username)) { if (!batchMode) { while (password == null || password.isEmpty()) { password = new String(System.console().readPassword(MSG.userToolPassword())); } } else { stdErr.printf(MSG.userToolNoPassword(username)); exit(1); } } if (!batchMode && users.containsKey(username)) { String answer; do { answer = System.console().readLine(MSG.userToolUserExists(username)); } while (!"Y".equalsIgnoreCase(answer) && !"N".equalsIgnoreCase(answer)); if ("N".equalsIgnoreCase(answer)) { exit(0); } } users.put(username, hashPassword(username, password, realm)); groups.put(username, addGroups.stream().collect(Collectors.joining(","))); try (FileWriter writer = new FileWriter(usersFile)) { users.store(writer, "$REALM_NAME=" + realm + "$"); } catch (IOException e) { throw new RuntimeException(e); } try (FileWriter writer = new FileWriter(groupsFile)) { groups.store(writer, null); } catch (IOException e) { throw new RuntimeException(e); } }