avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [02/35] avro git commit: AVRO-1869: Java: Fix Decimal conversion from ByteBuffer.
Date Sat, 05 Nov 2016 20:20:19 GMT
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/1fbf64bf
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/1fbf64bf
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/1fbf64bf

Branch: refs/heads/branch-1.8
Commit: 1fbf64bf84750b8b768f8bcf2800889f9d590588
Parents: fb7f023
Author: Ryan Blue <blue@apache.org>
Authored: Mon Jun 27 20:37:56 2016 -0700
Committer: Ryan Blue <blue@apache.org>
Committed: Sat Nov 5 13:13:28 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/1fbf64bf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7ec6a3e..9fd0e06 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/1fbf64bf/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