[kaffe] Odd Jython/jar behaviour

Dalibor Topic robilad at yahoo.com
Wed Jan 8 07:14:01 PST 2003

Hi Vesa,

--- Vesa Kaihlavirta <vpkaihla at cc.jyu.fi> wrote:

> With read(), everything compiles fine, and the tests
> pass, _and_ jython works. 
> Again, I don't know why someone chose
> readUnsignedByte() there instead. 

Thanks for getting this one nailed down.

My bug :) I used readUnsignedByte because the spec
says to '& 0xff' all read bytes before shifting. All
readUnsignedByte does is to '& 0xff' a read byte. So
in theory, it should work, but as you've found out, it
doesn't in practice.

I think that the deeper reason why it doesn't work is
that I added code to skip line feeds. The spec for
readLine says to discard '\n' in a '\r\n' sequence.
Given that '\r' is a regular line end sequence, the
best way I know to handle that situation is to use a
flag to skip the next '\n' when it's read.

I've inserted the skip handling code into readByte().
readByte is used by readUnsignedByte(), which is used
by the buggy version. read() on the other hand doesn't
use any skip handling code, and works, as you say. So
I think I need to figure out where to put the skip
next '\n' code to match Sun's behaviour. I need to do
some tests first ... I'll post a patch tonight.

best regards,
dalibor topic

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

More information about the kaffe mailing list