Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 86060 invoked by uid 500); 8 Jul 2002 03:26:49 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 86050 invoked from network); 8 Jul 2002 03:26:49 -0000 Message-ID: From: Glen Daniels To: "'axis-dev@xml.apache.org'" Subject: RE: [PATCH] RE: Is this a bug in serialization? Fixed And Committ ed Date: Sun, 7 Jul 2002 23:26:56 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 > 07/03/2002 02:32 PM > Please respond to axis-dev > > > To: "'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: > > > java.io.IOException: > Can'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) > > > > -- > 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