[jboss-jira] [JBoss JIRA] Created: (JBMICROCONT-145) Serialization of ManagedPropertyImpl map results in NPE due to circular reference

Scott M Stark (JIRA) jira-events at jboss.com
Wed Jan 24 18:51:52 EST 2007


Serialization of ManagedPropertyImpl map results in NPE due to circular reference
---------------------------------------------------------------------------------

                 Key: JBMICROCONT-145
                 URL: http://jira.jboss.com/jira/browse/JBMICROCONT-145
             Project: JBoss MicroContainer
          Issue Type: Bug
    Affects Versions: JBossMC_2_0_0 Beta
            Reporter: Scott M Stark
         Assigned To: Scott M Stark
             Fix For: JBossMC_2_0_0_CR1


If one serializes a Map of ManagedProperties associated with a ManagedObject, the following NPE results when trying to unserialize the Map:

java.lang.NullPointerException
	at org.jboss.managed.plugins.ManagedPropertyImpl.hashCode(ManagedPropertyImpl.java:259)
	at java.util.HashMap.put(HashMap.java:418)
	at java.util.HashSet.readObject(HashSet.java:279)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
	at java.io.ObjectInputStream.access$300(ObjectInputStream.java:185)
	at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readFields(ObjectInputStream.java:518)
	at org.jboss.managed.plugins.ManagedPropertyImpl.readObject(ManagedPropertyImpl.java:304)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
	at AOPContainerProxy$1.readObject(AOPContainerProxy$1.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
	at java.util.HashMap.readObject(HashMap.java:1067)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
	at org.jboss.test.AbstractTestCase.deserialize(AbstractTestCase.java:235)
	at org.jboss.test.managed.mock.MockTest.testManagedPropertyMapSerialization(MockTest.java:135)

The problem is that following relationship results:
Map -> ManagedProperty at 1 -> MangedObject -> Set<ManagedProperty> -> ManagedProperty at 1.hashCode()

A ManagedProperty that is in its readObject is deserializing its MangedObject, which deserializes its Set<ManagedProperty> properties. The ManagedProperty instance in its readObject method is seen to be already deserialized, and when its added to the Set its hashCode is called, but since the name field has not been retrieved, the NPE results.


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

        



More information about the jboss-jira mailing list