[
https://issues.apache.org/jira/browse/STORM-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059532#comment-14059532
]
ASF GitHub Bot commented on STORM-328:
--------------------------------------
Github user HeartSaVioR commented on a diff in the pull request:
https://github.com/apache/incubator-storm/pull/187#discussion_r14849803
--- Diff: storm-core/src/jvm/backtype/storm/ConfigValidation.java ---
@@ -82,6 +82,76 @@ public void validateField(String name, Object field)
public static Object MapsValidator =
FieldListValidatorFactory(Map.class);
/**
+ * Validates a Integer.
+ */
+ public static Object IntegerValidator = new FieldValidator() {
+ @Override
+ public void validateField(String name, Object o) throws
IllegalArgumentException {
+ if (o == null) {
+ // A null value is acceptable.
--- End diff --
@d2r I'm not familiar with clojure, but it seems that line 51 you commented
is about Class, not value.
````
(defmethod get-FieldValidator Object
[klass]
{:pre [(not (nil? klass))]}
(reify ConfigValidation$FieldValidator
(validateField [this name v]
(if (and (not (nil? v))
(not (instance? klass v)))
(throw (IllegalArgumentException.
(str "field " name " '" v "' must be a '"
(.getName klass) "'")))))))
````
Actually it have been allowed null value.
It throws IllegalArgumentException when value is not null and value is not
instance of Class.
> Config.java and Utils.get{Int,Long} are not in sync for floating point
> ----------------------------------------------------------------------
>
> Key: STORM-328
> URL: https://issues.apache.org/jira/browse/STORM-328
> Project: Apache Storm (Incubating)
> Issue Type: Bug
> Affects Versions: 0.9.2-incubating, 0.9.1-incubating, 0.9.0.1
> Reporter: Robert Joseph Evans
> Labels: newbie
>
> For most numeric configuration values Config.java has a type of Number
> listed, but the values are parsed using Utils.getInt or Utils.getLong, which
> means if someone gave a floating point number it would pass the
> ConfigValidation, but would blow up when it is used. This is most critical
> for values that Nimbus reads, but would be good to have them consistent
> everywhere.
> We should also check that getInt works properly for numbers that are larger
> then would fit in an integer.
> Either we need to update Utils to be more lenient when looking at doubles, or
> we need to make Config more strict, which may be difficult with the YAML and
> JSON parsing that happens, where ints are often converted into longs.
--
This message was sent by Atlassian JIRA
(v6.2#6252)