Skip to content

Commit 864916b

Browse files
committed
Fix FasterXML#509: Do not throw when parsing mixed content arrays
1 parent 66af793 commit 864916b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -845,11 +845,11 @@ public JsonToken nextToken() throws IOException
845845
token = _nextToken();
846846
continue;
847847
}
848-
// 29-Mar-2021, tatu: This seems like an error condition...
849-
// How should we indicate it? As of 2.13, report as unexpected state
850-
throw _constructError(
851-
"Unexpected non-whitespace text ('"+_currText+"' in Array context: should not occur (or should be handled)"
852-
);
848+
// [dataformat-xml#509] 2.13 introduced a defect in which an Exception was thrown here, breaking
849+
// parsing of mixed content arrays (https://github.com/FasterXML/jackson-dataformat-xml/issues/509).
850+
// This exception case was removed to enable continued support of that functionality, but more
851+
// robust state handling may be in order.
852+
// See comment https://github.com/FasterXML/jackson-dataformat-xml/pull/604#issuecomment-1770080319
853853
}
854854

855855
// If not a leaf (or otherwise ignorable), need to transform into property...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.*;
44

5+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
56
import org.junit.Test;
67

78
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -31,6 +32,8 @@ public void setKey(java.lang.String value) {
3132
}
3233

3334
static class MetaData {
35+
@JacksonXmlElementWrapper(useWrapping = false)
36+
@JacksonXmlProperty(localName = "data")
3437
protected List<Data> data;
3538

3639
public List<Data> getData() {

0 commit comments

Comments
 (0)