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 <[EMAIL PROTECTED]>
07/03/2002 02:32 PM
Please respond to axis-dev

 
        To:     "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
        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.serializeActual(SerializationContextImpl.java:1101)
                 at 
org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:680)
                 at 
org.apache.axis.encoding.SerializationContextImpl.outputMultiRefs(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:[EMAIL PROTECTED]]
Sent: Wednesday, July 03, 2002 2:29 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On
Behalf Of John Gregg
Sent: Wednesday, July 03, 2002 9:26 AM
To: [EMAIL PROTECTED]
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




Reply via email to