Skip to content

Commit 61522bf

Browse files
committed
Fix junit dep issue
1 parent 90a06b6 commit 61522bf

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff 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>

src/test/java/com/fasterxml/jackson/dataformat/xml/failing/Issue491NoArgCtorDeserRegressionTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@
99
import 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
*/
1632
public 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;

0 commit comments

Comments
 (0)