* gnu/gcj/runtime/StringBuffer.java

(ensureCapacity_unsynchronized): Ensure we always get at least
	`minimumCapacity' characters in new buffer.

From-SVN: r47940
This commit is contained in:
Tom Tromey 2001-12-12 16:50:01 +00:00 committed by Tom Tromey
parent dc5c569ae3
commit a46ce590a8
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2001-12-12 Tom Tromey <tromey@redhat.com>
* gnu/gcj/runtime/StringBuffer.java
(ensureCapacity_unsynchronized): Ensure we always get at least
`minimumCapacity' characters in new buffer.
2001-12-11 Tom Tromey <tromey@redhat.com>
* java/lang/String.java (String): New constructor.

View File

@ -130,7 +130,7 @@ public final class StringBuffer
{
if (minimumCapacity > value.length)
{
minimumCapacity = value.length * 2 + 2;
minimumCapacity = Math.max (minimumCapacity, value.length * 2 + 2);
char[] nb = new char[minimumCapacity];
System.arraycopy(value, 0, nb, 0, count);
value = nb;