Github user roshannaik commented on a diff in the pull request: https://github.com/apache/storm/pull/2502#discussion_r161361250 --- Diff: storm-client/src/jvm/org/apache/storm/utils/ObjectReader.java --- @@ -76,6 +76,32 @@ public static Integer getInt(Object o, Integer defaultValue) { throw new IllegalArgumentException("Don't know how to convert " + o + " to int"); } + public static Long getLong(Object o) { + return getLong(o, null); + } + + public static Long getLong(Object o, Long defaultValue) { + if (null == o) { + return defaultValue; + } + + if ( o instanceof Long || + o instanceof Integer || + o instanceof Short || + o instanceof Byte) { + return ((Number) o).longValue(); + } else if (o instanceof Double) { + final long l = (Long) o; --- End diff -- yes my bad. I think its ok to throw exception for numbers larger than Long. I dont see the bug in getInt
---