avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ham...@apache.org
Subject svn commit: r951231 - in /avro/trunk: CHANGES.txt lang/py/src/avro/io.py
Date Fri, 04 Jun 2010 00:57:23 GMT
Author: hammer
Date: Fri Jun  4 00:57:23 2010
New Revision: 951231

URL: http://svn.apache.org/viewvc?rev=951231&view=rev
Log:
AVRO-559. Handle read_union error where the list index of the union branch
to follow exceeds the size of the union schema. (hammer)


Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/py/src/avro/io.py

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=951231&r1=951230&r2=951231&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Fri Jun  4 00:57:23 2010
@@ -44,6 +44,9 @@ Avro 1.4.0 (unreleased)
 
     AVRO-560. Python impl should include system errors in every protocol (hammer)
 
+    AVRO-559. Handle read_union error where the list index of the union branch 
+    to follow exceeds the size of the union schema (hammer)
+
   BUG FIXES
     AVRO-461. Skipping primitives in the ruby side (jmhodges)
 

Modified: avro/trunk/lang/py/src/avro/io.py
URL: http://svn.apache.org/viewvc/avro/trunk/lang/py/src/avro/io.py?rev=951231&r1=951230&r2=951231&view=diff
==============================================================================
--- avro/trunk/lang/py/src/avro/io.py (original)
+++ avro/trunk/lang/py/src/avro/io.py Fri Jun  4 00:57:23 2010
@@ -606,6 +606,10 @@ class DatumReader(object):
     """
     # schema resolution
     index_of_schema = int(decoder.read_long())
+    if index_of_schema >= len(writers_schema.schemas):
+      fail_msg = "Can't access branch index %d for union with %d branches"\
+                 % (index_of_schema, writers_schema.schemas)
+      raise SchemaResolutionException(fail_msg, writers_schema, readers_schema)
     selected_writers_schema = writers_schema.schemas[index_of_schema]
     
     # read data



Mime
View raw message