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 83A2C200C0F for ; Thu, 19 Jan 2017 02:27:14 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 80A0A160B5E; Thu, 19 Jan 2017 01:27: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 D1115160B44 for ; Thu, 19 Jan 2017 02:27:13 +0100 (CET) Received: (qmail 52376 invoked by uid 500); 19 Jan 2017 01:27:13 -0000 Mailing-List: contact commits-help@parquet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@parquet.apache.org Delivered-To: mailing list commits@parquet.apache.org Received: (qmail 52341 invoked by uid 99); 19 Jan 2017 01:27:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jan 2017 01:27:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BB3D0F1736; Thu, 19 Jan 2017 01:27:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: blue@apache.org To: commits@parquet.apache.org Date: Thu, 19 Jan 2017 01:27:12 -0000 Message-Id: <25406da3dfe343a9a44d6bc62fd223d9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: =?utf-8?q?=5B01/50=5D_=5Babbrv=5D_parquet-mr_git_commit=3A_PARQUET?= =?utf-8?q?-422=3A_Fix_a_potential_bug_in_MessageTypeParser_where_we_ignore?= =?utf-8?b?4oCm?= archived-at: Thu, 19 Jan 2017 01:27:14 -0000 Repository: parquet-mr Updated Branches: refs/heads/parquet-1.8.x [created] c65227886 PARQUET-422: Fix a potential bug in MessageTypeParser where we ignore… … and overwrite the initial value of a method parameter In org.apache.parquet.schema.MessageTypeParser, for addGroupType() and addPrimitiveType(), the initial value of this parameter t is ignored, and t is overwritten here. This often indicates a mistaken belief that the write to the parameter will be conveyed back to the caller. This is a bug found by FindBugs™. Author: proflin Closes #308 from proflin/PARQUET-422 and squashes the following commits: df1f908 [proflin] PARQUET-422: Fix a potential bug in MessageTypeParser where we ignore and overwrite the initial value of a method parameter Project: http://git-wip-us.apache.org/repos/asf/parquet-mr/repo Commit: http://git-wip-us.apache.org/repos/asf/parquet-mr/commit/e37811ab Tree: http://git-wip-us.apache.org/repos/asf/parquet-mr/tree/e37811ab Diff: http://git-wip-us.apache.org/repos/asf/parquet-mr/diff/e37811ab Branch: refs/heads/parquet-1.8.x Commit: e37811ab66431e44090c94cdae95c01594bb108c Parents: 7908bf2 Author: proflin Authored: Tue Jan 12 14:45:24 2016 -0800 Committer: Ryan Blue Committed: Fri Jan 6 12:02:29 2017 -0800 ---------------------------------------------------------------------- .../java/org/apache/parquet/schema/MessageTypeParser.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/e37811ab/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java ---------------------------------------------------------------------- diff --git a/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java b/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java index 3603c79..4981398 100644 --- a/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java +++ b/parquet-column/src/main/java/org/apache/parquet/schema/MessageTypeParser.java @@ -106,14 +106,15 @@ public class MessageTypeParser { // Read type. String type = st.nextToken(); if ("group".equalsIgnoreCase(type)) { - addGroupType(t, st, repetition, builder); + addGroupType(st, repetition, builder); } else { - addPrimitiveType(t, st, asPrimitive(type, st), repetition, builder); + addPrimitiveType(st, asPrimitive(type, st), repetition, builder); } } - private static void addGroupType(String t, Tokenizer st, Repetition r, GroupBuilder builder) { + private static void addGroupType(Tokenizer st, Repetition r, GroupBuilder builder) { GroupBuilder childBuilder = builder.group(r); + String t; String name = st.nextToken(); // Read annotation, if any. @@ -138,8 +139,9 @@ public class MessageTypeParser { childBuilder.named(name); } - private static void addPrimitiveType(String t, Tokenizer st, PrimitiveTypeName type, Repetition r, Types.GroupBuilder builder) { + private static void addPrimitiveType(Tokenizer st, PrimitiveTypeName type, Repetition r, Types.GroupBuilder builder) { PrimitiveBuilder childBuilder = builder.primitive(type, r); + String t; if (type == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) { t = st.nextToken();