You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by "Flier Lu (JIRA)" <ji...@apache.org> on 2014/07/22 05:35:38 UTC

[jira] [Created] (HELIX-476) ZNRecordStreamingSerializer.deserialize throw NullPointerException when 'id' property is not the first item in JSON

Flier Lu created HELIX-476:
------------------------------

             Summary: 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


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)