bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22941] Incorrect exception handling in ObjectOutputStream


From: kaz at maczuka dot gcd dot org
Subject: [Bug classpath/22941] Incorrect exception handling in ObjectOutputStream
Date: 22 Jan 2008 10:20:02 -0000


------- Comment #1 from kaz at maczuka dot gcd dot org  2008-01-22 10:20 -------
Created an attachment (id=14995)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14995&action=view)
testcase

GNU Classpath's ObjectOutputStream writes a String using
DataOutputStream#writeUTF, which throws java.io.UTFDataFormatException
if the String is too long.  In that case, ObjectOutputStream#writeObject
writes the UTFDataFormatException instead of writing the original
String.

Sun's JDK normally writes a long String to the output file, and it can
be read as the same String by ObjectInputStream.

Result of the testcase follows.

Sun's JDK:
bash$ java WriteLongString 0
true

GNU Classpath:
bash$ java WriteLongString 0
java.io.EOFException
   at java.lang.VMThrowable.fillInStackTrace (VMThrowable.java:native)
   at java.lang.VMThrowable.fillInStackTrace (VMThrowable.java:79)
   at java.lang.Throwable.fillInStackTrace (Throwable.java:498)
   at java.lang.Throwable.<init> (Throwable.java:159)
   at java.lang.Throwable.<init> (Throwable.java:147)
   at java.lang.Exception.<init> (Exception.java:66)
   at java.io.IOException.<init> (IOException.java:61)
   at java.io.EOFException.<init> (EOFException.java:63)
   at java.io.DataInputStream.readFully (DataInputStream.java:285)
   at java.io.DataInputStream.readUTF (DataInputStream.java:599)
   at java.io.DataInputStream.readUTF (DataInputStream.java:575)
   at java.io.ObjectInputStream.parseContent (ObjectInputStream.java:362)
   at java.io.ObjectInputStream.readObject (ObjectInputStream.java:215)
   at java.io.ObjectInputStream.readObject (ObjectInputStream.java:137)
   at WriteLongString.main (WriteLongString.java:19)
bash$ od -xc 0
0000000 edac 0500 7b74 7273 1e00 616a 6176 692e
        254 355  \0 005   t   {   s   r  \0 036   j   a   v   a   .   i
0000020 2e6f 5455 4446 7461 4661 726f 616d 4574
          o   .   U   T   F   D   a   t   a   F   o   r   m   a   t   E
0000040 6378 7065 6974 6e6f d605 f0c7 d318 2403
          x   c   e   p   t   i   o   n 005 326 307 360 030 323 003   $
0000060 0002 7800 0072 6a13 7661 2e61 6f69 492e
        002  \0  \0   x   r  \0 023   j   a   v   a   .   i   o   .   I
0000100 454f 6378 7065 6974 6e6f 806c 6473 2565
          O   E   x   c   e   p   t   i   o   n   l 200   s   d   e   %
0000120 abf0 0002 7800 0072 6a13 7661 2e61 616c
        360 253 002  \0  \0   x   r  \0 023   j   a   v   a   .   l   a
0000140 676e 452e 6378 7065 6974 6e6f fdd0 3e1f
          n   g   .   E   x   c   e   p   t   i   o   n 320 375 037   >
....


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22941





reply via email to

[Prev in Thread] Current Thread [Next in Thread]