harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Li (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2340) [classlib][luni]ObjectInputStream.readClassDesc throws NullPointerException when it is called outside of readObject()
Date Tue, 28 Nov 2006 05:38:21 GMT
[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


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

        

Mime
View raw message