[ https://issues.apache.org/jira/browse/AVRO-3993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17853928#comment-17853928 ]
ASF subversion and git services commented on AVRO-3993: ------------------------------------------------------- Commit 25651dc2909a18e62d8219d2a730bf02040d576f in avro's branch refs/heads/main from Gray [ https://gitbox.apache.org/repos/asf?p=avro.git;h=25651dc29 ] AVRO-3993: [java] Add better exception msgs when writing invalid enum symnbol (#2945) * Added better exception messages when writing invalid enum symnbol. * Remove unnecessary import. * revert local pom changes that werent supposed to go * improved the comment * fixed some characters per the validation --------- Co-authored-by: Gray Watson <gwat...@abinitio.com> > Writing an AVRO enum field with an invalid value generates unhelpful NPE > ------------------------------------------------------------------------ > > Key: AVRO-3993 > URL: https://issues.apache.org/jira/browse/AVRO-3993 > Project: Apache Avro > Issue Type: Bug > Components: java > Reporter: Gray > Priority: Minor > Labels: pull-request-available > Attachments: avro-stacktrace.txt > > Time Spent: 20m > Remaining Estimate: 0h > > {{When an enum field is written with a symbol that is not one of the valid > enum symbols configured in the schema, the code generates a NPE which turns > into a null value message which is not extremely helpful. It would be useful > if the message mentioned the invalid symbol and the available symbols from > the schema.}} > Here's a sample of the generated stack trace. More in the attachment: > {{java.lang.NullPointerException: null value for (non-nullable) enum1 at > record1.field1}} > {{ ...}} > {{Caused by: java.lang.NullPointerException}} > {{ at org.apache.avro.Schema$EnumSchema.getEnumOrdinal(Schema.java:1118)}} > {{...}} -- This message was sent by Atlassian Jira (v8.20.10#820010)