avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject avro git commit: AVRO-1869: Java: Fix Decimal conversion from ByteBuffer.
Date Tue, 28 Jun 2016 16:14:20 GMT
Repository: avro
Updated Branches:
  refs/heads/master 89a31b923 -> 0376544cf


AVRO-1869: Java: Fix Decimal conversion from ByteBuffer.


Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/0376544c
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/0376544c
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/0376544c

Branch: refs/heads/master
Commit: 0376544cf47600eb1a23f0dc098051fbc75ec00c
Parents: 89a31b9
Author: Ryan Blue <blue@apache.org>
Authored: Mon Jun 27 20:37:56 2016 -0700
Committer: Ryan Blue <blue@apache.org>
Committed: Tue Jun 28 09:14:02 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                   | 2 ++
 lang/java/avro/src/main/java/org/apache/avro/Conversions.java | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/avro/blob/0376544c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 37ff25c..0dfbdfc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -15,6 +15,8 @@ Trunk (not yet released)
     AVRO-1741: Python3: Fix error when codec is not in the header.
     (Matthew Hayes via blue)
 
+    AVRO-1869: Java: Fix Decimal conversion from ByteBuffer. (blue)
+
 Avro 1.8.1 (14 May 2016)
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/avro/blob/0376544c/lang/java/avro/src/main/java/org/apache/avro/Conversions.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/Conversions.java b/lang/java/avro/src/main/java/org/apache/avro/Conversions.java
index bf429ea..e95add7 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/Conversions.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/Conversions.java
@@ -80,7 +80,8 @@ public class Conversions {
     public BigDecimal fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
       int scale = ((LogicalTypes.Decimal) type).getScale();
       // always copy the bytes out because BigInteger has no offset/length ctor
-      byte[] bytes = value.get(new byte[value.remaining()]).array();
+      byte[] bytes = new byte[value.remaining()];
+      value.get(bytes);
       return new BigDecimal(new BigInteger(bytes), scale);
     }
 


Mime
View raw message