This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: new StringBuffer fix
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 12 Dec 2001 09:55:35 -0700
- Subject: Patch: FYI: new StringBuffer fix
- Reply-to: tromey at redhat dot com
I was overzealous in removing "unnecessary" code from the new
StringBuffer, and I removed something that actually was required.
This causes a failure in some situations.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* gnu/gcj/runtime/StringBuffer.java
(ensureCapacity_unsynchronized): Ensure we always get at least
`minimumCapacity' characters in new buffer.
Index: gnu/gcj/runtime/StringBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/runtime/StringBuffer.java,v
retrieving revision 1.1
diff -u -r1.1 StringBuffer.java
--- gnu/gcj/runtime/StringBuffer.java 2001/12/11 18:01:39 1.1
+++ gnu/gcj/runtime/StringBuffer.java 2001/12/12 16:48:40
@@ -130,7 +130,7 @@
{
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;