avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1124134 - in /avro/branches/branch-1.5: ./ CHANGES.txt lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java lang/java/avro/src/test/java/org/apache/avro/TestReflect.java
Date Wed, 18 May 2011 09:30:56 GMT
Author: cutting
Date: Wed May 18 09:30:55 2011
New Revision: 1124134

URL: http://svn.apache.org/viewvc?rev=1124134&view=rev
Log:
Merge -c 1124127 from trunk to 1.5 branch.  Fixes AVRO-809.

Modified:
    avro/branches/branch-1.5/   (props changed)
    avro/branches/branch-1.5/CHANGES.txt
    avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
    avro/branches/branch-1.5/lang/java/avro/src/test/java/org/apache/avro/TestReflect.java

Propchange: avro/branches/branch-1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 18 09:30:55 2011
@@ -1 +1 @@
-/avro/trunk:1075938,1075993,1078917,1079055,1079060,1079063,1083246,1085921,1086727,1086730,1086866,1087076,1087129,1087136,1087439-1087440,1087463,1087472,1087792,1089128,1089131,1089550,1094812,1095206-1095208,1095493,1095529,1095548,1095550,1096798,1097916,1097927,1097968,1097974,1102332,1102335
+/avro/trunk:1075938,1075993,1078917,1079055,1079060,1079063,1083246,1085921,1086727,1086730,1086866,1087076,1087129,1087136,1087439-1087440,1087463,1087472,1087792,1089128,1089131,1089550,1094812,1095206-1095208,1095493,1095529,1095548,1095550,1096798,1097916,1097927,1097968,1097974,1102332,1102335,1124127

Modified: avro/branches/branch-1.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/CHANGES.txt?rev=1124134&r1=1124133&r2=1124134&view=diff
==============================================================================
--- avro/branches/branch-1.5/CHANGES.txt (original)
+++ avro/branches/branch-1.5/CHANGES.txt Wed May 18 09:30:55 2011
@@ -12,6 +12,8 @@ Avro 1.5.2 (unreleased)
 
     AVRO-819. C: Fix file reader EOF detection (dcreager)
 
+    AVRO-809. Java: Fix reflect for classes that have no package. (cutting)
+
 Avro 1.5.1 (3 May 2011)
 
   NEW FEATURES

Modified: avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java?rev=1124134&r1=1124133&r2=1124134&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
(original)
+++ avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
Wed May 18 09:30:55 2011
@@ -101,7 +101,7 @@ public class SpecificData extends Generi
   public String getClassName(Schema schema) {
     String namespace = schema.getNamespace();
     String name = schema.getName();
-    if (namespace == null)
+    if (namespace == null || "".equals(namespace))
       return name;
     String dot = namespace.endsWith("$") ? "" : ".";
     return namespace + dot + name;

Modified: avro/branches/branch-1.5/lang/java/avro/src/test/java/org/apache/avro/TestReflect.java
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/java/avro/src/test/java/org/apache/avro/TestReflect.java?rev=1124134&r1=1124133&r2=1124134&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/java/avro/src/test/java/org/apache/avro/TestReflect.java
(original)
+++ avro/branches/branch-1.5/lang/java/avro/src/test/java/org/apache/avro/TestReflect.java
Wed May 18 09:30:55 2011
@@ -352,6 +352,12 @@ public class TestReflect {
     assertEquals(e1, response.getTypes().get(1));
   }
 
+  @Test public void testNoPackage() throws Exception {
+    Class noPackage = Class.forName("NoPackage");
+    Schema s = ReflectData.get().getSchema(noPackage);
+    assertEquals(noPackage.getName(), ReflectData.get().getClassName(s));
+  }
+
   void checkReadWrite(Object object) throws Exception {
     checkReadWrite(object, ReflectData.get().getSchema(object.getClass()));
   }



Mime
View raw message