diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java index 12a716ed8..06d054f0c 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java @@ -845,11 +845,11 @@ public JsonToken nextToken() throws IOException token = _nextToken(); continue; } - // 29-Mar-2021, tatu: This seems like an error condition... - // How should we indicate it? As of 2.13, report as unexpected state - throw _constructError( -"Unexpected non-whitespace text ('"+_currText+"' in Array context: should not occur (or should be handled)" -); + // [dataformat-xml#509] 2.13 introduced a defect in which an Exception was thrown here, breaking + // parsing of mixed content arrays (https://github.com/FasterXML/jackson-dataformat-xml/issues/509). + // This exception case was removed to enable continued support of that functionality, but more + // robust state handling may be in order. + // See comment https://github.com/FasterXML/jackson-dataformat-xml/pull/604#issuecomment-1770080319 } // If not a leaf (or otherwise ignorable), need to transform into property... diff --git a/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/UnexpectedNonWhitespaceText509Test.java b/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/UnexpectedNonWhitespaceText509Test.java similarity index 92% rename from src/test/java/com/fasterxml/jackson/dataformat/xml/failing/UnexpectedNonWhitespaceText509Test.java rename to src/test/java/com/fasterxml/jackson/dataformat/xml/deser/UnexpectedNonWhitespaceText509Test.java index 0059dbc4c..76f96448d 100644 --- a/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/UnexpectedNonWhitespaceText509Test.java +++ b/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/UnexpectedNonWhitespaceText509Test.java @@ -2,6 +2,7 @@ import java.util.*; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import org.junit.Test; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -31,6 +32,8 @@ public void setKey(java.lang.String value) { } static class MetaData { + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "data") protected List data; public List getData() {