Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.3.1
-
Component/s: None
-
Labels:None
-
JDK version and platform:Sun 1.6.0_05 for Windows
Description
Hello,
I have read that object references are not meant to be used manually for deserializing, but I find them very useful because that way I don't have to build or resolve these references after deserializing; XStream can do it for me. The problem is that XStream doesn't complain when I make a mistake and put an invalid reference; in those cases XStream silently assigns a null reference and goes on (see the example below).
Jörg suggested that "XStream might be changed to throw an exception in this case".
Thank you very much,
Fran
<projects>
<people>
<person id="p1" name="Peter" ... more data ... />
<person id="p2" name="Mary" ... more data ... />
<person id="p3" name="Alex" ... more data ... />
</people>
<project name="project one">
<people>
<person reference="p1" />
<person reference="p2" />
<person reference="p4" /> <!-- Wrong reference "p4". XStream assigns null. -->
</people>
</project>
<project name="project two">
<people>
<person reference="p1" />
<person reference="p3" />
</people>
</project>
</projects>
This is implemented now in the head revision.