YARN-8129. Improve error message for invalid value in fields attribute. Contributed by Abhishek Modi.
This commit is contained in:
parent
770d9d9bb6
commit
d3fef7a5c5
|
@ -214,7 +214,11 @@ public final class TimelineReaderWebServicesUtils {
|
||||||
String[] strs = str.split(delimiter);
|
String[] strs = str.split(delimiter);
|
||||||
EnumSet<Field> fieldList = EnumSet.noneOf(Field.class);
|
EnumSet<Field> fieldList = EnumSet.noneOf(Field.class);
|
||||||
for (String s : strs) {
|
for (String s : strs) {
|
||||||
fieldList.add(Field.valueOf(s.trim().toUpperCase()));
|
try {
|
||||||
|
fieldList.add(Field.valueOf(s.trim().toUpperCase()));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IllegalArgumentException(s + " is not a valid field.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fieldList;
|
return fieldList;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue