You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ravindranath Kakarla (Jira)" <ji...@apache.org> on 2021/05/03 17:46:00 UTC
[jira] [Updated] (AVRO-3129) NPE validating schema with enum types
[ https://issues.apache.org/jira/browse/AVRO-3129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ravindranath Kakarla updated AVRO-3129:
---------------------------------------
Description:
I ran into a bug with schema validation code that throws unexpected NullPointerException when validating a schema with enum type. The bug is present in latest version of Avro Java API.
h4. *Schema to replicate issue:*
{ "type": "enum", "name": "Suit", "symbols" : [null] }
*{{Replication Steps:}}*
# Validate the above schema using Java API.
# I used avro-cli for testing but was also able to replicate with API.
# {{java -jar avro-cli-0.2.7.jar normalize -s ~/tmp/schema.txt}}
*{{Exception:}}*
java.lang.NullPointerException: nullat org.apache.avro.Schema.validateName(Schema.java:1557) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema.access$400(Schema.java:91) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema$EnumSchema.<init>(Schema.java:1035) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema.parse(Schema.java:1709) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema.parse(Schema.java:1673) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema$Parser.parse(Schema.java:1430) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema$Parser.parse(Schema.java:1418) ~[avro-1.10.2.jar:1.10.2]
{{As seen in the [code|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1557], there is no null check on symbol which is causing this.}}
was:
I ran into a bug with schema validation code that throws unexpected NullPointerException when validating a schema with enum type. The bug is present in latest version of Avro Java API.
h4. *Schema to replicate issue:*
{ "type": "enum", "name": "Suit", "symbols" : [null] }
h4. *{{Replication Steps:}}*
# Validate the above schema using Java API.
# I used avro-cli for testing but was also able to replicate with API.
# {{java -jar avro-cli-0.2.7.jar normalize -s ~/tmp/schema.txt}}
*{{Exception:}}*
java.lang.NullPointerException: nullat org.apache.avro.Schema.validateName(Schema.java:1557) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema.access$400(Schema.java:91) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema$EnumSchema.<init>(Schema.java:1035) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema.parse(Schema.java:1709) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema.parse(Schema.java:1673) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema$Parser.parse(Schema.java:1430) ~[avro-1.10.2.jar:1.10.2]
at org.apache.avro.Schema$Parser.parse(Schema.java:1418) ~[avro-1.10.2.jar:1.10.2]
{{As seen in the [code|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1557], there is no null check on symbol which is causing this.}}
> NPE validating schema with enum types
> -------------------------------------
>
> Key: AVRO-3129
> URL: https://issues.apache.org/jira/browse/AVRO-3129
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.10.2
> Reporter: Ravindranath Kakarla
> Priority: Major
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> I ran into a bug with schema validation code that throws unexpected NullPointerException when validating a schema with enum type. The bug is present in latest version of Avro Java API.
> h4. *Schema to replicate issue:*
> { "type": "enum", "name": "Suit", "symbols" : [null] }
> *{{Replication Steps:}}*
> # Validate the above schema using Java API.
> # I used avro-cli for testing but was also able to replicate with API.
> # {{java -jar avro-cli-0.2.7.jar normalize -s ~/tmp/schema.txt}}
> *{{Exception:}}*
> java.lang.NullPointerException: nullat org.apache.avro.Schema.validateName(Schema.java:1557) ~[avro-1.10.2.jar:1.10.2]
> at org.apache.avro.Schema.access$400(Schema.java:91) ~[avro-1.10.2.jar:1.10.2]
> at org.apache.avro.Schema$EnumSchema.<init>(Schema.java:1035) ~[avro-1.10.2.jar:1.10.2]
> at org.apache.avro.Schema.parse(Schema.java:1709) ~[avro-1.10.2.jar:1.10.2]
> at org.apache.avro.Schema.parse(Schema.java:1673) ~[avro-1.10.2.jar:1.10.2]
> at org.apache.avro.Schema$Parser.parse(Schema.java:1430) ~[avro-1.10.2.jar:1.10.2]
> at org.apache.avro.Schema$Parser.parse(Schema.java:1418) ~[avro-1.10.2.jar:1.10.2]
>
> {{As seen in the [code|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1557], there is no null check on symbol which is causing this.}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)