From 20d3ec46fd2c07eba4bfbefacd9fe868849828ae Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Tue, 27 Mar 2007 14:16:09 +0000 Subject: [PATCH] allocate extra space when expanding CharBuffer: SANDBOX-189 git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/sandbox/csv/trunk@522920 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/commons/csv/CharBuffer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/org/apache/commons/csv/CharBuffer.java b/src/java/org/apache/commons/csv/CharBuffer.java index 0294fdb4..b8e03cd0 100644 --- a/src/java/org/apache/commons/csv/CharBuffer.java +++ b/src/java/org/apache/commons/csv/CharBuffer.java @@ -183,7 +183,7 @@ public class CharBuffer { */ public void provideCapacity(final int capacity) { if (c.length >= capacity) return; - int newcapacity = capacity; + int newcapacity = ((capacity*3)>>1) + 1; char[] newc = new char[newcapacity]; System.arraycopy(c, 0, newc, 0, length); c = newc;