[kaffe] RandomAccessFile causes StackOverflowError

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Thu Apr 3 16:14:01 PST 2003


In message "Re: [kaffe] RandomAccessFile causes StackOverflowError"
    on 03/04/03, Dalibor Topic <robilad at yahoo.com> writes:

> > The results are shown below.  What differs between
> > kaffe
> > and Sun's JDK is the resuls of FileInputStream and
> > FileOutputStream: kaffe fails and JDK does not.  But
> > as
> > for other classes, both kaffe and JDK fail.
> 
> Thanks for verifying that. Could you try to create a
> fix?

Yes.  FileInputStream and FileOutputStream already have internal
private methods,  so all we have to do is to make read(byte[])
and write(byte[]) call them.

--- java/io/FileInputStream.java.orig	Tue Sep 10 01:01:49 2002
+++ java/io/FileInputStream.java	Fri Apr  4 09:04:05 2003
@@ -80,7 +80,8 @@
 native public int read() throws IOException;
 
 public int read(byte b[]) throws IOException {
-	return read(b, 0, b.length);
+	// return read(b, 0, b.length);
+	return readBytes(b, 0, b.length);
 }
 
 public int read(byte b[], int off, int len) throws IOException {
--- java/io/FileOutputStream.java.orig	Mon Jun 24 07:38:24 2002
+++ java/io/FileOutputStream.java	Fri Apr  4 09:04:51 2003
@@ -93,7 +93,8 @@
 
 public void write(byte b[]) throws IOException
 {
-	write(b, 0, b.length);
+	// write(b, 0, b.length);
+	writeBytes(b, 0, b.length);
 }
 
 public void write(byte b[], int off, int len) throws IOException




More information about the kaffe mailing list