Repository: cassandra Updated Branches: refs/heads/trunk f1db1afe9 -> b7d0238f6
simplify: parseLong for primitives, valueOf for boxed Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b7d0238f Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b7d0238f Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b7d0238f Branch: refs/heads/trunk Commit: b7d0238f6765638f18e00fdd8f5fc49df63b9d17 Parents: f1db1af Author: Dave Brosius <dbros...@mebigfatguy.com> Authored: Fri Mar 20 20:15:06 2015 -0400 Committer: Dave Brosius <dbros...@mebigfatguy.com> Committed: Fri Mar 20 20:15:06 2015 -0400 ---------------------------------------------------------------------- .../org/apache/cassandra/serializers/SimpleDateSerializer.java | 6 +++--- src/java/org/apache/cassandra/serializers/TimeSerializer.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7d0238f/src/java/org/apache/cassandra/serializers/SimpleDateSerializer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/serializers/SimpleDateSerializer.java b/src/java/org/apache/cassandra/serializers/SimpleDateSerializer.java index 221842b..82cedc0 100644 --- a/src/java/org/apache/cassandra/serializers/SimpleDateSerializer.java +++ b/src/java/org/apache/cassandra/serializers/SimpleDateSerializer.java @@ -52,14 +52,14 @@ public class SimpleDateSerializer implements TypeSerializer<Integer> return value == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value); } - public static Integer dateStringToDays(String source) throws MarshalException + public static int dateStringToDays(String source) throws MarshalException { // Raw day value in unsigned int form, epoch @ 2^31 if (rawPattern.matcher(source).matches()) { try { - Long result = Long.parseLong(source); + long result = Long.parseLong(source); if (result < 0 || result > maxSupportedDays) throw new NumberFormatException("Input out of bounds: " + source); @@ -68,7 +68,7 @@ public class SimpleDateSerializer implements TypeSerializer<Integer> if (result >= Integer.MAX_VALUE) result -= byteOrderShift; - return result.intValue(); + return (int) result; } catch (NumberFormatException e) { http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7d0238f/src/java/org/apache/cassandra/serializers/TimeSerializer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/serializers/TimeSerializer.java b/src/java/org/apache/cassandra/serializers/TimeSerializer.java index 801a942..1f1ce77 100644 --- a/src/java/org/apache/cassandra/serializers/TimeSerializer.java +++ b/src/java/org/apache/cassandra/serializers/TimeSerializer.java @@ -45,7 +45,7 @@ public class TimeSerializer implements TypeSerializer<Long> { try { - Long result = Long.parseLong(source); + long result = Long.parseLong(source); if (result < 0 || result > TimeUnit.DAYS.toNanos(1)) throw new NumberFormatException("Input long out of bounds: " + source); return result;