helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kanak Biscuitwala (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HELIX-476) ZNRecordStreamingSerializer.deserialize throw NullPointerException when 'id' property is not the first item in JSON
Date Tue, 22 Jul 2014 16:50:38 GMT

    [ https://issues.apache.org/jira/browse/HELIX-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14070494#comment-14070494
] 

Kanak Biscuitwala commented on HELIX-476:
-----------------------------------------

This is a duplicate of HELIX-292, which should already be in 0.6.3. In any case, 0.6.4 should
be able to resolve this issue, and I have merged your pull request in pyhelix.

> ZNRecordStreamingSerializer.deserialize throw NullPointerException when 'id' property
is not the first item in JSON 
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HELIX-476
>                 URL: https://issues.apache.org/jira/browse/HELIX-476
>             Project: Apache Helix
>          Issue Type: Bug
>          Components: helix-core
>    Affects Versions: 0.6.3
>            Reporter: Flier Lu
>            Priority: Minor
>             Fix For: 0.7.1
>
>
> ZNRecordStreamingSerializer.deserialize create ZNRecord when found 'id' property, but
if 'id' is not the first item in JSON (from python etc), the record will be null and throw
NullPointerException when parse another property. 
>       while (jp.nextToken() != JsonToken.END_OBJECT) {
>         String fieldname = jp.getCurrentName();
>         jp.nextToken(); // move to value, or START_OBJECT/START_ARRAY
>         if ("id".equals(fieldname)) {
>           // contains an object
>           record = new ZNRecord(jp.getText()); // CREATE ZNRecord
>         } else if ("simpleFields".equals(fieldname)) {
>           while (jp.nextToken() != JsonToken.END_OBJECT) {
>             String key = jp.getCurrentName();
>             jp.nextToken(); // move to value
>             record.setSimpleField(key, jp.getText()); // CRASH
>           }
> we need cached those property before we meet the 'id' property



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message