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

Key: XSTR-428
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Joerg Schaible
Reporter: Mirron
Votes: 0
Watchers: 0
Operations

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

transient member field named 'id' caused bad deserialization

Created: 12/Sep/07 07:37 AM   Updated: 25/Feb/08 05:01 PM
Component/s: Converters
Affects Version/s: 1.2.2
Fix Version/s: 1.3

File Attachments: 1. Java Source File TransientIdFieldTest.java (2 kb)


JDK version and platform: JDK 1.6.02, win xp


 Description  « Hide
See attached test case
scenario:
1. create a class with member field called "id" and some more member fields
2. serialize it to XML
3. deserialize from XML
Outcome:
all member fields will be null in deserialized instance

IMHO,
apparently what cause it, is com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter#doUnmarshal()
on line 143, after attribute named "id" was approved as transient member field, Reader is instructed to move out from current XML element, which causes all information in this element to be passed over.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible - 24/Sep/07 07:20 PM
Thanks a lot, fixed in the head revision. Your test case revealed a subtile bug originally caused by cop&paste. In the end every attribute named like a transient field did abort deserialization of following fields. The likelihood for getting hit by an attribute named "id" was simply the highest ;-)

Joerg Schaible - 25/Feb/08 05:01 PM
Closing issues before next release.