Uploaded image for project: 'Apache Helix'
  1. Apache Helix
  2. HELIX-476

ZNRecordStreamingSerializer.deserialize throw NullPointerException when 'id' property is not the first item in JSON

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.6.3
    • 0.7.1, 0.6.4
    • helix-core
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            flier.lu Flier Lu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: