This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]