avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From th...@apache.org
Subject svn commit: r1337322 - in /avro/trunk: CHANGES.txt lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java
Date Fri, 11 May 2012 18:07:25 GMT
Author: thiru
Date: Fri May 11 18:07:25 2012
New Revision: 1337322

URL: http://svn.apache.org/viewvc?rev=1337322&view=rev
Log:
AVRO-1066. ArrayIndexOutOfBoundsException in ParsingEncoder when trying to use a json encoder
to serialize a deep object graph

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java
    avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1337322&r1=1337321&r2=1337322&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Fri May 11 18:07:25 2012
@@ -42,6 +42,8 @@ Avro 1.7.0 (unreleased)
 
     AVRO-1080. JsonIO.cc should allow \u escape sequence in string. (Keh-Li Sheng via thiru)
 
+    AVRO-1066. ArrayIndexOutOfBoundsException in ParsingEncoder when trying to use a json
encoder to serialize a deep object graph. (thiru)
+
 Avro 1.6.3 (5 March 2012)
 
   IMPROVEMENTS

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java?rev=1337322&r1=1337321&r2=1337322&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java Fri May
11 18:07:25 2012
@@ -49,10 +49,10 @@ public abstract class ParsingEncoder ext
 
   /** Push a new collection on to the stack. */
   protected final void push() {
-    if (pos == counts.length) {
+    if (++pos == counts.length) {
       counts = Arrays.copyOf(counts, pos + 10);
     }
-    counts[++pos] = 0;
+    counts[pos] = 0;
   }
   
   protected final void pop() {

Modified: avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java?rev=1337322&r1=1337321&r2=1337322&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java (original)
+++ avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java Fri May
11 18:07:25 2012
@@ -835,6 +835,13 @@ public class TestValidatingIO {
           + "{\"name\":\"car\", \"type\":\"Lisp\"},"
           + "{\"name\":\"cdr\", \"type\":\"Lisp\"}]}]}]}",
           "U2U1S10U0N"},
+          
+        // Deep recursion
+        { "{\"type\": \"record\", \"name\": \"Node\", \"fields\": ["
+          + "{\"name\":\"children\", \"type\":"
+          + "{\"type\": \"array\", \"items\": \"Node\" }}]}",
+          "[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[]]]]]]]]]]]]" },
+              
     };
   }
   



Mime
View raw message