[ https://issues.apache.org/jira/browse/AVRO-2608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16967480#comment-16967480 ]
Ryan Skraba commented on AVRO-2608: ----------------------------------- This should probably be supported -- in the code there are five ["common stringable classes"|https://github.com/apache/avro/blob/2d3b1fe7efd865639663ba785877182e7e038c45/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java#L102], including {{java.net.URI}}. What do you think about adding {{java.net.URL}} to the fix? Only URI and URL throw a non-RuntimeException in the single-string constructor. > The generated java-class attribute URI has an unhandled exception type of > URISyntaxException > -------------------------------------------------------------------------------------------- > > Key: AVRO-2608 > URL: https://issues.apache.org/jira/browse/AVRO-2608 > Project: Apache Avro > Issue Type: Bug > Components: java > Reporter: Zezeng Wang > Assignee: Zezeng Wang > Priority: Major > 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; > ...... > {color:red}this.ownerAddress = new java.net.URI(in.readString());{color} > *{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)