Github user srdo commented on a diff in the pull request:
https://github.com/apache/storm/pull/2203#discussion_r155642731
--- Diff:
storm-core/src/jvm/org/apache/storm/validation/ConfigValidation.java ---
@@ -493,6 +493,46 @@ public void validateField(String name, Object o) {
}
}
+ public static class MetricReportersValidator extends Validator {
+
+ @Override
+ public void validateField(String name, Object o) {
+ if(o == null) {
+ return;
+ }
+ SimpleTypeValidator.validateField(name, Map.class, o);
+ if(!((Map) o).containsKey("class") ) {
+ throw new IllegalArgumentException( "Field " + name + "
must have map entry with key: class");
+ }
+ if(!((Map) o).containsKey("daemons") ) {
+ throw new IllegalArgumentException("Field " + name + "
must have map entry with key: daemons");
+ } else {
+ // daemons can only be 'nimbus', 'supervisor', or 'worker'
+ Object list = ((Map)o).get("daemons");
+ if(list == null || !(list instanceof List)){
--- End diff --
Nit: Redundant null check. null instanceof List is false.
---