YARN-8129. Improve error message for invalid value in fields attribute. Contributed by Abhishek Modi.
(cherry picked from commit d3fef7a5c5b83d27e87b5e49928254a7d1b935e5)
This commit is contained in:
parent
8df2eb8119
commit
63d5214332
@ -214,7 +214,11 @@ static EnumSet<Field> parseFieldsStr(String str, String delimiter) {
|
||||
String[] strs = str.split(delimiter);
|
||||
EnumSet<Field> fieldList = EnumSet.noneOf(Field.class);
|
||||
for (String s : strs) {
|
||||
try {
|
||||
fieldList.add(Field.valueOf(s.trim().toUpperCase()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalArgumentException(s + " is not a valid field.");
|
||||
}
|
||||
}
|
||||
return fieldList;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user