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:05 UTC

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

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"))