Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #509: Do not throw when parsing mixed content arrays #651

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -1,12 +1,12 @@
package com.fasterxml.jackson.dataformat.xml.failing;
package com.fasterxml.jackson.dataformat.xml.deser;

import java.util.*;

import org.junit.Test;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;

Expand All @@ -31,6 +31,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
Loading