History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-215
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Gábor Lipták
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

patch to support IBM JVM

Created: 19/Apr/05 02:08 PM   Updated: 07/Aug/06 09:27 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2

File Attachments: 1. File ibmjdk.diff (2 kb)


JDK version and platform: IBM Classic VM (build 1.4.1, J2RE 1.4.1 IBM Windows 32 build cn1411-20031011 (JIT enabled: jitc))


 Description  « Hide
Patch attached.

I corrected one of the testcases, others may also have similar problems (as the IBM JVM doesn't return the member fields in the same order as specified in the code, causing compare failures when doing simple text compares).

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Mauro Talevi - 19/Apr/05 03:21 PM
Applied. Thanks!

Grégory Joseph (old account) - 19/Apr/05 03:28 PM
Isn't this kind of patch
- assertEquals(expected, xml);
+ assertEquals(xstream.fromXML(expected), obj);
a bit unsafe? In the sense that it could "benefit" from a side effect/bug of the fromXML method to pass?

Just my 2 cents,

g

Gábor Lipták - 20/Apr/05 09:53 AM
Yes, it could "benefit" from bugs in fromXML(), but it works around the assumption that fields are returned in the same order as passed in during XML generation.

Basically these two following class definitions are the same and some of the XML based comparisons would treat them differently ...

class A{
field B;
field C;
}

class A{
field C;
field B;
}

Do we have some other means to compare "object" XML for equivalency (ordering disregarded)?

Thanks

Joerg Schaible - 20/Apr/05 09:58 AM
All you wanna ensure is the existence of the element:
Use an XPath expression!

Grégory Joseph (old account) - 20/Apr/05 10:45 AM
Or maybe using XmlUnit ?

Joe Walnes - 22/Apr/05 05:41 AM
Is sun.misc.Unsafe supported on the IBM JDK?

Gábor Lipták - 22/Apr/05 12:02 PM
Yes XMLUnit would seem to address the ordering issues I seen. If XMLUnit will be included, I could correct the ordering issues in the tests.

Yes, sun.miscUnsafe is available. I run some fairly complex objects through, and didn't see issues.

Joe Walnes - 23/Apr/05 03:21 AM
I'm happy to add XMLUnit to make the tests easier. This is something that has been discussed before, but at the time there was no overriding need. Looks like we have one now. If you can code up the code patch, I'll include XMLUnit when applying the patch.

cheers
-Joe

Gábor Lipták - 27/Apr/05 10:37 AM
I submitted the XMLUnit patch as http://jira.codehaus.org/browse/XSTR-216

Joerg Schaible - 07/Feb/06 06:28 PM
Mauro, you closed this originally, but a lot of unit tests still fail on IBM JDK, because of the different element order. Did you apply the patch? IMHO it is wong anyway to fix the test cases since it means that XML files genereated by XStream might be incompatible when generated by JDKs from different vendors.

Joerg Schaible - 08/Feb/06 03:30 PM
XStream will now detect JVMs reporting the declared fields in reverse order (like IBM JDK). The fields will be written now in declaration order.