YARN-8129. Improve error message for invalid value in fields attribute. Contributed by Abhishek Modi.

(cherry picked from commit d3fef7a5c5)
This commit is contained in:
Rohith Sharma K S 2018-08-21 11:58:07 +05:30
parent 18ebe18305
commit 1a53aab4d6
1 changed files with 5 additions and 1 deletions

View File

@ -214,7 +214,11 @@ public final class TimelineReaderWebServicesUtils {
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;
}