File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/failing Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -122,11 +122,6 @@ alternative support for serializing POJOs as XML and deserializing XML as pojos.
122122 <scope >test</scope >
123123 </dependency >
124124
125- <dependency >
126- <groupId >junit</groupId >
127- <artifactId >junit</artifactId >
128- <scope >test</scope >
129- </dependency >
130125 </dependencies >
131126
132127 <build >
Original file line number Diff line number Diff line change 99import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
1010
1111/**
12- * Reproduces <i>no default no-arg ctor found</i> deserialization regression introduced to {@link XmlMapper} in 2.12.0.
12+ * Reproduces <i>no default no-arg ctor found</i> deserialization regression
13+ * introduced to {@link XmlMapper} in 2.12.0.
1314 *
1415 * @see <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/491">jackson-dataformat-xml issue 491</a>
16+ *<p>
17+ * The underlying problem is due to the empty root element being recognized as a String
18+ * token (for consistency with how XML is mapper to tokens); this leads to deserialization
19+ * attempting to use "empty Object" construction which expects availability of the
20+ * default constructor.
21+ * To resolve the issue there are at least two possible ways:
22+ *<ul>
23+ * <li>Try to make root element appears as START-OBJECT/END-OBJECT sequence instead of VALUE_STRING
24+ * </li>
25+ * <li>Change {@code StdDeserializer} (from jackson-databind) to allow use of "properties-based"
26+ * Creator as well -- passing equivalent of all-absent values. This could either be for all
27+ * content, or just for specific formats (using a {@code StreamReadFeature} to detect).
28+ * </li>
29+ *</ul>
30+ * Either approach could work, although former could cause other kinds of regression.
1531 */
1632public class Issue491NoArgCtorDeserRegressionTest extends XmlTestBase
1733{
@@ -49,6 +65,11 @@ static class DefaultProblem implements Problem {
4965 this .status = status != null ? status : Problem .DEFAULT_STATUS ;
5066 }
5167
68+ // Adding this would work around the issue
69+ // DefaultProblem() {
70+ // this(null, null);
71+ // }
72+
5273 @ Override
5374 public String getType () {
5475 return type ;
You can’t perform that action at this time.
0 commit comments