File tree Expand file tree Collapse file tree
main/java/tools/jackson/dataformat/xml
test/java/tools/jackson/dataformat/xml/ser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ Version: 3.x (for earlier see VERSION-2.x)
8484 (fix by @cowtowncoder, w/ Claude code)
8585#541: Allow specifying URI of the default namespace for root element
8686 (fix by @cowtowncoder, w/ Claude code)
87+ #556: `XmlMapper` does not support multi-dimensional arrays
88+ (reported by @schwarfl)
89+ (fix by @cowtowncoder, w/ Claude code)
8790#561: Deserializing empty timestamp fields to `null` value doesn't
8891 work (instead becomes "empty", Epoch time)
8992 (reported by @silvestr85)
Original file line number Diff line number Diff line change @@ -110,22 +110,24 @@ public enum XmlWriteFeature implements FormatFeature
110110
111111 /**
112112 * Feature that determines whether attempt to serialize a directly nested
113- * array, {@link java.util.Collection} or {@link java.util.Map } (i.e. an
114- * array/Collection/Map whose immediate parent is also an array/Collection
113+ * array or {@link java.util.Collection } (i.e. an
114+ * array/Collection whose immediate parent is also an array/Collection
115115 * — without an intermediate POJO) should fail with an exception (true)
116116 * or be allowed (false) — knowing that, when allowed, the resulting XML
117117 * cannot represent the nested structure and the inner dimension will be
118- * silently flattened into the outer one.
118+ * silently flattened into the outer one, nor can it be deserialized back .
119119 *<p>
120120 * "Natural-style" XML has no canonical representation for an unnamed
121121 * nested array, so a clean round-trip is not possible without an
122122 * intermediate POJO wrapper.
123123 *<p>
124124 * Default setting is {@code true} (enabled): nested arrays cause an
125- * exception. Disabling restores the legacy Jackson 2.x behavior of
125+ * exception. Disabling restores the legacy behavior of
126126 * silently flattening dimensions.
127127 *<p>
128128 * See <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/556">#556</a>.
129+ *
130+ * @since 3.2
129131 */
130132 FAIL_ON_NESTED_ARRAYS (true ),
131133 ;
Original file line number Diff line number Diff line change @@ -672,14 +672,16 @@ public JsonGenerator writeStartArray(Object currValue) throws JacksonException
672672 if (_xmlPrettyPrinter != null ) {
673673 _xmlPrettyPrinter .writeStartArray (this );
674674 } else {
675- // nothing to do here; no-operation
675+ // nothing to do here; no-op
676676 }
677677 return this ;
678678 }
679679
680680 // [dataformat-xml#556]: nested arrays/Collections/Maps cannot be expressed
681681 // in natural-style XML without an intermediate POJO. Fail fast (when the
682682 // feature is enabled) instead of silently flattening dimensions.
683+ //
684+ // @since 3.2
683685 private void _verifyNotNestedArray () throws JacksonException
684686 {
685687 if (_streamWriteContext .inArray ()
Original file line number Diff line number Diff line change 1- package tools .jackson .dataformat .xml .tofix ;
1+ package tools .jackson .dataformat .xml .ser ;
22
33import java .util .Arrays ;
44import java .util .List ;
99import tools .jackson .dataformat .xml .XmlMapper ;
1010import tools .jackson .dataformat .xml .XmlTestUtil ;
1111import tools .jackson .dataformat .xml .XmlWriteFeature ;
12- import tools .jackson .dataformat .xml .testutil .failure .JacksonTestFailureExpected ;
1312
1413import static org .junit .jupiter .api .Assertions .assertEquals ;
1514import static org .junit .jupiter .api .Assertions .assertNotNull ;
@@ -64,6 +63,7 @@ public void testLegacyFlatteningWhenFeatureDisabled() throws Exception
6463 // Eventual goal: a 2D array should round-trip with proper nesting.
6564 // Currently fails (fail-fast above); annotation inverts pass/fail so this
6665 // entry tracks the unsupported-but-desired behavior.
66+ /*
6767 @JacksonTestFailureExpected
6868 @Test
6969 public void test2DArrayRoundTrip() throws Exception
@@ -75,4 +75,5 @@ public void test2DArrayRoundTrip() throws Exception
7575 assertEquals(input[0][0], result[0][0]);
7676 assertEquals(input[1][0], result[1][0]);
7777 }
78+ */
7879}
You can’t perform that action at this time.
0 commit comments