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 167C2200B74 for ; Thu, 1 Sep 2016 21:06:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1516D160AB5; Thu, 1 Sep 2016 19:06:39 +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 5CC33160AA8 for ; Thu, 1 Sep 2016 21:06:38 +0200 (CEST) Received: (qmail 34124 invoked by uid 500); 1 Sep 2016 19:06:37 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 34115 invoked by uid 99); 1 Sep 2016 19:06:37 -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, 01 Sep 2016 19:06:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 72B9EDFF8E; Thu, 1 Sep 2016 19:06:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pascalschumacher@apache.org To: commits@groovy.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: JsonOutput#prettyPrint: align CharBuf size with intention expressed in comment (closes #408) Date: Thu, 1 Sep 2016 19:06:37 +0000 (UTC) archived-at: Thu, 01 Sep 2016 19:06:39 -0000 Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X 359b6a93c -> a62888abf JsonOutput#prettyPrint: align CharBuf size with intention expressed in comment (closes #408) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/a62888ab Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/a62888ab Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/a62888ab Branch: refs/heads/GROOVY_2_4_X Commit: a62888abf2a834a5fe3e34d0e160d80740eefba1 Parents: 359b6a9 Author: JuanDavi Evora Hanggi Authored: Thu Sep 1 18:54:16 2016 +0100 Committer: pascalschumacher Committed: Thu Sep 1 21:06:29 2016 +0200 ---------------------------------------------------------------------- .../groovy-json/src/main/java/groovy/json/JsonOutput.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/a62888ab/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java ---------------------------------------------------------------------- diff --git a/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java b/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java index 8bee49d..322e9f1 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java @@ -492,8 +492,8 @@ public class JsonOutput { */ public static String prettyPrint(String jsonPayload) { int indentSize = 0; - // Just a guess that the pretty view will take a 20 percent more than original. - final CharBuf output = CharBuf.create((int) (jsonPayload.length() * 0.2)); + // Just a guess that the pretty view will take 20 percent more than original. + final CharBuf output = CharBuf.create((int) (jsonPayload.length() * 1.2)); JsonLexer lexer = new JsonLexer(new StringReader(jsonPayload)); // Will store already created indents.