avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Blue (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1655) RecordSchema#fieldsToJson can throw NullPointerException
Date Wed, 01 Apr 2015 17:33:53 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14391042#comment-14391042

Ryan Blue commented on AVRO-1655:

The next release we could do it in is 1.8.x, since the major version number follows the data

You're right that it would help to do something that we can put in a 1.7.x release, so I guess
we should do both: fix the NPE and add the right constructor to avoid the problem. Would you
mind updating the patch?

> RecordSchema#fieldsToJson can throw NullPointerException
> --------------------------------------------------------
>                 Key: AVRO-1655
>                 URL: https://issues.apache.org/jira/browse/AVRO-1655
>             Project: Avro
>          Issue Type: Bug
>    Affects Versions: 1.7.7
>            Reporter: Lars Francke
>            Assignee: Lars Francke
>         Attachments: AVRO-1655.1.patch
> The code just does
> {code}
>       for (Field f : fields) {
> {code}
> without ever checking if fields is set. There is a {{createRecord}} version that does
not take fields so this can be empty. This is especially annoying within the Scala/Spark REPL
as that immediately prints out the result of everything you type so it calls {{toString}}
which then fails and that even leaves the object unset in the REPL.
> I'll attach a patch that checks whether {{fields}} is null.

This message was sent by Atlassian JIRA

View raw message