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/11/07 03:42:03 UTC
[jira] [Updated] (AVRO-2608) The generated java-class attribute URI
has an unhandled exception type of URISyntaxException
[ https://issues.apache.org/jira/browse/AVRO-2608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zezeng Wang updated AVRO-2608:
------------------------------
Description:
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.
was:
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.
> 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)