[
https://issues.apache.org/jira/browse/AVRO-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14500732#comment-14500732
]
Hudson commented on AVRO-1655:
------------------------------
SUCCESS: Integrated in AvroJava #517 (See
[https://builds.apache.org/job/AvroJava/517/])
AVRO-1655. Java: Fix NPE in RecordSchema#toString. Contributed by Lars Francke.
This also adds a variant of Schema.createRecord with a field list to
allow callers to create valid record schemas in a single call. (blue: rev
1674398)
* /avro/trunk/CHANGES.txt
* /avro/trunk/lang/java/avro/src/main/java/org/apache/avro/Schema.java
* /avro/trunk/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java
> 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
> Fix For: 1.8.0
>
> Attachments: AVRO-1655.1.patch, AVRO-1655.2.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
(v6.3.4#6332)