Serialization problem
NADIA VIEIRA LEAO PEREIRA
972155 at dcc.unicamp.br
Sat Nov 21 11:59:57 PST 1998
Hello!
I've just fixed a bug in java.io.ObjectInputStream, that would cause
it to endless loop, but now I've met another problem that I don't know
how to fix.
Here's the patch:
---> cut here <---
--- libraries/javalib/java/io/ObjectInputStream.java Thu Sep 3 17:44:18 1998
+++ java/io/ObjectInputStream.java Sat Nov 21 16:53:57 1998
@@ -85,7 +85,7 @@
}
buffer[offset+i] = (byte)val;
}
- return (i);
+ return (i>0 ? i : -1);
}
public boolean readBoolean() throws IOException
---> cut here <---
The failing test program is:
---> cut here <---
import java.util.Hashtable;
import java.io.*;
public class TesteHash {
public static void main(String[] args){
try{
File file = new File("Hashtable.txt");
FileOutputStream fos = new FileOutputStream( file ); //excecão: IOException
ObjectOutputStream oos = new ObjectOutputStream(fos); //excecão: IOException
oos.writeObject( new Hashtable() );
fos.close();
FileInputStream fis = new FileInputStream(file); //excecão: FileNotFoundException
ObjectInputStream ois = new ObjectInputStream(fis); //excecões: StreamCorruptedException, IOException
Hashtable hash = (Hashtable) ois.readObject();
fis.close();
} catch(Exception ioe){
System.out.println("ioexception: "+ ioe.getMessage());
ioe.printStackTrace();
}
}
}
---> cut here <---
And the error is:
ioexception: null
java.io.EOFException
at java/lang/Throwable.<init>(31)
at java/lang/Exception.<init>(17)
at java/io/IOException.<init>(17)
at java/io/EOFException.<init>(17)
at java/io/ObjectInputStream.readWithEOF(445)
at java/io/ObjectInputStream.readShort(170)
at java/io/ObjectStreamClass.readObject(140)
at java/io/ObjectInputStream.readObject(219)
at TesteHash.main(21)
I'm using a very recently checked-out CVS tree.
Thanks in advance for any help.
--
Nadia
More information about the kaffe
mailing list