This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
minor bug in java.io.ObjectInputStream
- From: Christophe Roux <ch_roux at club-internet dot fr>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 13 Mar 2004 19:27:21 +0100
- Subject: minor bug in java.io.ObjectInputStream
I had a trouble with ObjectInputStream with version 3.2.2 of gcc
(ObjectInputStream), using serialized Vectors containing null objects.
To make a diagnostic I had to set dump option of gcc.
The problem came from a null pointer exception when dumping elements.
The current version (3.4) evolved from the 3.2.2 testing if dumping and then I
have not any more the problem.
But, if dumping, it still occurs.
My patch, only tests the element to see if it is null before dumping.
It is a trivial bug, but it needed someone to cope with.
It is a minor bug, as it can only occurs when dumping elements, but I think it
is worth correcting it.
I cannot give test case as my softare is complex, using serialisation over
http with tomcat from rhug. But I thing the bug is so trivial that it is not
a problem.
Here is the diff :
Index: gcc/libjava/java/io/ObjectInputStream.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/io/ObjectInputStream.java,v
retrieving revision 1.30
diff -c -3 -p -r1.30 ObjectInputStream.java
*** gcc/libjava/java/io/ObjectInputStream.java 28 Feb 2004 21:48:35 -0000
1.30
--- gcc/libjava/java/io/ObjectInputStream.java 13 Mar 2004 16:05:32 -0000
*************** public class ObjectInputStream extends I
*** 262,268 ****
readArrayElements(array, componentType);
if(dump)
for (int i = 0, len = Array.getLength(array); i < len; i++)
! dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array,
i));
ret_val = processResolution(null, array, handle);
break;
--- 262,271 ----
readArrayElements(array, componentType);
if(dump)
for (int i = 0, len = Array.getLength(array); i < len; i++)
! if ( Array.get(array,i) == null )
! dumpElementln (" ELEMENT[" + i + "]=<null>");
! else
! dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array,
i));
ret_val = processResolution(null, array, handle);
break;
}
}