hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1358454 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/io/serializer/avro/AvroReflectSerialization.java src/test/java/org/apache/hadoop/io/serializer/avro/TestAvroSerialization.java
Date Fri, 06 Jul 2012 22:27:14 GMT
Author: tucu
Date: Fri Jul  6 22:27:13 2012
New Revision: 1358454

URL: http://svn.apache.org/viewvc?rev=1358454&view=rev
Log:
HADOOP-8566. AvroReflectSerializer.accept(Class) throws a NPE if the class has no package
(primitive types and arrays). (tucu)

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroReflectSerialization.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/TestAvroSerialization.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1358454&r1=1358453&r2=1358454&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Fri Jul  6 22:27:13
2012
@@ -313,6 +313,9 @@ Branch-2 ( Unreleased changes )
     HADOOP-8563. don't package hadoop-pipes examples/bin
     (Colin Patrick McCabe via tgraves)
 
+    HADOOP-8566. AvroReflectSerializer.accept(Class) throws a NPE if the class has no 
+    package (primitive types and arrays). (tucu)
+
   BREAKDOWN OF HDFS-3042 SUBTASKS
 
     HADOOP-8220. ZKFailoverController doesn't handle failure to become active

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroReflectSerialization.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroReflectSerialization.java?rev=1358454&r1=1358453&r2=1358454&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroReflectSerialization.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroReflectSerialization.java
Fri Jul  6 22:27:13 2012
@@ -58,8 +58,8 @@ public class AvroReflectSerialization ex
     if (packages == null) {
       getPackages();
     }
-    return AvroReflectSerializable.class.isAssignableFrom(c) || 
-      packages.contains(c.getPackage().getName());
+    return AvroReflectSerializable.class.isAssignableFrom(c) ||
+      (c.getPackage() != null && packages.contains(c.getPackage().getName()));
   }
 
   private void getPackages() {

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/TestAvroSerialization.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/TestAvroSerialization.java?rev=1358454&r1=1358453&r2=1358454&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/TestAvroSerialization.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/TestAvroSerialization.java
Fri Jul  6 22:27:13 2012
@@ -21,6 +21,7 @@ package org.apache.hadoop.io.serializer.
 import junit.framework.TestCase;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.serializer.SerializationFactory;
 import org.apache.hadoop.io.serializer.SerializationTestUtil;
 
 public class TestAvroSerialization extends TestCase {
@@ -43,6 +44,12 @@ public class TestAvroSerialization exten
     assertEquals(before, after);
   }
 
+  public void testAcceptHandlingPrimitivesAndArrays() throws Exception {
+    SerializationFactory factory = new SerializationFactory(conf);
+    assertNull(factory.getSerializer(byte[].class));
+    assertNull(factory.getSerializer(byte.class));
+  }
+
   public void testReflectInnerClass() throws Exception {
     InnerRecord before = new InnerRecord();
     before.x = 10;



Mime
View raw message