Skip to content

Commit

Permalink
Fix FasterXML#509: Do not throw when parsing mixed content arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
wickstopher committed May 10, 2024
1 parent 66af793 commit 864916b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -31,6 +32,8 @@ public void setKey(java.lang.String value) {
}

static class MetaData {
@JacksonXmlElementWrapper(useWrapping = false)
@JacksonXmlProperty(localName = "data")
protected List<Data> data;

public List<Data> getData() {
Expand Down

0 comments on commit 864916b

Please sign in to comment.