[kaffe] Odd Jython/jar behaviour

Vesa Kaihlavirta vpkaihla@cc.jyu.fi
Mon Jan 6 21:07:01 2003


--Boundary-00=_sCmG+eX9hcVCaMI
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Monday 06 January 2003 21:19, Dalibor Topic wrote:
> > It's an EOFException... I'll try to isolate by using
> > kaffe-1.07 libraries and
> > the VM from CVS. Will report back soon.
>
> Copy the
> libraries/javalib/java/io/DataInputStream.java source
> from kaffe 1.07 to libraries/javalib/java/io/ of kaffe
> from CVS, rebuild (and copy other files if necessary
> to compile ;), and check again. If the exception no
> longer occurs, then you've found a probable cause of
> the bug ;) and just have to isolate the offending
> source code.

Ok, I got the bug now, though I don't know if my fix is the correct one.

from DataInputStream.java:

public final int readInt() throws IOException {
	int v1 = readUnsignedByte() << 24;
	v1 |= readUnsignedByte() << 16;
	v1 |= readUnsignedByte() << 8;
	v1 |= readUnsignedByte();
	return v1;
}

In 1.07's version, this was s/UnsignedByte//g (if you pardon the expression) 
-- the bug disappears also with "readByte()" instead of "readUnsignedByte()". 

I'm guessing readByte() is the correct one -- if it is, attached patch will 
fix this.
--
vegai

--Boundary-00=_sCmG+eX9hcVCaMI
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="readUnsignedByte2readByte.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="readUnsignedByte2readByte.diff"

--- libraries/javalib/java/io/DataInputStream.java	2003-01-07 07:04:07.000000000 +0200
+++ libraries/javalib/java/io/DataInputStream.java.new	2003-01-07 06:57:21.000000000 +0200
@@ -80,11 +80,11 @@
 }
 
 public final int readInt() throws IOException {
-	int v1 = readUnsignedByte() << 24;
-	v1 |= readUnsignedByte() << 16;
-	v1 |= readUnsignedByte() << 8;
-	v1 |= readUnsignedByte();
-	return v1;
+	int v1 = readByte() << 24;
+	v1 |= readByte() << 16;
+	v1 |= readByte() << 8;
+    v1 |= readByte();
+    return v1;
 }
 
 /**

--Boundary-00=_sCmG+eX9hcVCaMI--