Zoltan Farkas created AVRO-2057:
-----------------------------------

             Summary: JsonDecoder.skipChildren does not skip map/records 
correctly
                 Key: AVRO-2057
                 URL: https://issues.apache.org/jira/browse/AVRO-2057
             Project: Avro
          Issue Type: Bug
    Affects Versions: 1.8.2
            Reporter: Zoltan Farkas
            Priority: Critical


at 
https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java#L585

{code}
      @Override
      public JsonParser skipChildren() throws IOException {
        JsonToken tkn = elements.get(pos).token;
        int level = (tkn == JsonToken.START_ARRAY || tkn == 
JsonToken.END_ARRAY) ? 1 : 0;
        while (level > 0) {
          switch(elements.get(++pos).token) {
          case START_ARRAY:
          case START_OBJECT:
            level++;
            break;
          case END_ARRAY:
          case END_OBJECT:
            level--;
            break;
          }
        }
        return this;
      }
{code}

should be:

{code}
      @Override
      public JsonParser skipChildren() throws IOException {
        JsonToken tkn = elements.get(pos).token;
        int level = (tkn == JsonToken.START_ARRAY || tkn == 
JsonToken.START_OBJECT) ? 1 : 0;
        while (level > 0) {
          switch(elements.get(++pos).token) {
          case START_ARRAY:
          case START_OBJECT:
            level++;
            break;
          case END_ARRAY:
          case END_OBJECT:
            level--;
            break;
          }
        }
        return this;
      }
{code}

This results in de-serialization failures when the reader schema does not have 
fields that are present in the serialized object and the writer schema. 




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to