Skip to content

Commit

Permalink
Backport #86 fix in 2.11(.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 13, 2020
1 parent fab0b8b commit cb182eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Project: jackson-dataformat-xml

2.11.1 (not yet released)

#86: Can not deserialize unwrapped list when `@JacksonXmlProperty` localName
matches `@JacksonXmlRootElement` localName
(reported by Eric S)
#294: XML parser error with nested same element names
(reported by Alexei V)
#393: `MismatchedInputException` for nested repeating element name in `List`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,15 @@ public void addVirtualWrapping(Set<String> namesToWrap)
//System.out.println("addVirtualWrapping("+namesToWrap+")");
// 17-Sep-2012, tatu: Not 100% sure why, but this is necessary to avoid
// problems with Lists-in-Lists properties
String name = _xmlTokens.getLocalName();
if (name != null && namesToWrap.contains(name)) {
// 12-May-2020, tatu: But as per [dataformat-xml#86] NOT for root element
// (would still like to know why work-around needed ever, but...)
if (_parsingContext.inObject()
&& !_parsingContext.getParent().inRoot()) {
String name = _xmlTokens.getLocalName();
if ((name != null) && namesToWrap.contains(name)) {
//System.out.println("REPEAT from addVirtualWrapping()");
_xmlTokens.repeatStartElement();
_xmlTokens.repeatStartElement();
}
}
_parsingContext.setNamesToWrap(namesToWrap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
Expand Down Expand Up @@ -39,7 +40,8 @@ public boolean equals(final Object other) {
}

final Issue86 otherIssue86 = (Issue86) other;
return otherIssue86.id.equals(id) && otherIssue86.children.equals(children);
return Objects.equals(id, otherIssue86.id)
&& Objects.equals(children, otherIssue86.children);
}
}

Expand Down

0 comments on commit cb182eb

Please sign in to comment.