[ 
https://issues.apache.org/jira/browse/AVRO-4027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oscar Westra van Holthe - Kind updated AVRO-4027:
-------------------------------------------------
    Fix Version/s: 1.12.1

> IdlReader in Avro 1.12.0 fails with NPE on complex types with empty default 
> value
> ---------------------------------------------------------------------------------
>
>                 Key: AVRO-4027
>                 URL: https://issues.apache.org/jira/browse/AVRO-4027
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.12.0
>            Reporter: Raphael Rösch
>            Assignee: Oscar Westra van Holthe - Kind
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.12.1, 1.13.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Given this avdl (TestProtocol.avdl):
> {noformat}
> protocol TestProtocol {
>     record Test {
>         map<string> myMap = {};
>     }
> }
> {noformat}
> With Avro 1.12.0 'IdlReader' fails with a NullPointerException:
> {code:bash}
> $ java -jar avro-tools-1.12.0.jar idl ./TestProtocol.avdl
> Exception in thread "main" org.apache.avro.SchemaParseException: 
> java.lang.NullPointerException: Cannot invoke 
> "org.antlr.v4.runtime.Token.getText()" because "stringToken" is null
>       at org.apache.avro.idl.IdlReader.parse(IdlReader.java:224)
>       at org.apache.avro.idl.IdlReader.parse(IdlReader.java:187)
>       at org.apache.avro.idl.IdlReader.parse(IdlReader.java:172)
>       at org.apache.avro.tool.IdlTool.run(IdlTool.java:70)
>       at org.apache.avro.tool.Main.run(Main.java:67)
>       at org.apache.avro.tool.Main.main(Main.java:56)
> Caused by: java.lang.NullPointerException: Cannot invoke 
> "org.antlr.v4.runtime.Token.getText()" because "stringToken" is null
>       at 
> org.apache.avro.idl.IdlReader$IdlParserListener.getString(IdlReader.java:975)
>       at 
> org.apache.avro.idl.IdlReader$IdlParserListener.exitJsonPair(IdlReader.java:926)
>       at 
> org.apache.avro.idl.IdlParser$JsonPairContext.exitRule(IdlParser.java:2558)
>       at org.antlr.v4.runtime.Parser.triggerExitRuleEvent(Parser.java:410)
>       at org.antlr.v4.runtime.Parser.exitRule(Parser.java:642)
>       at org.apache.avro.idl.IdlParser.idlFile(IdlParser.java:289)
>       at org.apache.avro.idl.IdlReader.parse(IdlReader.java:220)
>       ... 5 more
> {code}
> With Avro 1.11.3
> {code:bash}
> $ java -jar avro-tools-1.11.3.jar idl ./TestProtocol.avdl
> {
>   "protocol" : "TestProtocol",
>   "types" : [ {
>     "type" : "record",
>     "name" : "Test",
>     "fields" : [ {
>       "name" : "myMap",
>       "type" : {
>         "type" : "map",
>         "values" : "string"
>       },
>       "default" : { }
>     } ]
>   } ],
>   "messages" : { }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to