You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by dk...@apache.org on 2020/05/21 15:10:04 UTC

[avro] branch master updated (a57f753 -> b0c0936)

This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git.


    from a57f753  Change modification plan
     new 7baac0f  AVRO-2608:The generated java-class attribute URI has an unhandle excpeiont type of URISyntaxException
     new 192cd3b  Generated java-class attribute URL has an non-RuntimeException
     new b0c0936  AVRO-2608 Increase test cases

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../compiler/specific/templates/java/classic/record.vm   | 14 ++++++++++++++
 .../avro/compiler/specific/TestSpecificCompiler.java     | 16 ++++++++++++++++
 2 files changed, 30 insertions(+)


[avro] 03/03: AVRO-2608 Increase test cases

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git

commit b0c09361fe985fe57858f19485b43e1deeec8d89
Author: zeshuai007 <51...@qq.com>
AuthorDate: Tue Nov 12 11:29:36 2019 +0800

    AVRO-2608 Increase test cases
---
 .../avro/compiler/specific/TestSpecificCompiler.java     | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java b/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
index 32b2edc..7c42ca9 100644
--- a/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
+++ b/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
@@ -642,4 +642,20 @@ public class TestSpecificCompiler {
         fileManager.getJavaFileObjects(javaFiles.toArray(new File[0])));
     assertTrue(cTask.call());
   }
+
+  private static String SCHEMA1 = "{ \"name\": \"volatile\", \"type\": \"record\", "
+      + "  \"fields\": [{\"name\": \"ownerAddress\", \"type\": [\"null\",{ \"type\": \"string\",\"java-class\": \"java.net.URI\"}], \"default\": null},"
+      + "                {\"name\": \"ownerURL\", \"type\": [\"null\",{ \"type\": \"string\",\"java-class\": \"java.net.URL\"}], \"default\": null}]}";
+
+  @Test
+  public void testGenerateExceptionCodeBlock() throws IOException {
+    Collection<OutputFile> outputs = new SpecificCompiler(new Schema.Parser().parse(SCHEMA1)).compile();
+    assertEquals(1, outputs.size());
+    String contents = outputs.iterator().next().contents;
+
+    assertTrue(contents.contains("private java.net.URI"));
+    assertTrue(contents.contains("catch (java.net.URISyntaxException e)"));
+    assertTrue(contents.contains("private java.net.URL"));
+    assertTrue(contents.contains("catch (java.net.MalformedURLException e)"));
+  }
 }


[avro] 01/03: AVRO-2608:The generated java-class attribute URI has an unhandle excpeiont type of URISyntaxException

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 7baac0fbb5b8ff9d42e97e2dd65936318ae7f5c7
Author: zeshuai007 <51...@qq.com>
AuthorDate: Mon Oct 28 10:06:23 2019 +0800

    AVRO-2608:The generated java-class attribute URI has an unhandle excpeiont type of URISyntaxException
---
 .../avro/compiler/specific/templates/java/classic/record.vm       | 8 ++++++++
 1 file changed, 8 insertions(+)

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 69e5b00..563f94b 100755
--- 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
@@ -758,7 +758,15 @@ $I    $var = ${this.javaType($s)}.values()[in.readEnum()];
 #macro( decodeString $II $var $s )
 #set ($st = ${this.getStringType($s)})
 #if ($this.isStringable($s))
+#if ($st.equals("java.net.URI"))
+$II    try {
+$II      ${var} = new ${st}(in.readString());
+$II    } catch (java.net.URISyntaxException e) {
+$II      throw new java.io.IOException(e.getMessage());
+$II    }
+#else
 $II    ${var} = new ${st}(in.readString());
+#end
 #elseif ($st.equals("java.lang.String"))
 $II    $var = in.readString();
 #elseif ($st.equals("org.apache.avro.util.Utf8"))


[avro] 02/03: Generated java-class attribute URL has an non-RuntimeException

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 192cd3b8d607ce77a268f99ab4e3450597d882db
Author: zeshuai007 <51...@qq.com>
AuthorDate: Thu Nov 7 15:33:42 2019 +0800

    Generated java-class attribute URL has an non-RuntimeException
---
 .../apache/avro/compiler/specific/templates/java/classic/record.vm  | 6 ++++++
 1 file changed, 6 insertions(+)

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 563f94b..4158fdd 100755
--- 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
@@ -764,6 +764,12 @@ $II      ${var} = new ${st}(in.readString());
 $II    } catch (java.net.URISyntaxException e) {
 $II      throw new java.io.IOException(e.getMessage());
 $II    }
+#elseif ($st.equals("java.net.URL"))
+$II    try {
+$II      ${var} = new ${st}(in.readString());
+$II    } catch (java.net.MalformedURLException e) {
+$II      throw new java.io.IOException(e.getMessage());
+$II    }
 #else
 $II    ${var} = new ${st}(in.readString());
 #end