This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: bug in `display'
- From: Per Bothner <per at bothner dot com>
- To: "Dr. M. Luedde" <Mirko dot Luedde at Computer dot Org>
- Cc: kawa at sources dot redhat dot com
- Date: Sun, 02 Jun 2002 14:22:44 -0700
- Subject: Re: bug in `display'
- References: <15605.11078.720000.454000@gargle.gargle.HOWL>
Dr. M. Luedde wrote:
#|kawa:1|# (define (test-display)
(let loop ( (x '()) (n 200) )
(if (zero? n) (display x)
(loop (cons n (list x)) (- n 1)))))
#|kawa:2|# (test-display)
leads to
java.lang.ArrayIndexOutOfBoundsException
Thanks - that was a helpful testcase! There have been
previous bug reports that might well be the same bug.
I checked in the appended patch.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
Index: PrettyWriter.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/text/PrettyWriter.java,v
retrieving revision 1.4
diff -u -r1.4 PrettyWriter.java
--- PrettyWriter.java 3 Oct 2001 00:00:45 -0000 1.4
+++ PrettyWriter.java 2 Jun 2002 21:00:50 -0000
@@ -363,7 +363,7 @@
return addr;
}
- /** Calculate howmuch space to allocate for a buffer.
+ /** Calculate how much space to allocate for a buffer.
* @param current the current size of the buffer
* @param want how much more space is needed
*/
@@ -959,7 +959,7 @@
}
System.arraycopy(buffer, amountToConsume, newBuffer, prefixLen,
fillPtr - amountToConsume);
- System.arraycopy(prefix, 0, buffer, 0, prefixLen);
+ System.arraycopy(prefix, 0, newBuffer, 0, prefixLen);
bufferFillPointer = newFillPtr;
bufferOffset += shift;
if (! isLiteral)