XStream

transient member field named 'id' caused bad deserialization

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.2.2
  • Fix Version/s: 1.3
  • Component/s: Converters
  • Labels:
    None
  • JDK version and platform:
    JDK 1.6.02, win xp

Description

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.

Activity

Hide
Joerg Schaible added a comment -

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

Show
Joerg Schaible added a comment - 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
Hide
Joerg Schaible added a comment -

Closing issues before next release.

Show
Joerg Schaible added a comment - Closing issues before next release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: