Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/2502#discussion_r159968476
--- 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 --
This is not going to work here as a Long can never be larger then MAX_VALUE
for a long or smaller then MIN_VALUE for a Long. Technically I think there may
be a bug in getInt if the number is larger then a Long can hold.
---