harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Luht (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-819) serialization: ObjectInputStream.readObject() doesn't throw expected exception after readUnshared()
Date Mon, 10 Jul 2006 14:51:29 GMT
serialization: ObjectInputStream.readObject() doesn't throw expected exception after readUnshared()
---------------------------------------------------------------------------------------------------

         Key: HARMONY-819
         URL: http://issues.apache.org/jira/browse/HARMONY-819
     Project: Harmony
        Type: Bug

  Components: Classlib  
 Environment: Windows XP professional
    Reporter: Anton Luht
    Priority: Minor


Classlib + VM version 419914

build: win_ia32_msvc_debug

Spec says:

readUnshared():
Reads an "unshared" object from the ObjectInputStream. This method is identical to readObject,
except that it prevents subsequent calls to readObject and readUnshared from returning additional
references to the deserialized instance obtained via this call. Specifically: 
- ...
- If readUnshared returns successfully, then any subsequent attempts to deserialize back-references
to the stream handle deserialized by readUnshared will cause an ObjectStreamException to be
thrown. 

The following code passes in RI and failes in Harmony. 

import java.io.*;

public class Test {
 public static void main(String[] args) throws Throwable {
   ByteArrayOutputStream baos = new ByteArrayOutputStream();

   try {
     ObjectOutputStream oos = new ObjectOutputStream(baos);
     oos.writeObject("abc");
     oos.writeObject("abc");
     oos.close();

     ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
     ois.readUnshared();
     ois.readObject();
     ois.close();
     System.err.println("FAILED");
   } catch(ObjectStreamException e) {
     System.err.println("PASSED");
   }
 }
}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message