Jeppe Fihl-Pearson created AVRO-4164:
----------------------------------------
Summary: NPE when specifying nullable array in IDL
Key: AVRO-4164
URL: https://issues.apache.org/jira/browse/AVRO-4164
Project: Apache Avro
Issue Type: Bug
Affects Versions: 1.12.0
Reporter: Jeppe Fihl-Pearson
When specifying a schema with a nullable array, a NPE is raised when trying to
convert the AVDL file to AVSC.
Minimal reproduction case:
{{schema Test;}}
{{record Test {}}
{{ array<int>? field = null;}}
{{}}}
When attempting to convert it to AVSC the following exception is emitted:
{quote}Exception in thread "main" org.apache.avro.SchemaParseException:
java.lang.NullPointerException: Cannot read field "word" because "ctx" is null
at org.apache.avro.idl.IdlReader.parse(IdlReader.java:220)
at org.apache.avro.idl.IdlReader.parse(IdlReader.java:183)
at org.apache.avro.idl.IdlReader.parse(IdlReader.java:168)
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 read field "word" because
"ctx" is null
at
org.apache.avro.idl.IdlReader$IdlParserListener.identifier(IdlReader.java:929)
at
org.apache.avro.idl.IdlReader$IdlParserListener.exitVariableDeclaration(IdlReader.java:616)
at
org.apache.avro.idl.IdlParser$VariableDeclarationContext.exitRule(IdlParser.java:1477)
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:216)
... 5 more
{quote}
This is when testing with the latest Avro Tools snapshot version:
{{{}avro-tools-1.13.0-20250627.213521-100.jar{}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)