axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <gdani...@macromedia.com>
Subject RE: [PATCH] RE: Is this a bug in serialization? Fixed And Committ ed
Date Mon, 08 Jul 2002 03:26:56 GMT

Hi Rich!

The reason John's original patch wasn't working was mostly that we were relying on the key
in the multiRefValues HashMap to be the actual object to serialize, since the "value" which
got stored is in fact a MultiRefObject.  I fixed this for beta-3 by simply adding a "value"
field to MultiRefObject (see checkin).

I prefer this fix to the IdentityHashMap because it's simpler, doesn't add yet another class,
and keeps the ability to use a simple HashSet for the secondLevelObjects (since what goes
in there is the stringified identity hashes).  OK with you if I change it (I also added a
getIdentityKey() method to SerializationContextImpl to centralize the System.identityHash()+""
logic)?.

--Glen

> -----Original Message-----
> From: scheu@us.ibm.com [mailto:scheu@us.ibm.com]
> Sent: Wednesday, July 03, 2002 6:31 PM
> To: axis-dev@xml.apache.org
> Cc: john.gregg@techarch.com
> Subject: RE: [PATCH] RE: Is this a bug in serialization? Fixed And
> Committed
> 
> 
> John,
> 
> John
> 
> Thanks for the patch!   I committed the code to fix the 
> problem.  I used a 
> different approach than your patch.  Please read the commit 
> and verify.
> 
> I also added your testcase.
> 
> Thanks for your help identifying and fixing this problem.
> 
> Rich 'Shirley' Scheuerle
> IBM WebSphere & Axis Web Services Development
> 512-838-5115  (IBM TL 678-5115)
> 
> 
> 
> 
> Tom Jordahl <tomj@macromedia.com>
> 07/03/2002 02:32 PM
> Please respond to axis-dev
> 
>  
>         To:     "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
>         cc: 
>         Subject:        RE: [PATCH] RE: Is this a bug in 
> serialization?
> 
>  
> 
> 
> John,
> 
> I am getting encoding unit test failures with this change.
> I'll be on vacation after today, but Rich S. has offered to 
> work with you 
> on this.
> 
> Here is the first failure I get:
> 
>   <testcase name="testDataWithHrefs" time="0.016">
>     <error message="Can&apos;t serialize a java.lang.String with a 
> DataSerializer." type="java.io.IOException">java.io.IOException: 
> Can&apos;t serialize a java.lang.String with a DataSerializer.
>                  at test.encoding.DataSer.serialize(DataSer.java:36)
>                  at 
> org.apache.axis.encoding.SerializationContextImpl.serializeAct
> ual(SerializationContextImpl.java:1101)
>                  at 
> org.apache.axis.encoding.SerializationContextImpl.serialize(Se
> rializationContextImpl.java:680)
>                  at 
> org.apache.axis.encoding.SerializationContextImpl.outputMultiR
> efs(SerializationContextImpl.java:732)
>                  at 
> org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:147)
>                  at 
> org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:391)
>                  at 
> org.apache.axis.message.MessageElement.output(MessageElement.java:707)
>                  at test.encoding.TestSer.doTestData(TestSer.java:74)
>                  at 
> test.encoding.TestSer.testDataWithHrefs(TestSer.java:45)
> </error>
>   </testcase>
> 
> --
> Tom Jordahl
> Macromedia
> 
> 
> -----Original Message-----
> From: John Gregg [mailto:john.gregg@techarch.com]
> Sent: Wednesday, July 03, 2002 2:29 PM
> To: axis-dev@xml.apache.org
> Subject: [PATCH] RE: Is this a bug in serialization?
> 
> 
> Here's fix to the serialization problem Naresh had.
> 
> To summarize the problem, in cases where two distinct objects 
> for which
> equals() returned true and hashCode() returned the same 
> value, only one
> "instance" would appear in the serialized output.  The 
> correct result was
> for 2 instances to appear in the output (2 objects in, 2 objects out.)
> 
> The cause was the reliance on the instances' equals() and hashCode()
> methods.  If SerializationContextImpl.doMultiRefs == true, 
> then serialized
> objects were cached in a HashMap keyed by the object itself.  
> With that
> particular caching mechanism, objects that were equal but not 
> identical 
> were
> incorrectly treated as the same object.  The fix was simply 
> to key the map
> by System.identityHashCode(o).
> 
> The test class I'm providing here exposes the problem in 
> testEquality3().
> 
> Another random thought:
> 
> Someone added a secondLevelObjects instance variable to
> SerializationContextImpl and populates it under certain 
> conditions but 
> never
> uses it otherwise.  It looks like someone just got 
> sidetracked and didn't
> finish his thought.
> 
> john
> 
> 
> 
> -----Original Message-----
> From: axis-dev-return-11064-john.gregg=techarch.com@xml.apache.org
> [mailto:axis-dev-return-11064-john.gregg=techarch.com@xml.apac
he.org]On
Behalf Of John Gregg
Sent: Wednesday, July 03, 2002 9:26 AM
To: axis-dev@xml.apache.org
Subject: RE: Is this a bug in serialization?


I'm working on a fix right now.  I think fixing it is easy-- writing the
test is a little more work.

john




Mime
View raw message