avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r903745 - in /hadoop/avro/trunk: CHANGES.txt lang/java/src/java/org/apache/avro/generic/GenericData.java lang/java/src/test/java/org/apache/avro/TestProtocolSpecific.java
Date Wed, 27 Jan 2010 17:27:39 GMT
Author: philz
Date: Wed Jan 27 17:27:38 2010
New Revision: 903745

URL: http://svn.apache.org/viewvc?rev=903745&view=rev
Log:
AVRO-382. Avro hashCode throws a NullPointerException when fields are uninitialized.  Contributed
by Michael Armbrust.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/java/src/java/org/apache/avro/generic/GenericData.java
    hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestProtocolSpecific.java

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=903745&r1=903744&r2=903745&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Wed Jan 27 17:27:38 2010
@@ -390,6 +390,8 @@
 
     AVRO-373. EOF detection broken in JsonDecoder (thiru)
 
+    AVRO-382. Avro hashCode throws a NullPointerException when fields are uninitialized (Michael
Armbrust via philz)
+
 Avro 1.2.0 (14 October 2009)
 
   INCOMPATIBLE CHANGES

Modified: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/generic/GenericData.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/generic/GenericData.java?rev=903745&r1=903744&r2=903745&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/generic/GenericData.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/generic/GenericData.java Wed Jan
27 17:27:38 2010
@@ -430,7 +430,7 @@
     case NULL:
       return 0;
     default:
-      return o.hashCode();
+      return (o == null) ? 0 : o.hashCode();
     }
   }
 

Modified: hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestProtocolSpecific.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestProtocolSpecific.java?rev=903745&r1=903744&r2=903745&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestProtocolSpecific.java (original)
+++ hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/TestProtocolSpecific.java Wed
Jan 27 17:27:38 2010
@@ -82,6 +82,12 @@
   }
 
   @Test
+  public void testHashCode() throws IOException {
+    TestError error = new TestError();
+    error.hashCode();
+  }
+
+  @Test
   public void testEcho() throws IOException {
     TestRecord record = new TestRecord();
     record.name = new Utf8("foo");



Mime
View raw message