fix build

Added Local to String.format

Original commit: elastic/x-pack-elasticsearch@2c7368c3de
This commit is contained in:
uboness 2016-02-02 23:12:36 +01:00
parent 042f93b362
commit db003cd2a4
1 changed files with 14 additions and 14 deletions

View File

@ -160,7 +160,7 @@ public class ESUsersTool extends CliTool {
Path file = FileUserPasswdStore.resolveFile(esusersSettings, env);
Map<String, char[]> users = new HashMap<>(FileUserPasswdStore.parseFile(file, null));
if (users.containsKey(username)) {
terminal.println(String.format("User [%s] already exists", username));
terminal.println(String.format(Locale.ROOT, "User [%s] already exists", username));
return ExitStatus.CODE_ERROR;
}
Hasher hasher = Hasher.BCRYPT;
@ -228,7 +228,7 @@ public class ESUsersTool extends CliTool {
Path file = FileUserPasswdStore.resolveFile(esusersSettings, env);
Map<String, char[]> users = new HashMap<>(FileUserPasswdStore.parseFile(file, null));
if (!users.containsKey(username)) {
terminal.println(String.format("User [%s] doesn't exist", username));
terminal.println(String.format(Locale.ROOT, "User [%s] doesn't exist", username));
return ExitStatus.NO_USER;
}
@ -308,7 +308,7 @@ public class ESUsersTool extends CliTool {
Path file = FileUserPasswdStore.resolveFile(esusersSettings, env);
Map<String, char[]> users = new HashMap<>(FileUserPasswdStore.parseFile(file, null));
if (!users.containsKey(username)) {
terminal.println(String.format("User [%s] doesn't exist", username));
terminal.println(String.format(Locale.ROOT, "User [%s] doesn't exist", username));
return ExitStatus.NO_USER;
}
Hasher hasher = Hasher.BCRYPT;
@ -378,7 +378,7 @@ public class ESUsersTool extends CliTool {
String[] allRoles = ArrayUtils.concat(addRoles, removeRoles, String.class);
for (String role : allRoles) {
if (!ROLE_PATTERN.matcher(role).matches()) {
terminal.println(String.format("Role name [%s] is not valid. Please use lowercase and numbers only", role));
terminal.println(String.format(Locale.ROOT, "Role name [%s] is not valid. Please use lowercase and numbers only", role));
return ExitStatus.DATA_ERROR;
}
}
@ -388,7 +388,7 @@ public class ESUsersTool extends CliTool {
Path path = FileUserPasswdStore.resolveFile(esusersSettings, env);
Map<String, char[]> usersMap = FileUserPasswdStore.parseFile(path, null);
if (!usersMap.containsKey(username)) {
terminal.println(String.format("User [%s] doesn't exist", username));
terminal.println(String.format(Locale.ROOT, "User [%s] doesn't exist", username));
return ExitStatus.NO_USER;
}
@ -451,7 +451,7 @@ public class ESUsersTool extends CliTool {
if (username != null) {
if (!users.contains(username)) {
terminal.println(String.format("User [%s] doesn't exist", username));
terminal.println(String.format(Locale.ROOT, "User [%s] doesn't exist", username));
return ExitStatus.NO_USER;
}
@ -459,15 +459,15 @@ public class ESUsersTool extends CliTool {
String[] roles = userRoles.get(username);
Set<String> unknownRoles = Sets.difference(Sets.newHashSet(roles), knownRoles);
String[] markedRoles = markUnknownRoles(roles, unknownRoles);
terminal.println(String.format("%-15s: %s", username, Arrays.stream(markedRoles).map(s -> s == null ? "-" : s).collect(Collectors.joining(","))));
terminal.println(String.format(Locale.ROOT, "%-15s: %s", username, Arrays.stream(markedRoles).map(s -> s == null ? "-" : s).collect(Collectors.joining(","))));
if (!unknownRoles.isEmpty()) {
// at least one role is marked... so printing the legend
Path rolesFile = FileRolesStore.resolveFile(esusersSettings, env).toAbsolutePath();
terminal.println();
terminal.println(String.format(" [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
terminal.println(String.format(Locale.ROOT, " [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
}
} else {
terminal.println(String.format("%-15s: -", username));
terminal.println(String.format(Locale.ROOT, "%-15s: -", username));
}
} else {
boolean unknownRolesFound = false;
@ -476,7 +476,7 @@ public class ESUsersTool extends CliTool {
String[] roles = entry.getValue();
Set<String> unknownRoles = Sets.difference(Sets.newHashSet(roles), knownRoles);
String[] markedRoles = markUnknownRoles(roles, unknownRoles);
terminal.println(String.format("%-15s: %s", entry.getKey(), String.join(",", markedRoles)));
terminal.println(String.format(Locale.ROOT, "%-15s: %s", entry.getKey(), String.join(",", markedRoles)));
unknownRolesFound = unknownRolesFound || !unknownRoles.isEmpty();
usersExist = true;
}
@ -484,7 +484,7 @@ public class ESUsersTool extends CliTool {
Set<String> usersWithoutRoles = Sets.newHashSet(users);
usersWithoutRoles.removeAll(userRoles.keySet());
for (String user : usersWithoutRoles) {
terminal.println(String.format("%-15s: -", user));
terminal.println(String.format(Locale.ROOT, "%-15s: -", user));
usersExist = true;
}
@ -497,7 +497,7 @@ public class ESUsersTool extends CliTool {
// at least one role is marked... so printing the legend
Path rolesFile = FileRolesStore.resolveFile(esusersSettings, env).toAbsolutePath();
terminal.println();
terminal.println(String.format(" [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
terminal.println(String.format(Locale.ROOT, " [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
}
}
@ -511,7 +511,7 @@ public class ESUsersTool extends CliTool {
return FileRolesStore.parseFileForRoleNames(rolesFile, null);
} catch (Throwable t) {
// if for some reason, parsing fails (malformatted perhaps) we just warn
terminal.println(String.format("Warning: Could not parse [%s] for roles verification. Please revise and fix it. Nonetheless, the user will still be associated with all specified roles", rolesFile.toAbsolutePath()));
terminal.println(String.format(Locale.ROOT, "Warning: Could not parse [%s] for roles verification. Please revise and fix it. Nonetheless, the user will still be associated with all specified roles", rolesFile.toAbsolutePath()));
}
return null;
}
@ -536,7 +536,7 @@ public class ESUsersTool extends CliTool {
Set<String> unknownRoles = Sets.difference(Sets.newHashSet(roles), knownRoles);
if (!unknownRoles.isEmpty()) {
Path rolesFile = FileRolesStore.resolveFile(settings, env);
terminal.println(String.format("Warning: The following roles [%s] are unknown. Make sure to add them to the [%s] file. " +
terminal.println(String.format(Locale.ROOT, "Warning: The following roles [%s] are unknown. Make sure to add them to the [%s] file. " +
"Nonetheless the user will still be associated with all specified roles",
Strings.collectionToCommaDelimitedString(unknownRoles), rolesFile.toAbsolutePath()));
}