XStream
  1. XStream
  2. XSTR-536

XStream silently ignores unknown elements

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major 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.

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Sven Steiniger
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: