Skip to content

Commit 8445f4d

Browse files
committed
Merge branch '3.x' into tatu-claude/3.2/559-fix-xml-text-vs-creator
2 parents 981ff83 + 597a043 commit 8445f4d

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/main/java/tools/jackson/dataformat/xml/deser/XmlBeanDeserializerModifier.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ public List<BeanPropertyDefinition> updateProperties(DeserializationConfig confi
4444
if (acc == null) {
4545
continue;
4646
}
47-
/* First: handle "as text"? Such properties
48-
* are exposed as values of 'unnamed' fields; so one way to
49-
* map them is to rename property to have name ""... (and
50-
* hope this does not break other parts...)
51-
*/
47+
// First: handle "as text"? Such properties are exposed as values of 'unnamed'
48+
// properties; so one way to map them is to rename property to have special
49+
// name (and hope this does not break other parts...)
5250
Boolean b = AnnotationUtil.findIsTextAnnotation(config, intr, acc);
5351
if (b != null && b.booleanValue()) {
5452
// [dataformat-xml#559] For records with JAXB @XmlValue: the annotation
@@ -78,6 +76,11 @@ public List<BeanPropertyDefinition> updateProperties(DeserializationConfig confi
7876
// Default: just rename this property
7977
BeanPropertyDefinition newProp = prop.withSimpleName(_cfgNameForTextValue);
8078
if (newProp != prop) {
79+
// 24-Mar-2026, tatu: Create defensive copy
80+
if (changed == 0) {
81+
propDefs = new ArrayList<>(propDefs);
82+
}
83+
++changed;
8184
propDefs.set(i, newProp);
8285
}
8386
continue;
@@ -91,7 +94,7 @@ public List<BeanPropertyDefinition> updateProperties(DeserializationConfig confi
9194
&& !localName.equals(prop.getName())) {
9295
// make copy-on-write as necessary
9396
if (changed == 0) {
94-
propDefs = new ArrayList<BeanPropertyDefinition>(propDefs);
97+
propDefs = new ArrayList<>(propDefs);
9598
}
9699
++changed;
97100
propDefs.set(i, prop.withSimpleName(localName));

0 commit comments

Comments
 (0)