Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B27C7200AC8 for ; Mon, 9 May 2016 00:28:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B0F9E160A07; Sun, 8 May 2016 22:28:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 02C45160A06 for ; Mon, 9 May 2016 00:28:13 +0200 (CEST) Received: (qmail 22795 invoked by uid 500); 8 May 2016 22:28:13 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 22784 invoked by uid 99); 8 May 2016 22:28:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2016 22:28:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E839F2C1F5D for ; Sun, 8 May 2016 22:28:12 +0000 (UTC) Date: Sun, 8 May 2016 22:28:12 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AVRO-1711) JsonDecoder.skipChildren skips more than it should. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 08 May 2016 22:28:14 -0000 [ https://issues.apache.org/jira/browse/AVRO-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15275769#comment-15275769 ] ASF subversion and git services commented on AVRO-1711: ------------------------------------------------------- Commit 7e10babe3eaad11c90cfed41553fc0c1ff90c16a in avro's branch refs/heads/master from [~rdblue] [ https://git-wip-us.apache.org/repos/asf?p=avro.git;h=7e10bab ] AVRO-1711: Java: Fix JsonDecoder#skipChildren skipping extra tokens. Contributed by Zoltan Farkas and Thiruvalluvan M. G. > JsonDecoder.skipChildren skips more than it should. > --------------------------------------------------- > > Key: AVRO-1711 > URL: https://issues.apache.org/jira/browse/AVRO-1711 > Project: Avro > Issue Type: Bug > Affects Versions: 1.8.0 > Reporter: Zoltan Farkas > Assignee: Zoltan Farkas > Attachments: AVRO-1711.patch > > > JsonDecoder.skipChildren() does not respect Contract, it will point to the next available token after END_ARRAY and END_OBJECT. It should point to END_ARRAY and END_OBJECT instead > Here is current implementation: > {noformat} > @Override > public JsonParser skipChildren() throws IOException { > int level = 0; > do { > switch(elements.get(pos++).token) { > case START_ARRAY: > case START_OBJECT: > level++; > break; > case END_ARRAY: > case END_OBJECT: > level--; > break; > } > } while (level > 0); > return this; > } > {noformat} > Here is the documentation of what the method needs to do: > {noformat} > /** > * Method that will skip all child tokens of an array or > * object token that the parser currently points to, > * iff stream points to > * {@link JsonToken#START_OBJECT} or {@link JsonToken#START_ARRAY}. > * If not, it will do nothing. > * After skipping, stream will point to matching > * {@link JsonToken#END_OBJECT} or {@link JsonToken#END_ARRAY} > * (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens > * as well as value tokens). > * The idea is that after calling this method, application > * will call {@link #nextToken} to point to the next > * available token, if any. > */ > {noformat} > here is the implementation, fixed: > {noformat} > @Override > public JsonParser skipChildren() throws IOException { > int level = 0; > do { > switch(elements.get(pos++).token) { > case START_ARRAY: > case START_OBJECT: > level++; > break; > case END_ARRAY: > case END_OBJECT: > level--; > break; > } > } while (level > 0); > pos--; > return this; > } > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)