[
https://issues.apache.org/jira/browse/STORM-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14058939#comment-14058939
]
ASF GitHub Bot commented on STORM-328:
--------------------------------------
GitHub user HeartSaVioR opened a pull request:
https://github.com/apache/incubator-storm/pull/187
STORM-328 : More restrictive to Config, strict range check within
Utils.getInt()
Related Issue : https://issues.apache.org/jira/browse/STORM-328
There're some reasons to make this change.
1. We use Utils.getInt() to read configuration parameters.
2. Utils.getInt() uses Long.intValue(). It just convert long to int by
narrow conversion, using lowest 4 bytes so it would be weird value.
http://www.myhowto.org/java/60-understanding-the-primitive-numeric-type-conversions-in-java/
3. based on 2. we need to restrict configuration parameters using strict
type validation.
(clojure seems to use long instead of int, so it should be with range
check.)
I checked parameter's type.
int is enough for most of these, topology sample rate needs double.
So I introduce IntegerValidator, IntegersValidator (for ports, etc),
DoubleValidator.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/HeartSaVioR/incubator-storm STORM-328
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-storm/pull/187.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #187
----
commit 214ee7454548b884c591991b1faea770d1478cec
Author: Jungtaek Lim <[email protected]>
Date: 2014-07-11T15:59:01Z
STORM-328 More restrictive to Config, strict range check within Utils.getInt
----
> 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)