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 9B226200C6F for ; Tue, 9 May 2017 22:01:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 99E89160BCC; Tue, 9 May 2017 20:01:30 +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 3C033160BD5 for ; Tue, 9 May 2017 22:01:29 +0200 (CEST) Received: (qmail 76944 invoked by uid 500); 9 May 2017 20:01:28 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 76504 invoked by uid 99); 9 May 2017 20:01:28 -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; Tue, 09 May 2017 20:01:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DE3E7F1741; Tue, 9 May 2017 20:01:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: olegk@apache.org To: commits@hc.apache.org Date: Tue, 09 May 2017 20:01:41 -0000 Message-Id: <23f8a080a3944f429089c8cf86276e23@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [15/50] httpcomponents-core git commit: Refactor magic number. archived-at: Tue, 09 May 2017 20:01:30 -0000 Refactor magic number. git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1778357 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5f800413 Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5f800413 Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5f800413 Branch: refs/heads/4.4.x Commit: 5f800413a371dcb07e794e8d03cafad8b2d65110 Parents: a15ca59 Author: Gary D. Gregory Authored: Wed Jan 11 23:44:17 2017 +0000 Committer: Gary D. Gregory Committed: Wed Jan 11 23:44:17 2017 +0000 ---------------------------------------------------------------------- httpcore/src/main/java/org/apache/http/util/EntityUtils.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5f800413/httpcore/src/main/java/org/apache/http/util/EntityUtils.java ---------------------------------------------------------------------- diff --git a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java index 83297f0..e401f4e 100644 --- a/httpcore/src/main/java/org/apache/http/util/EntityUtils.java +++ b/httpcore/src/main/java/org/apache/http/util/EntityUtils.java @@ -50,6 +50,8 @@ import org.apache.http.protocol.HTTP; */ public final class EntityUtils { + private static final int DEFAULT_BUFFER_SIZE = 4096; + private EntityUtils() { } @@ -128,10 +130,10 @@ public final class EntityUtils { "HTTP entity too large to be buffered in memory"); int i = (int)entity.getContentLength(); if (i < 0) { - i = 4096; + i = DEFAULT_BUFFER_SIZE; } final ByteArrayBuffer buffer = new ByteArrayBuffer(i); - final byte[] tmp = new byte[4096]; + final byte[] tmp = new byte[DEFAULT_BUFFER_SIZE]; int l; while((l = instream.read(tmp)) != -1) { buffer.append(tmp, 0, l); @@ -205,7 +207,7 @@ public final class EntityUtils { "HTTP entity too large to be buffered in memory"); int i = (int)entity.getContentLength(); if (i < 0) { - i = 4096; + i = DEFAULT_BUFFER_SIZE; } Charset charset = null; if (contentType != null) {