Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.2, 1.3
-
Fix Version/s: 1.3.1
-
Component/s: None
-
Labels:None
Description
Config.java:
public List preprocessors;
Invalid config file:
<preprocessor class="pp1"/>
<preprocessors>
<preprocessor class="pp1"/>
</preprocessors>
When reading this xml-file, XStream silently ignores the first preprocessor element.
Instead it should thrown an exception.
By looking at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter#doUnmarshal
it's found that it correctly deserializes the <preprocessor> element because the type is determined
by the class-attribute. As their is no field "preprocessor" defined in Config.java, it calls writeValueToImplicitCollection()
but this does nothing.
So the recommended work-around is throwing an Exception in writeValueToImplicitCollection() if the related
field could not be found.
Funny that this has not been detected ever. It only happens if the child tag actually matches a type and contains a valid object. Fixed in head. Thanks for reporting.