New exception in GCJ 3.3 InputStream.read

Øyvind Harboe oyvind.harboe@zylin.com
Fri May 16 10:38:00 GMT 2003


I've come across this compatibility issue in GCJ 3.3/3.2 and
the JRE. Or ???

I have a piece of code that reads some chars from the serial 
port, essentially:

	byte[] readBuffer = new byte[10];
	int bytesToRead=inputStream.available(); 
	// bug in my code, bytesToRead could be > readBuffer
	int numBytes = inputStream.read(readBuffer, 0, bytesToRead);


I did some tests:

- No exception in JRE (I verified that bytesToRead>readBuffer.length
in a debug session)
- GCJ 3.3/3.2 causes exception (as indeed the JRE documentation
dictates)


Ick.


I'd like to have posted a PR, but I lack a tight self-sufficient
example, since it somehow seems to involve serial ports. Doesn't
happen w/files off the harddrive.


(Off topic: I just discovered that GCJ 3.3 compiles faster. I
want to switch! :-)

Øyvind





More information about the Java mailing list