This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Killer bug in gnu.testlet.java.io.RandomAccessFile.raf
- From: Stephen Crawley <crawley at dstc dot edu dot au>
- To: mauve-discuss at sources dot redhat dot com
- Date: Wed, 11 Sep 2002 22:17:31 +1000
- Subject: Killer bug in gnu.testlet.java.io.RandomAccessFile.raf
Folks,
There is a bug in this testcase that puts it into an infinite loop
when you run it against the Classpath libraries.
The problem is here:
int skipped;
while ((skipped = raf.skipBytes(1)) == 1)
harness.debug("skipped 1 byte");
This is fine with the Sun JDK implementation of skipBytes. After 6
iterations, the skipBytes reaches the end of file and returns zero,
and the loop exits.
But Classpath behaves differently (incorrectly, IMO). Here, skipBytes
will happily seek past the end of file, so the loop in the testcase
keeps going and going and ...
Can someone fix the Mauve testcase to avoid the infinite loop? For
example, change the above code to the following:
int skipped = 0;
for (int i = 0; i <= "foobar".length(); i++) {
skipped = raf.skipBytes(1);
if (skipped != 1) {
break;
}
harness.debug("skipped 1 byte");
}
-- Steve