|
@@ -30,6 +30,7 @@ import java.util.EnumSet;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.ConcurrentMap;
|
|
@@ -257,7 +258,8 @@ public class RMWebServices {
|
|
|
} else {
|
|
|
acceptedStates = EnumSet.noneOf(NodeState.class);
|
|
|
for (String stateStr : states.split(",")) {
|
|
|
- acceptedStates.add(NodeState.valueOf(stateStr.toUpperCase()));
|
|
|
+ acceptedStates.add(NodeState.valueOf(
|
|
|
+ stateStr.toUpperCase(Locale.ENGLISH)));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -506,7 +508,7 @@ public class RMWebServices {
|
|
|
// if no states, returns the counts of all RMAppStates
|
|
|
if (states.size() == 0) {
|
|
|
for (YarnApplicationState state : YarnApplicationState.values()) {
|
|
|
- states.add(state.toString().toLowerCase());
|
|
|
+ states.add(state.toString().toLowerCase(Locale.ENGLISH));
|
|
|
}
|
|
|
}
|
|
|
// in case we extend to multiple applicationTypes in the future
|
|
@@ -518,8 +520,9 @@ public class RMWebServices {
|
|
|
ConcurrentMap<ApplicationId, RMApp> apps = rm.getRMContext().getRMApps();
|
|
|
for (RMApp rmapp : apps.values()) {
|
|
|
YarnApplicationState state = rmapp.createApplicationState();
|
|
|
- String type = rmapp.getApplicationType().trim().toLowerCase();
|
|
|
- if (states.contains(state.toString().toLowerCase())) {
|
|
|
+ String type =
|
|
|
+ rmapp.getApplicationType().trim().toLowerCase(Locale.ENGLISH);
|
|
|
+ if (states.contains(state.toString().toLowerCase(Locale.ENGLISH))) {
|
|
|
if (types.contains(ANY)) {
|
|
|
countApp(scoreboard, state, ANY);
|
|
|
} else if (types.contains(type)) {
|
|
@@ -554,7 +557,8 @@ public class RMWebServices {
|
|
|
if (isState) {
|
|
|
try {
|
|
|
// enum string is in the uppercase
|
|
|
- YarnApplicationState.valueOf(paramStr.trim().toUpperCase());
|
|
|
+ YarnApplicationState.valueOf(
|
|
|
+ paramStr.trim().toUpperCase(Locale.ENGLISH));
|
|
|
} catch (RuntimeException e) {
|
|
|
YarnApplicationState[] stateArray =
|
|
|
YarnApplicationState.values();
|
|
@@ -564,7 +568,7 @@ public class RMWebServices {
|
|
|
+ " specified. It should be one of " + allAppStates);
|
|
|
}
|
|
|
}
|
|
|
- params.add(paramStr.trim().toLowerCase());
|
|
|
+ params.add(paramStr.trim().toLowerCase(Locale.ENGLISH));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -582,7 +586,8 @@ public class RMWebServices {
|
|
|
for (String state : states) {
|
|
|
Map<String, Long> partScoreboard = new HashMap<String, Long>();
|
|
|
scoreboard.put(
|
|
|
- YarnApplicationState.valueOf(state.toUpperCase()), partScoreboard);
|
|
|
+ YarnApplicationState.valueOf(
|
|
|
+ state.toUpperCase(Locale.ENGLISH)), partScoreboard);
|
|
|
// types is verified no to be empty
|
|
|
for (String type : types) {
|
|
|
partScoreboard.put(type, 0L);
|