[
https://issues.apache.org/jira/browse/AVRO-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Seung-Hyun Cheong updated AVRO-3698:
------------------------------------
Description:
[Java] SpecificData.getClassName must replace reserved words
When makes Java Class, SpecificCompiler adds "$" after reserved words like
public, new, etc...
[https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1129]
[https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L643]
For example, if the namespace of a schema is {*}db.public.table{*}, then the
package name of the generated Java Class, made by SpecificCompiler, is
{*}db.public$.table{*}. (Because *public* is a reserved word in java)
But when deserializes an Avro Record to a SpecificRecord,
SpecificData.getClassName returns {*}db.pulic.table.Name{*}.
So, it can't find a class by name from SpecificData.getClassName.
was:
[Java] SpecificData.getClassName must replace reserved words
When makes Java Class, SpecificCompiler adds "$" after reserved words like
public, new, etc...
[https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1129]
[https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L643]
For example, if the namespace of a schema is {*}db.public.table{*}, then the
package name of the generated Java Class, made by SpecificCompiler, is
{*}db.public$.table{*}.
But when deserializes an Avro Record to a SpecificRecord,
SpecificData.getClassName returns {*}db.pulic.table.Name{*}.
So, it can't find a class by name from SpecificData.getClassName.
> [Java] SpecificData.getClassName must replace reserved words
> ------------------------------------------------------------
>
> Key: AVRO-3698
> URL: https://issues.apache.org/jira/browse/AVRO-3698
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.11.1
> Reporter: Seung-Hyun Cheong
> Priority: Major
> Labels: newbie, patch
> Fix For: 1.11.2
>
> Attachments: AVRO-3698.patch
>
>
> [Java] SpecificData.getClassName must replace reserved words
>
> When makes Java Class, SpecificCompiler adds "$" after reserved words like
> public, new, etc...
> [https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1129]
> [https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L643]
>
> For example, if the namespace of a schema is {*}db.public.table{*}, then the
> package name of the generated Java Class, made by SpecificCompiler, is
> {*}db.public$.table{*}. (Because *public* is a reserved word in java)
>
> But when deserializes an Avro Record to a SpecificRecord,
> SpecificData.getClassName returns {*}db.pulic.table.Name{*}.
>
> So, it can't find a class by name from SpecificData.getClassName.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)