diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java index f83c1ac346f..ae19b213040 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java @@ -214,7 +214,11 @@ public final class TimelineReaderWebServicesUtils { String[] strs = str.split(delimiter); EnumSet fieldList = EnumSet.noneOf(Field.class); 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; }