Source:
<code>private static void setUsersInfo(Catalog catalog, UsersType users) { if (users == null) { return; } Database db = catalog.getClusters().get("cluster").getDatabases().get("database"); SecureRandom sr = new SecureRandom(); for (UsersType.User user : users.getUser()) { String sha1hex = user.getPassword(); String sha256hex = user.getPassword(); if (user.isPlaintext()) { sha1hex = extractPassword(user.getPassword(), ClientAuthScheme.HASH_SHA1); sha256hex = extractPassword(user.getPassword(), ClientAuthScheme.HASH_SHA256); } else if (user.getPassword().length() == 104) { int sha1len = ClientAuthScheme.getHexencodedDigestLength(ClientAuthScheme.HASH_SHA1); sha1hex = sha1hex.substring(0, sha1len); sha256hex = sha256hex.substring(sha1len); } else { <START> BAD_PASSWORD_WARN = "Invalid masked password in deployment file. Please re-run voltdb mask on the original deployment file using current version of software."; <END> hostLog.warn(BAD_PASSWORD_WARN); } org.voltdb.catalog.User catUser = db.getUsers().add(user.getName()); String saltGen = BCrypt.gensalt(BCrypt.GENSALT_DEFAULT_LOG2_ROUNDS,sr); String hashedPW = BCrypt.hashpw( sha1hex, saltGen); String hashedPW256 = BCrypt.hashpw( sha256hex, saltGen); catUser.setShadowpassword(hashedPW); catUser.setSha256shadowpassword(hashedPW256); for (final String role : extractUserRoles(user)) { final Group catalogGroup = db.getGroups().get(role); if (catalogGroup != null) { final GroupRef groupRef = catUser.getGroups().add(role); groupRef.setGroup(catalogGroup); } else { hostLog.warn("User \"" + user.getName() + "\" is assigned to non-existent role \"" + role + "\" " + "and may not have the expected database permissions."); } } } }</code><technical_language>This voltdb create -d masked-deployment-file.xml crash. startup crash voltadmin update not</technical_language>

Target:
private static void setUsersInfo(Catalog catalog, UsersType users) throws RuntimeException { if (users == null) { return; } Database db = catalog.getClusters().get("cluster").getDatabases().get("database"); SecureRandom sr = new SecureRandom(); for (UsersType.User user : users.getUser()) { Set<String> roles = extractUserRoles(user); String sha1hex = user.getPassword(); String sha256hex = user.getPassword(); if (user.isPlaintext()) { sha1hex = extractPassword(user.getPassword(), ClientAuthScheme.HASH_SHA1); sha256hex = extractPassword(user.getPassword(), ClientAuthScheme.HASH_SHA256); } else if (user.getPassword().length() == 104) { int sha1len = ClientAuthScheme.getHexencodedDigestLength(ClientAuthScheme.HASH_SHA1); sha1hex = sha1hex.substring(0, sha1len); sha256hex = sha256hex.substring(sha1len); } else { hostLog.warn("User \"" + user.getName() + "\" has invalid masked password in deployment file."); throw new RuntimeException("User \"" + user.getName() + "\" has invalid masked password in deployment file"); } org.voltdb.catalog.User catUser = db.getUsers().add(user.getName()); String saltGen = BCrypt.gensalt(BCrypt.GENSALT_DEFAULT_LOG2_ROUNDS,sr); String hashedPW = BCrypt.hashpw( sha1hex, saltGen); String hashedPW256 = BCrypt.hashpw( sha256hex, saltGen); catUser.setShadowpassword(hashedPW); catUser.setSha256shadowpassword(hashedPW256); for (final String role : roles) { final Group catalogGroup = db.getGroups().get(role); if (catalogGroup != null) { final GroupRef groupRef = catUser.getGroups().add(role); groupRef.setGroup(catalogGroup); } else { hostLog.warn("User \"" + user.getName() + "\" is assigned to non-existent role \"" + role + "\" " + "and may not have the expected database permissions."); } } } }