You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Zezeng Wang (Jira)" <ji...@apache.org> on 2019/10/28 01:32:00 UTC

[jira] [Created] (AVRO-2607) The generated java-class attribute URI has an unhandled exception type of URISyntaxException

Zezeng Wang created AVRO-2607:
---------------------------------

             Summary: The generated java-class attribute URI has an unhandled exception type of URISyntaxException
                 Key: AVRO-2607
                 URL: https://issues.apache.org/jira/browse/AVRO-2607
             Project: Apache Avro
          Issue Type: Bug
          Components: java
            Reporter: Zezeng Wang
            Assignee: Zezeng Wang
             Fix For: 1.10.0


When creating a java.net.URI Object,there is no handling of a URISyntaxException.

Given a specific record generated from the following avsc:
(code:java)
{"namespace": "example.avro",
 "type": "record",
 "name": "User",
 "fields": [
     {"name": "name", "type": "string"},
     {"name": "favorite_number",  "type": ["int", "null"]},
     {"name": "favorite_color", "type": ["string", "null"]},
	 {
		"name": "ownerAddress",
		"type": [
		  "null",
		  {
			"type": "string",
			"java-class": "java.lang.URI"
		  }
		],
		"default": null
	}
 ]
}(code)
(code:java)
@org.apache.avro.specific.AvroGenerated
public class User extends org.apache.avro.specific......
{
......
private java.net.URI ownerAddress; 
......
this.ownerAddress = new java.net.URI(in.readString());
*{color:red}//There is Unhandled exception type URISyntaxException{color}*
}
}(code)
If you want to use the customDecode method, there will be an error



--
This message was sent by Atlassian Jira
(v8.3.4#803005)