avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [20/43] avro git commit: AVRO-1814: Generated java code fails on variables with a TLD name like 'org'
Date Sat, 14 May 2016 23:43:53 GMT
AVRO-1814: Generated java code fails on variables with a TLD name like 'org'


Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/0ca11231
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/0ca11231
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/0ca11231

Branch: refs/heads/branch-1.8
Commit: 0ca11231b09cf8b15a361de932e7d6998cc11f3e
Parents: 8826b38
Author: Niels Basjes <nielsbasjes@apache.org>
Authored: Thu Apr 28 22:46:07 2016 +0200
Committer: Ryan Blue <blue@apache.org>
Committed: Sat May 14 16:43:07 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  2 ++
 .../compiler/specific/templates/java/classic/record.vm   | 11 +++++++----
 .../output-string/avro/examples/baseball/Player.java     | 11 +++++++----
 lang/java/tools/src/test/compiler/output/Player.java     | 11 +++++++----
 share/test/schemas/specialtypes.avdl                     |  8 ++++++++
 5 files changed, 31 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/avro/blob/0ca11231/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bce23ce..5f0b83b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -49,6 +49,8 @@ Trunk (not yet released)
 
     AVRO-1826: build.sh rat fails over extra license files and many others (nielsbasjes).
 
+    AVRO-1814: Generated java code fails on variables with a TLD name like 'org' (nielsbasjes)
+
 Avro 1.8.0 (22 January 2016)
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/avro/blob/0ca11231/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
----------------------------------------------------------------------
diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
index 3c69396..d0c1968 100644
--- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
+++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
@@ -18,6 +18,9 @@
 #if ($schema.getNamespace())
 package $schema.getNamespace();  
 #end
+
+import org.apache.avro.specific.SpecificData;
+
 @SuppressWarnings("all")
 #if ($schema.getDoc())
 /** $schema.getDoc() */
@@ -186,7 +189,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError())
extends or
 
     /** Creates a new Builder */
     private Builder() {
-      super(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.SCHEMA$);
+      super(SCHEMA$);
     }
     
     /**
@@ -214,7 +217,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError())
extends or
      */
     private Builder(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}
other) {
       #if ($schema.isError())super(other)#else
-      super(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.SCHEMA$)#end;
+      super(SCHEMA$)#end;
 #foreach ($field in $schema.getFields())
       if (isValidValue(fields()[$field.pos()], other.${this.mangle($field.name(), $schema.isError())}))
{
         this.${this.mangle($field.name(), $schema.isError())} = data().deepCopy(fields()[$field.pos()].schema(),
other.${this.mangle($field.name(), $schema.isError())});
@@ -377,7 +380,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError())
extends or
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
-    WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out));
+    WRITER$.write(this, SpecificData.getEncoder(out));
   }
 
   private static final org.apache.avro.io.DatumReader
@@ -385,7 +388,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError())
extends or
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {
-    READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in));
+    READER$.read(this, SpecificData.getDecoder(in));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/avro/blob/0ca11231/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
----------------------------------------------------------------------
diff --git a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
index 46a0cba..9d7fbc8 100644
--- a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
+++ b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
@@ -4,6 +4,9 @@
  * DO NOT EDIT DIRECTLY
  */
 package avro.examples.baseball;  
+
+import org.apache.avro.specific.SpecificData;
+
 @SuppressWarnings("all")
 /** 選手 is Japanese for player. */
 @org.apache.avro.specific.AvroGenerated
@@ -166,7 +169,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
 
     /** Creates a new Builder */
     private Builder() {
-      super(avro.examples.baseball.Player.SCHEMA$);
+      super(SCHEMA$);
     }
     
     /**
@@ -198,7 +201,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
      * @param other The existing instance to copy.
      */
     private Builder(avro.examples.baseball.Player other) {
-            super(avro.examples.baseball.Player.SCHEMA$);
+            super(SCHEMA$);
       if (isValidValue(fields()[0], other.number)) {
         this.number = data().deepCopy(fields()[0].schema(), other.number);
         fieldSetFlags()[0] = true;
@@ -396,7 +399,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
-    WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out));
+    WRITER$.write(this, SpecificData.getEncoder(out));
   }
 
   private static final org.apache.avro.io.DatumReader
@@ -404,7 +407,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {
-    READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in));
+    READER$.read(this, SpecificData.getDecoder(in));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/avro/blob/0ca11231/lang/java/tools/src/test/compiler/output/Player.java
----------------------------------------------------------------------
diff --git a/lang/java/tools/src/test/compiler/output/Player.java b/lang/java/tools/src/test/compiler/output/Player.java
index ce05afd..bf0ed62 100644
--- a/lang/java/tools/src/test/compiler/output/Player.java
+++ b/lang/java/tools/src/test/compiler/output/Player.java
@@ -4,6 +4,9 @@
  * DO NOT EDIT DIRECTLY
  */
 package avro.examples.baseball;  
+
+import org.apache.avro.specific.SpecificData;
+
 @SuppressWarnings("all")
 /** 選手 is Japanese for player. */
 @org.apache.avro.specific.AvroGenerated
@@ -166,7 +169,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
 
     /** Creates a new Builder */
     private Builder() {
-      super(avro.examples.baseball.Player.SCHEMA$);
+      super(SCHEMA$);
     }
     
     /**
@@ -198,7 +201,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
      * @param other The existing instance to copy.
      */
     private Builder(avro.examples.baseball.Player other) {
-            super(avro.examples.baseball.Player.SCHEMA$);
+            super(SCHEMA$);
       if (isValidValue(fields()[0], other.number)) {
         this.number = data().deepCopy(fields()[0].schema(), other.number);
         fieldSetFlags()[0] = true;
@@ -396,7 +399,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
-    WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out));
+    WRITER$.write(this, SpecificData.getEncoder(out));
   }
 
   private static final org.apache.avro.io.DatumReader
@@ -404,7 +407,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase
implemen
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {
-    READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in));
+    READER$.read(this, SpecificData.getDecoder(in));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/avro/blob/0ca11231/share/test/schemas/specialtypes.avdl
----------------------------------------------------------------------
diff --git a/share/test/schemas/specialtypes.avdl b/share/test/schemas/specialtypes.avdl
index 623e016..1be3aab 100644
--- a/share/test/schemas/specialtypes.avdl
+++ b/share/test/schemas/specialtypes.avdl
@@ -95,4 +95,12 @@ protocol LetsBreakIt {
       string value;
     }
 
+    record TopLevelDomainNames {
+      string org;
+      string avro;
+      string com;
+      string net;
+      string nl;
+    }
+
 }


Mime
View raw message