helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Flier Lu (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HELIX-476) ZNRecordStreamingSerializer.deserialize throw NullPointerException when 'id' property is not the first item in JSON
Date Tue, 22 Jul 2014 03:35:38 GMT
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)

Mime
View raw message