You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Richard Liang (JIRA)" <ji...@apache.org> on 2006/11/30 03:49:23 UTC

[jira] Resolved: (HARMONY-2340) [classlib][luni]ObjectInputStream.readClassDesc throws NullPointerException when it is called outside of readObject()

     [ http://issues.apache.org/jira/browse/HARMONY-2340?page=all ]

Richard Liang resolved HARMONY-2340.
------------------------------------

    Resolution: Fixed

Hello Leo

The patch has been applied at revision r480811, thanks a lot for this enhancement, please verify that the problem is fully fixed as you expected. 

Best regards,
Richard

> [classlib][luni]ObjectInputStream.readClassDesc throws NullPointerException when it is called outside of readObject()
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2340
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2340
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Leo Li
>         Assigned To: Richard Liang
>         Attachments: patch-2340.diff
>
>
> Here is a testcase:
> class ObjectOutputStreamWithWriteDesc extends ObjectOutputStream {
> 	public ObjectOutputStreamWithWriteDesc(OutputStream os) throws IOException {
> 		super(os);
> 	}
> 	public void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
> 		super.writeClassDescriptor(desc);
> 	}
> }
> class ObjectIutputStreamWithReadDesc extends ObjectInputStream {
> 	public ObjectIutputStreamWithReadDesc(InputStream is) throws IOException {
> 		super(is);
> 		;
> 	}
> 	public ObjectStreamClass readClassDescriptor() throws IOException,
> 			ClassNotFoundException {
> 		return super.readClassDescriptor();
> 	}
> }
> class TestClassForSerialization implements Serializable {
> }
> public class TestReadClassDescriptor extends TestCase {
> 	public void test_ClassDescriptor() throws IOException,
> 			ClassNotFoundException {
> 		File file = new File("temp.ser");
> 		file.deleteOnExit();
> 		ObjectOutputStreamWithWriteDesc oos = new ObjectOutputStreamWithWriteDesc(
> 				new FileOutputStream(file));
> 		ObjectStreamClass objectStreamClass = ObjectStreamClass
> 				.lookup(Integer.class);
> 		oos.writeClassDescriptor(objectStreamClass);
> 		oos.close();
> 		ObjectIutputStreamWithReadDesc ois = new ObjectIutputStreamWithReadDesc(
> 				new FileInputStream(file));
> 		Object obj = ois.readClassDescriptor();
> 		ois.close();
> 		assertEquals(ObjectStreamClass.class, obj.getClass());
> 	}
> }
> RI passes.
> Harmony fails.

-- 
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