Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package jackson-dataformat-xml for
openSUSE:Factory checked in at 2026-06-25 17:22:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/jackson-dataformat-xml (Old)
and /work/SRC/openSUSE:Factory/.jackson-dataformat-xml.new.2088 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jackson-dataformat-xml"
Thu Jun 25 17:22:10 2026 rev:8 rq:1361762 version:2.18.8
Changes:
--------
---
/work/SRC/openSUSE:Factory/jackson-dataformat-xml/jackson-dataformat-xml.changes
2024-11-06 16:56:54.924398707 +0100
+++
/work/SRC/openSUSE:Factory/.jackson-dataformat-xml.new.2088/jackson-dataformat-xml.changes
2026-06-25 17:22:30.420484630 +0200
@@ -1,0 +2,16 @@
+Thu Jun 25 12:57:14 UTC 2026 - Fridrich Strba <[email protected]>
+
+- Upgrade to 2.18.8
+ * Changes of 2.18.8
+ + #863: Fix to support Woodstox 7.2.0 (but no dep version bump)
+ * Changes of 2.18.2
+ + #678: XML module not registered correctly when setting a
+ custom 'SerializerFactory'
+ + #682: 'MismatchedInputException' encountered while
+ deserializing XML to an Enum type using a factory method
+ * Changes of 2.18.0
+ + Remove unnecessary synchronization around 'LRUMap' in
+ 'XmlRootNameLookup'
+ + Upgrade Woodstox to 7.0.0 (dependency fixes)
+
+-------------------------------------------------------------------
@@ -11 +27 @@
- * #657: Nesting depth in `XmlReadContext` is not
+ * #657: Nesting depth in 'XmlReadContext' is not
@@ -21 +37 @@
- `Iterable` Collection setters (fix contributed by Bas P)
+ 'Iterable' Collection setters (fix contributed by Bas P)
@@ -24,3 +40,3 @@
- * #324: Support use of `xsi:type` for polymorphic serialization
- (`ToXmlGenerator.Feature.AUTO_DETECT_XSI_TYPE`)
- * #618: `ArrayIndexOutOfBoundsException` thrown for invalid
+ * #324: Support use of 'xsi:type' for polymorphic serialization
+ ('ToXmlGenerator.Feature.AUTO_DETECT_XSI_TYPE')
+ * #618: 'ArrayIndexOutOfBoundsException' thrown for invalid
@@ -28,2 +44,2 @@
- * #631: Add `XmlMapper.createGenerator(XMLStreamWriter)` and
- `XmlMapper.createParser(XMLStreamReader)` overloads
+ * #631: Add 'XmlMapper.createGenerator(XMLStreamWriter)' and
+ 'XmlMapper.createParser(XMLStreamReader)' overloads
@@ -32 +48 @@
- * #637: `JacksonXmlAnnotationIntrospector.findNamespace()` should
+ * #637: 'JacksonXmlAnnotationIntrospector.findNamespace()' should
Old:
----
jackson-dataformat-xml-2.17.3.tar.gz
New:
----
_scmsync.obsinfo
build.specials.obscpio
jackson-dataformat-xml-2.18.8.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ jackson-dataformat-xml.spec ++++++
--- /var/tmp/diff_new_pack.5n8DxL/_old 2026-06-25 17:22:31.308515489 +0200
+++ /var/tmp/diff_new_pack.5n8DxL/_new 2026-06-25 17:22:31.316515767 +0200
@@ -1,7 +1,7 @@
#
# spec file for package jackson-dataformat-xml
#
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: jackson-dataformat-xml
-Version: 2.17.3
+Version: 2.18.8
Release: 0
Summary: Jackson extension component for reading and writing XML
encoded data
License: Apache-2.0
@@ -25,9 +25,9 @@
Source0: %{url}/archive/%{name}-%{version}.tar.gz
BuildRequires: fdupes
BuildRequires: maven-local
-BuildRequires: mvn(com.fasterxml.jackson.core:jackson-annotations)
-BuildRequires: mvn(com.fasterxml.jackson.core:jackson-core)
-BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind)
+BuildRequires: mvn(com.fasterxml.jackson.core:jackson-annotations) >= 2.18
+BuildRequires: mvn(com.fasterxml.jackson.core:jackson-core) >= 2.18
+BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind) >= 2.18
BuildRequires: mvn(com.fasterxml.jackson:jackson-base:pom:)
BuildRequires: mvn(com.fasterxml.woodstox:woodstox-core)
BuildRequires: mvn(com.google.code.maven-replacer-plugin:replacer)
++++++ _scmsync.obsinfo ++++++
mtime: 1782392425
commit: e86babe7588314dfbe4874fd9242d11767dfffa4c6f37cb8aabcb6f9bbbb3f9c
url: https://src.opensuse.org/java-packages/jackson-dataformat-xml
revision: e86babe7588314dfbe4874fd9242d11767dfffa4c6f37cb8aabcb6f9bbbb3f9c
projectscmsync: https://src.opensuse.org/java-packages/_ObsPrj
++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore 2026-06-25 15:00:25.000000000 +0200
@@ -0,0 +1 @@
+.osc
++++++ jackson-dataformat-xml-2.17.3.tar.gz ->
jackson-dataformat-xml-2.18.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/.github/workflows/dep_build_v2.yml
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/.github/workflows/dep_build_v2.yml
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/.github/workflows/dep_build_v2.yml
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/.github/workflows/dep_build_v2.yml
2026-05-29 02:55:41.000000000 +0200
@@ -0,0 +1,32 @@
+name: Re-build on jackson-databind v2 push
+on:
+ repository_dispatch:
+ types: [jackson-databind-pushed]
+ # just for testing
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ # Do we want wide matrix build? For now, limited
+ runs-on: 'ubuntu-22.04'
+ strategy:
+ fail-fast: false
+ matrix:
+ java_version: ['8', '17', '21']
+ env:
+ JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
+ steps:
+ - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - name: Set up JDK
+ uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #
v4.2.1
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java_version }}
+ cache: 'maven'
+ - name: Build and test
+ run: ./mvnw -B -ff -ntp clean verify
+
+# No recursive rebuild (yet?)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/.github/workflows/dep_build_v3.yml
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/.github/workflows/dep_build_v3.yml
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/.github/workflows/dep_build_v3.yml
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/.github/workflows/dep_build_v3.yml
2026-05-29 02:55:41.000000000 +0200
@@ -0,0 +1,34 @@
+name: Re-build on jackson-databind v3 push
+on:
+ repository_dispatch:
+ types: [jackson-databind-pushed-v3]
+ # just for testing
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ # Do we want wide matrix build? For now, limited
+ runs-on: 'ubuntu-22.04'
+ strategy:
+ fail-fast: false
+ matrix:
+ java_version: ['8', '17', '21']
+ env:
+ JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
+ steps:
+ - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ with:
+ ref: master
+ - name: Set up JDK
+ uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #
v4.2.1
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java_version }}
+ cache: 'maven'
+ - name: Build and test
+ run: ./mvnw -B -ff -ntp clean verify
+
+# No recursive rebuild (yet?)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/.github/workflows/main.yml
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/.github/workflows/main.yml
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/.github/workflows/main.yml
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/.github/workflows/main.yml
2026-05-29 02:55:41.000000000 +0200
@@ -1,18 +1,12 @@
name: Build and Deploy Snapshot
on:
push:
- branches:
- - master
- - "3.0"
- - "2.17"
+ branches: ['2.*']
paths-ignore:
- "README.md"
- "release-notes/*"
pull_request:
branches:
- - master
- - "3.0"
- - "2.17"
paths-ignore:
- "README.md"
- "release-notes/*"
@@ -21,12 +15,11 @@
jobs:
build:
- runs-on: ${{ matrix.os }}
+ runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
- java_version: ['8', '11', '17', '21' ]
- os: ['ubuntu-20.04']
+ java_version: ['8', '11', '17', '21', '24' ]
env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
steps:
@@ -37,7 +30,7 @@
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
cache: 'maven'
- server-id: sonatype-nexus-snapshots
+ server-id: central-snapshots
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
# See
https://github.com/actions/setup-java/blob/v2/docs/advanced-usage.md#Publishing-using-Apache-Maven
@@ -49,17 +42,17 @@
id: projectVersion
run: echo "version=$(./mvnw
org.apache.maven.plugins:maven-help-plugin:3.3.0:evaluate -DforceStdout
-Dexpression=project.version -q)" >> $GITHUB_OUTPUT
- name: Deploy snapshot
- if: github.event_name != 'pull_request' && matrix.java_version == '8' &&
endsWith(steps.projectVersion.outputs.version, '-SNAPSHOT')
+ if: ${{ github.event_name != 'pull_request' && matrix.java_version ==
'8' && endsWith(steps.projectVersion.outputs.version, '-SNAPSHOT') }}
env:
- CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
- CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
+ CI_DEPLOY_USERNAME: ${{ secrets.CENTRAL_DEPLOY_USERNAME }}
+ CI_DEPLOY_PASSWORD: ${{ secrets.CENTRAL_DEPLOY_PASSWORD }}
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: ./mvnw -B -q -ff -DskipTests -ntp source:jar deploy
- name: Generate code coverage
- if: github.event_name != 'pull_request' && matrix.java_version == '8'
+ if: ${{ github.event_name != 'pull_request' && matrix.java_version ==
'8' }}
run: ./mvnw -B -q -ff -ntp test
- name: Publish code coverage
- if: github.event_name != 'pull_request' && matrix.java_version == '8'
+ if: ${{ github.event_name != 'pull_request' && matrix.java_version ==
'8' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/README.md
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/README.md
--- old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/README.md
2024-11-01 22:20:25.000000000 +0100
+++ new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/README.md
2026-05-29 02:55:41.000000000 +0200
@@ -6,7 +6,7 @@
Further, the goal is to emulate how [JAXB](http://en.wikipedia.org/wiki/JAXB)
data-binding works
with "Code-first" approach (no support is added for "Schema-first" approach).
Support for JAXB annotations is provided by [JAXB annotation
module](https://github.com/FasterXML/jackson-modules-base/tree/master/jaxb);
-this module provides low-level abstractions (`JsonParser`, `JsonGenerator`,
`JsonFactory`) as well as small number of higher level
+this module provides low-level abstractions (`JsonParser`, `JsonGenerator`,
`JsonFactory`) as well as a small number of higher level
overrides needed to make data-binding work.
It is worth noting, however, that the goal is NOT to be full JAXB clone; or to
be a
@@ -16,8 +16,8 @@
* While XML serialization should ideally be similar to JAXB output, deviations
are not automatically considered flaws (there are reasons for some differences)
* What should be guaranteed is that any XML written using this module must be
readable using module as well ("read what I wrote"): that is, we do aim for
full round-trip support
-* From above: there are XML constructs that module will not be able to handle;
including some cases JAXB (and other Java XML libraries) supports
-* This module also support constructs and use cases JAXB does not handle:
specifically, rich type and object id support of Jackson are supported.
+* From above: there are XML constructs that this module will not be able to
handle; including some cases JAXB (and other Java XML libraries) support
+* This module also supports constructs and use cases JAXB does not handle:
specifically, rich type and object id support of Jackson are supported.
## Status
@@ -27,7 +27,7 @@
| Artifact | [](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.dataformat/jackson-dataformat-xml)
|
| OSS Sponsorship |
[](https://tidelift.com/subscription/pkg/maven-com-fasterxml-jackson-dataformat-jackson-dataformat-xml?utm_source=maven-com-fasterxml-jackson-dataformat-jackson-dataformat-xml&utm_medium=referral&utm_campaign=readme)
|
| Javadocs |
[](http://www.javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-xml)
|
-| Code coverage (2.15) |
[](https://codecov.io/github/FasterXML/jackson-dataformat-xml?branch=2.15)
|
+| Code coverage (2.18) |
[](https://codecov.io/github/FasterXML/jackson-dataformat-xml?branch=2.18)
|
| OpenSSF Score | [](https://securityscorecards.dev/viewer/?uri=github.com/FasterXML/jackson-dataformat-xml)
|
| Fuzzing | [](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:jackson-dataformat-xml)
|
@@ -36,13 +36,13 @@
`master` branch is for developing the next major Jackson version -- 3.0 -- but
there
are active maintenance branches in which much of development happens:
-* `2.16` is for developing the next minor 2.x version
+* `2.18` is for developing the next minor 2.x version
+* `2.17` is for backported fixes to include in 2.17.x patch versions
+* `2.16` is for backported fixes to include in 2.16.x patch versions
* `2.15` is for backported fixes to include in 2.15.x patch versions
-* `2.14` is for backported fixes to include in 2.14.x patch versions
-* `2.13` is for backported fixes to include in 2.13.x patch versions
Older branches are usually not changed but are available for historic reasons.
-All released versions have matching git tags
(`jackson-dataformats-text-2.9.4`).
+All released versions have matching git tags (`jackson-dataformat-xml-2.17.1`).
## License
@@ -57,20 +57,20 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
- <version>2.15.0</version>
+ <version>2.17.1</version>
</dependency>
```
Gradle:
```groovy
dependencies {
- implementation
'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.0'
+ implementation
'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.17.1'
}
```
(or whatever version is most up-to-date at the moment)
-Also: you usually also want to make sure that XML library in use is
[Woodstox](https://github.com/FasterXML/woodstox) since it is not only faster
than Stax implementation JDK provides, but also works better and avoids some
known issues like adding unnecessary namespace prefixes.
+Also: you usually also want to make sure the XML library in use is
[Woodstox](https://github.com/FasterXML/woodstox) since it is not only faster
than Stax implementation JDK provides, but also works better and avoids some
known issues like adding unnecessary namespace prefixes.
You can do this by adding this in your `pom.xml`:
Maven:
@@ -91,9 +91,9 @@
# Usage
-Although module implements low-level (`JsonFactory` / `JsonParser` /
`JsonGenerator`) abstractions,
-most usage is through data-binding level. This because a small number of
work-arounds have been added
-at data-binding level, to work around XML peculiarities: that is, stream of
`JsonToken`s that parser
+Although this module implements low-level (`JsonFactory` / `JsonParser` /
`JsonGenerator`) abstractions,
+most usage is through data-binding level. This is because a small number of
work-arounds have been added
+at data-binding level, to work around XML peculiarities: that is, the stream
of `JsonToken`s that the parser
produces has idiosyncracies that need special handling.
Usually you either create `XmlMapper` simply by:
@@ -102,7 +102,7 @@
XmlMapper mapper = new XmlMapper();
```
-but in case you need to configure settings, you will want to use Builder
(added in
+but in case you need to configure settings, you will want to use the Builder
(added in
Jackson 2.10) style construction:
```java
@@ -139,17 +139,15 @@
## Android quirks
-Usage of this library on Android is currently not supported. This is due to
the fact that the Stax API is unavailable on the Android platform, and attempts
to declare an explicit dependency on the Stax API library will result in errors
at build time (since the inclusion of the `javax.*` namespace in apps is
restricted).
-For more on the issues, see:
+Use of this library on Android is supported since version 2.15.0 (partly via
fix of
+[#533](https://github.com/FasterXML/jackson-dataformat-xml/issues/533)).
+
+Earlier versions had problem due to Stax API being unavailable on the Android
platform, and attempts to declare an explicit dependency on the Stax API
library resulting in errors at build time (since the inclusion of the `javax.*`
namespace in apps is restricted).
+For more on this old issue, see:
*
https://stackoverflow.com/questions/31360025/using-jackson-dataformat-xml-on-android
* https://www.docx4java.org/blog/2012/05/jaxb-can-be-made-to-run-on-android/
-Note that as per articles linked to it MAY be possible to use the module on
Android, but it unfortunately requires
-various work-arounds and development team can not do much to alleviate these
issues.
-Suggestions for improvements would be welcome; discussions on
-[Jackson users list](https://groups.google.com/forum/#!forum/jackson-user)
encouraged.
-
## Serializing POJOs as XML
Serialization is done very similar to JSON serialization: all that needs to
change is `ObjectMapper` instance to use:
@@ -241,7 +239,7 @@
## Additional annotations
-In addition to standard [Jackson
annotations](https://github.com/FasterXML/jackson-annotations) and optional
JAXB (`javax.xml.bind.annotation`), this project also adds couple of its own
annotations for convenience, to support XML-specific details:
+In addition to standard [Jackson
annotations](https://github.com/FasterXML/jackson-annotations) and optional
JAXB (`javax.xml.bind.annotation`), this project also adds a couple of its own
annotations for convenience, to support XML-specific details:
* `@JacksonXmlElementWrapper` allows specifying XML element to use for
wrapping `List` and `Map` properties
* `@JacksonXmlProperty` allows specifying XML namespace and local name for a
property; as well as whether property is to be written as an XML element or
attribute.
@@ -249,7 +247,7 @@
* `@JacksonXmlText` allows specifying that value of one property is to be
serialized as "unwrapped" text, and not in an element.
* `@JacksonXmlCData` allows specifying that the value of a property is to be
serialized within a CData tag.
-for longer description, check out [XML module
annotations](https://github.com/FasterXML/jackson-dataformat-xml/wiki/Jackson-XML-annotations).
+for a longer description, check out [XML module
annotations](https://github.com/FasterXML/jackson-dataformat-xml/wiki/Jackson-XML-annotations).
## Known Limitations
@@ -269,7 +267,7 @@
* Lists and arrays are "wrapped" by default, when using Jackson annotations,
but unwrapped when using JAXB annotations (if supported, see below)
* `@JacksonXmlElementWrapper.useWrapping` can be set to 'false' to disable
wrapping
* `JacksonXmlModule.setDefaultUseWrapper()` can be used to specify whether
"wrapped" or "unwrapped" setting is the default
-* Polymorphic Type Handling works, but only some of inclusion mechanisms are
supported (`WRAPPER_ARRAY`, for example is not supported due to problems wrt
mapping of XML, Arrays)
+* Polymorphic Type Handling works, but only some inclusion mechanisms are
supported (`WRAPPER_ARRAY`, for example is not supported due to problems with
reference to mapping of XML, Arrays)
* JAXB-style "compact" Type Id where property name is replaced with Type
Id is not supported.
* Mixed Content (elements and text in same element) is not supported in
databinding: child content must be either text OR element(s) (attributes are
fine)
* While XML namespaces are recognized, and produced on serialization,
namespace URIs are NOT verified when deserializing: only local names are matched
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/pom.xml
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/pom.xml
--- old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/pom.xml
2024-11-01 22:20:25.000000000 +0100
+++ new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/pom.xml
2026-05-29 02:55:41.000000000 +0200
@@ -9,11 +9,11 @@
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
- <version>2.17.3</version>
+ <version>2.18.8</version>
</parent>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
- <version>2.17.3</version>
+ <version>2.18.8</version>
<name>Jackson-dataformat-XML</name>
<packaging>jar</packaging>
<description>Data format extension for Jackson to offer
@@ -24,7 +24,7 @@
<connection>scm:git:[email protected]:FasterXML/jackson-dataformat-xml.git</connection>
<developerConnection>scm:git:[email protected]:FasterXML/jackson-dataformat-xml.git</developerConnection>
<url>http://github.com/FasterXML/jackson-dataformat-xml</url>
- <tag>jackson-dataformat-xml-2.17.3</tag>
+ <tag>jackson-dataformat-xml-2.18.8</tag>
</scm>
<properties>
<packageVersion.dir>com/fasterxml/jackson/dataformat/xml</packageVersion.dir>
@@ -34,7 +34,7 @@
<!-- And presumably import too? -->
<!-- for Reproducible Builds -->
-
<project.build.outputTimestamp>2024-11-01T21:20:12Z</project.build.outputTimestamp>
+
<project.build.outputTimestamp>2026-05-29T00:55:28Z</project.build.outputTimestamp>
</properties>
<dependencies>
@@ -88,10 +88,11 @@
<!-- 28-Jun-2022, tatu: For 2.14, 6.4 to get OSGi metadata, bug fixes -->
<!-- 18-Apr-2023, tatu: For 2.15, 6.5.1 for more OSGi fixes -->
<!-- 17-Jan-2024, tatu: For 2.17, 6.6.1 (latest) -->
+ <!-- 21-Jun-2024, tatu: For 2.18, 7.0.0 (Java 8) -->
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
- <version>6.7.0</version>
+ <version>7.0.0</version>
<exclusions>
<exclusion>
<groupId>javax.xml.stream</groupId>
@@ -100,6 +101,13 @@
</exclusions>
</dependency>
+ <!-- 20-Apr-2024, tatu: JUnit4 no longer from jackson-base, so: -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
<!-- Jakarta XMLBind (nee javax/jaxb( annotation introspector is needed
BUT ONLY
for tests (starting 2.13: previously compile/runtime)
-->
@@ -169,7 +177,7 @@
<version>${version.plugin.surefire}</version>
<configuration>
<excludes>
-
<exclude>com/fasterxml/jackson/dataformat/xml/failing/*.java</exclude>
+ <exclude>**/failing/**/*.java</exclude>
</excludes>
<includes>
<include>**/Test*.java</include>
@@ -190,13 +198,13 @@
</plugins>
</build>
- <!-- Alas, need to include snapshot reference since otherwise can not find
- snapshot of parent... -->
+ <!-- Need to include snapshot reference to find snapshot of parent -->
<repositories>
+ <!-- 13-May-2025, tatu: now access snapshots via Central Portal -->
<repository>
- <id>sonatype-nexus-snapshots</id>
- <name>Sonatype Nexus Snapshots</name>
- <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <id>central-snapshots</id>
+ <name>Sonatype Central Portal (snapshots)</name>
+ <url>https://central.sonatype.com/repository/maven-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/release-notes/VERSION-2.x
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/release-notes/VERSION-2.x
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/release-notes/VERSION-2.x
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/release-notes/VERSION-2.x
2026-05-29 02:55:41.000000000 +0200
@@ -4,9 +4,35 @@
=== Releases ===
------------------------------------------------------------------------
-2.18.0 (not yet released)
+2.18.8 (28-May-2026)
-No changes since 2.17
+#863: Fix to support Woodstox 7.2.0 (but no dep version bump)
+
+2.18.7 (26-Apr-2026)
+2.18.6 (22-Feb-2026)
+2.18.5 (27-Oct-2025)
+2.18.4 (06-May-2025)
+2.18.3 (28-Feb-2025)
+
+No changes since 2.18.2
+
+2.18.2 (27-Nov-2024)
+
+#678: XML module not registered correctly when setting a custom
`SerializerFactory`
+ (reported by @SimonCockx)
+#682: `MismatchedInputException` encountered while deserializing XML to an
Enum type
+ using a factory method
+ (reported by @WannabeSoftwareEngineer)
+
+2.18.1 (28-Oct-2024)
+
+No changes since 2.18.0
+
+2.18.0 (26-Sep-2024)
+
+- Remove unnecessary synchronization around `LRUMap` in `XmlRootNameLookup`
+ (contributed by @pjfanning)
+- Upgrade Woodstox to 7.0.0 (dependency fixes)
2.17.3 (01-Nov-2024)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlModule.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlModule.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlModule.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/JacksonXmlModule.java
2026-05-29 02:55:41.000000000 +0200
@@ -2,7 +2,7 @@
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.module.SimpleModule;
-
+import com.fasterxml.jackson.databind.ser.SerializerFactory;
import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
import com.fasterxml.jackson.dataformat.xml.deser.XmlBeanDeserializerModifier;
import com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerModifier;
@@ -39,13 +39,22 @@
/**
* Name used for pseudo-property used for returning XML Text value (which
does
* not have actual element name to use). Defaults to empty String, but
- * may be changed for interoperability reasons: JAXB, for example, uses
+ * may be changed for inter-operability reasons: JAXB, for example, uses
* "value" as name.
*
* @since 2.1
*/
protected String _cfgNameForTextElement =
FromXmlParser.DEFAULT_UNNAMED_TEXT_PROPERTY;
-
+
+ /**
+ * Optional override for {@link SerializerFactory}
+ * used by {@link XmlMapper}. Needed to allow proper override and
configurability
+ * using custom {@SerializerFactory} implementations.
+ *
+ * @since 2.18.2
+ */
+ protected SerializerFactory _serializerFactoryOverride;
+
/*
/**********************************************************************
/* Life-cycle: construction
@@ -119,6 +128,29 @@
public void setXMLTextElementName(String name) {
_cfgNameForTextElement = name;
}
+
+ /**
+ * Method to use for overriding default {@link SerializerFactory} used
+ *
+ * @since 2.18.2
+ */
+ public JacksonXmlModule overrideSerializerFactory(SerializerFactory
factory) {
+ _serializerFactoryOverride = factory;
+ return this;
+ }
+
+ /*
+ /**********************************************************************
+ /* Accessors
+ /**********************************************************************
+ */
+
+ /**
+ * @since 2.18.2
+ */
+ public SerializerFactory serializerFactoryOverride() {
+ return _serializerFactoryOverride;
+ }
/*
/**********************************************************************
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/XmlMapper.java
2026-05-29 02:55:41.000000000 +0200
@@ -16,6 +16,7 @@
import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory;
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
+import com.fasterxml.jackson.databind.ser.SerializerFactory;
import com.fasterxml.jackson.databind.type.LogicalType;
import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
import com.fasterxml.jackson.dataformat.xml.deser.XmlDeserializationContext;
@@ -166,6 +167,11 @@
_xmlModule = module;
// but all the rest is done via Module interface!
if (module != null) {
+ // [dataformat-xml#678]: need special handling for
SerializerFactory override
+ SerializerFactory sfOverride = module.serializerFactoryOverride();
+ if (sfOverride != null) {
+ setSerializerFactory(sfOverride);
+ }
registerModule(module);
}
// 19-May-2015, tatu: Must ensure we use XML-specific indenter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/FromXmlParser.java
2026-05-29 02:55:41.000000000 +0200
@@ -13,7 +13,6 @@
import javax.xml.stream.XMLStreamWriter;
import com.fasterxml.jackson.core.*;
-import com.fasterxml.jackson.core.JsonParser.NumberTypeFP;
import com.fasterxml.jackson.core.base.ParserMinimalBase;
import com.fasterxml.jackson.core.exc.StreamConstraintsException;
import com.fasterxml.jackson.core.io.IOContext;
@@ -184,11 +183,6 @@
protected final IOContext _ioContext;
/**
- * @since 2.15
- */
- protected final StreamReadConstraints _streamReadConstraints;
-
- /**
* Flag that indicates whether parser is closed or not. Gets
* set when parser is either closed by explicit call
* ({@link #close}) or when end-of-input is reached.
@@ -280,10 +274,9 @@
ObjectCodec codec, XMLStreamReader xmlReader, XmlNameProcessor
tagProcessor)
throws IOException
{
- super(genericParserFeatures);
+ super(genericParserFeatures, ctxt.streamReadConstraints());
_formatFeatures = xmlFeatures;
_ioContext = ctxt;
- _streamReadConstraints = ctxt.streamReadConstraints();
_objectCodec = codec;
_parsingContext = XmlReadContext.createRootContext(-1, -1);
_xmlTokens = new XmlTokenStream(xmlReader, ctxt.contentReference(),
@@ -405,11 +398,6 @@
return this;
}
- @Override
- public StreamReadConstraints streamReadConstraints() {
- return _streamReadConstraints;
- }
-
/*
/**********************************************************
/* FormatFeature support
@@ -586,16 +574,22 @@
/**
* Since xml representation can not really distinguish between array
* and object starts (both are represented with elements), this method
- * is overridden and taken to mean that expecation is that the current
+ * is overridden and taken to mean that expectation is that the current
* start element is to mean 'start array', instead of default of
* 'start object'.
+ *
+ * @throws UncheckedIOException if underlying {@link
StreamReadConstraints} constraint fails
*/
@Override
public boolean isExpectedStartArrayToken()
{
JsonToken t = _currToken;
if (t == JsonToken.START_OBJECT) {
- _currToken = JsonToken.START_ARRAY;
+ try {
+ _updateToken(JsonToken.START_ARRAY);
+ } catch (StreamConstraintsException e) {
+ throw new UncheckedIOException(e);
+ }
// Ok: must replace current context with array as well
_parsingContext.convertToArray();
//System.out.println(" FromXmlParser.isExpectedArrayStart(): OBJ->Array");
@@ -619,6 +613,8 @@
* scalar types (numbers, booleans) -- they are all just Character Data,
* without schema -- we can try to infer type from intent here.
* The main benefit is avoiding checks for coercion.
+ *
+ * @throws UncheckedIOException if underlying {@link
StreamReadConstraints} constraint fails
*/
@Override
public boolean isExpectedNumberIntToken()
@@ -627,57 +623,57 @@
if (t == JsonToken.VALUE_STRING) {
final String text = _currText.trim();
final int len = _isIntNumber(text);
- if (len > 0) {
- if (len <= 9) {
- _numberInt = NumberInput.parseInt(text);
- _numTypesValid = NR_INT;
- _currToken = JsonToken.VALUE_NUMBER_INT;
- return true;
- }
- if (len <= 18) { // definitely in long range
- long l = NumberInput.parseLong(text);
- if (len == 10) {
- int asInt = (int) l;
- long l2 = (long) asInt;
- if (l == l2) {
- _numberInt = asInt;
- _numTypesValid = NR_INT;
- _currToken = JsonToken.VALUE_NUMBER_INT;
- return true;
- }
- }
- _numberLong = l;
- _numTypesValid = NR_LONG;
- _currToken = JsonToken.VALUE_NUMBER_INT;
- return true;
- }
- // Might still fit within `long`
- if (len == 19) {
- final boolean stillLong;
- if (text.charAt(0) == '-') {
- stillLong = NumberInput.inLongRange(text.substring(1),
true);
- } else {
- stillLong = NumberInput.inLongRange(text, false);
+ try {
+ if (len > 0) {
+ if (len <= 9) {
+ _numberInt = NumberInput.parseInt(text);
+ _numTypesValid = NR_INT;
+ _updateToken(JsonToken.VALUE_NUMBER_INT);
+ return true;
}
- if (stillLong) {
- _numberLong = NumberInput.parseLong(text);
+ if (len <= 18) { // definitely in long range
+ long l = NumberInput.parseLong(text);
+ if (len == 10) {
+ int asInt = (int) l;
+ long l2 = (long) asInt;
+ if (l == l2) {
+ _numberInt = asInt;
+ _numTypesValid = NR_INT;
+ _updateToken(JsonToken.VALUE_NUMBER_INT);
+ return true;
+ }
+ }
+ _numberLong = l;
_numTypesValid = NR_LONG;
- _currToken = JsonToken.VALUE_NUMBER_INT;
+ _updateToken(JsonToken.VALUE_NUMBER_INT);
return true;
}
- }
- // finally, need BigInteger
- try {
+ // Might still fit within `long`
+ if (len == 19) {
+ final boolean stillLong;
+ if (text.charAt(0) == '-') {
+ stillLong =
NumberInput.inLongRange(text.substring(1), true);
+ } else {
+ stillLong = NumberInput.inLongRange(text, false);
+ }
+ if (stillLong) {
+ _numberLong = NumberInput.parseLong(text);
+ _numTypesValid = NR_LONG;
+ _updateToken(JsonToken.VALUE_NUMBER_INT);
+ return true;
+ }
+ }
+ // finally, need BigInteger
streamReadConstraints().validateIntegerLength(text.length());
- } catch (StreamConstraintsException e) {
- // Ugh. This method in API ought to expose IOException
- throw new UncheckedIOException(e);
- }
- _numberBigInt = NumberInput.parseBigInteger(
+ _numberBigInt = NumberInput.parseBigInteger(
text,
isEnabled(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER));
- _numTypesValid = NR_BIGINT;
- _currToken = JsonToken.VALUE_NUMBER_INT;
- return true;
+ _numTypesValid = NR_BIGINT;
+ _updateToken(JsonToken.VALUE_NUMBER_INT);
+ return true;
+ }
+ } catch (StreamConstraintsException e) {
+ // Ugh. This method in API ought to expose IOException
+ throw new UncheckedIOException(e);
}
}
return (t == JsonToken.VALUE_NUMBER_INT);
@@ -714,8 +710,7 @@
_numTypesValid = NR_UNKNOWN;
//System.out.println("FromXmlParser.nextToken0: _nextToken = "+_nextToken);
if (_nextToken != null) {
- JsonToken t = _nextToken;
- _currToken = t;
+ final JsonToken t = _updateToken(_nextToken);
_nextToken = null;
switch (t) {
@@ -757,7 +752,7 @@
// leave _mayBeLeaf set, as we start a new context
_nextToken = JsonToken.FIELD_NAME;
_parsingContext = _parsingContext.createChildObjectContext(-1,
-1);
- return (_currToken = JsonToken.START_OBJECT);
+ return _updateToken(JsonToken.START_OBJECT);
}
if (_parsingContext.inArray()) {
// Yup: in array, so this element could be verified; but it
won't be
@@ -778,7 +773,7 @@
_mayBeLeaf = true;
// Ok: in array context we need to skip reporting field names.
// But what's the best way to find next token?
- return (_currToken = JsonToken.FIELD_NAME);
+ return _updateToken(JsonToken.FIELD_NAME);
}
// Ok; beyond start element, what do we get?
@@ -793,16 +788,16 @@
// expose as empty Object, not null
_nextToken = JsonToken.END_OBJECT;
_parsingContext =
_parsingContext.createChildObjectContext(-1, -1);
- return (_currToken = JsonToken.START_OBJECT);
+ return _updateToken(JsonToken.START_OBJECT);
}
// 07-Sep-2019, tatu: for [dataformat-xml#353], must NOT
return second null
if (_currToken != JsonToken.VALUE_NULL) {
// 13-May-2020, tatu: [dataformat-xml#397]: advance
`index`
_parsingContext.valueStarted();
- return (_currToken = JsonToken.VALUE_NULL);
+ return _updateToken(JsonToken.VALUE_NULL);
}
}
- _currToken = _parsingContext.inArray() ? JsonToken.END_ARRAY :
JsonToken.END_OBJECT;
+ _updateToken(_parsingContext.inArray() ? JsonToken.END_ARRAY :
JsonToken.END_OBJECT);
_parsingContext = _parsingContext.getParent();
return _currToken;
@@ -813,15 +808,15 @@
_nextToken = JsonToken.FIELD_NAME;
_currText = _xmlTokens.getText();
_parsingContext =
_parsingContext.createChildObjectContext(-1, -1);
- return (_currToken = JsonToken.START_OBJECT);
+ return _updateToken(JsonToken.START_OBJECT);
}
_parsingContext.setCurrentName(_xmlTokens.getLocalName());
- return (_currToken = JsonToken.FIELD_NAME);
+ return _updateToken(JsonToken.FIELD_NAME);
case XmlTokenStream.XML_ATTRIBUTE_VALUE:
_currText = _xmlTokens.getText();
// 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
_parsingContext.valueStarted();
- return (_currToken = JsonToken.VALUE_STRING);
+ return _updateToken(JsonToken.VALUE_STRING);
case XmlTokenStream.XML_TEXT:
_currText = _xmlTokens.getText();
if (_mayBeLeaf) {
@@ -843,10 +838,10 @@
// be done, by swallowing the token)
_nextToken = JsonToken.END_OBJECT;
_parsingContext =
_parsingContext.createChildObjectContext(-1, -1);
- return (_currToken = JsonToken.START_OBJECT);
+ return _updateToken(JsonToken.START_OBJECT);
}
}
- return (_currToken = JsonToken.VALUE_STRING);
+ return _updateToken(JsonToken.VALUE_STRING);
}
if (token != XmlTokenStream.XML_START_ELEMENT) {
throw new JsonParseException(this, String.format(
@@ -868,7 +863,7 @@
// along is not enough.
_nextIsLeadingMixed = true;
_nextToken = JsonToken.FIELD_NAME;
- return (_currToken = JsonToken.START_OBJECT);
+ return _updateToken(JsonToken.START_OBJECT);
} else if (XmlTokenStream._allWs(_currText)) {
token = _nextToken();
continue;
@@ -897,9 +892,9 @@
// If not a leaf (or otherwise ignorable), need to transform
into property...
_parsingContext.setCurrentName(_cfgNameForTextElement);
_nextToken = JsonToken.VALUE_STRING;
- return (_currToken = JsonToken.FIELD_NAME);
+ return _updateToken(JsonToken.FIELD_NAME);
case XmlTokenStream.XML_END:
- return (_currToken = null);
+ return _updateTokenToNull();
default:
return _internalErrorUnknownToken(token);
}
@@ -931,8 +926,7 @@
{
_binaryValue = null;
if (_nextToken != null) {
- JsonToken t = _nextToken;
- _currToken = t;
+ final JsonToken t = _updateToken(_nextToken);
_nextToken = null;
// expected case; yes, got a String
@@ -952,7 +946,7 @@
if (_mayBeLeaf) {
_nextToken = JsonToken.FIELD_NAME;
_parsingContext = _parsingContext.createChildObjectContext(-1,
-1);
- _currToken = JsonToken.START_OBJECT;
+ _updateToken(JsonToken.START_OBJECT);
return null;
}
if (_parsingContext.inArray()) {
@@ -967,7 +961,7 @@
_xmlTokens.repeatStartElement();
}
_mayBeLeaf = true;
- _currToken = JsonToken.FIELD_NAME;
+ _updateToken(JsonToken.FIELD_NAME);
return null;
}
@@ -981,12 +975,12 @@
// asked text value -- but that seems incorrect. Hoping
this won't
// break anything in 2.15+
- _currToken = JsonToken.VALUE_NULL;
+ _updateToken(JsonToken.VALUE_NULL);
// 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
_parsingContext.valueStarted();
return (_currText = null);
}
- _currToken = _parsingContext.inArray() ? JsonToken.END_ARRAY :
JsonToken.END_OBJECT;
+ _updateToken(_parsingContext.inArray() ? JsonToken.END_ARRAY :
JsonToken.END_OBJECT);
_parsingContext = _parsingContext.getParent();
break;
case XmlTokenStream.XML_ATTRIBUTE_NAME:
@@ -996,14 +990,14 @@
_nextToken = JsonToken.FIELD_NAME;
_currText = _xmlTokens.getText();
_parsingContext = _parsingContext.createChildObjectContext(-1,
-1);
- _currToken = JsonToken.START_OBJECT;
+ _updateToken(JsonToken.START_OBJECT);
} else {
_parsingContext.setCurrentName(_xmlTokens.getLocalName());
- _currToken = JsonToken.FIELD_NAME;
+ _updateToken(JsonToken.FIELD_NAME);
}
break;
case XmlTokenStream.XML_ATTRIBUTE_VALUE:
- _currToken = JsonToken.VALUE_STRING;
+ _updateToken(JsonToken.VALUE_STRING);
// 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
_parsingContext.valueStarted();
return (_currText = _xmlTokens.getText());
@@ -1017,16 +1011,16 @@
// for otherwise empty List/array
// 13-May-2020, tatu: [dataformat-xml#397]: advance `index`
_parsingContext.valueStarted();
- _currToken = JsonToken.VALUE_STRING;
+ _updateToken(JsonToken.VALUE_STRING);
return _currText;
}
// If not a leaf, need to transform into property...
_parsingContext.setCurrentName(_cfgNameForTextElement);
_nextToken = JsonToken.VALUE_STRING;
- _currToken = JsonToken.FIELD_NAME;
+ _updateToken(JsonToken.FIELD_NAME);
break;
case XmlTokenStream.XML_END:
- _currToken = null;
+ _updateTokenToNull();
default:
return _internalErrorUnknownToken(token);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlReadContext.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlReadContext.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlReadContext.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlReadContext.java
2026-05-29 02:55:41.000000000 +0200
@@ -58,7 +58,11 @@
/**********************************************************************
*/
- public XmlReadContext(XmlReadContext parent, int type, int lineNr, int
colNr)
+ /**
+ * @since 2.18
+ */
+ public XmlReadContext(XmlReadContext parent, int nestingDepth,
+ int type, int lineNr, int colNr)
{
super();
_type = type;
@@ -66,7 +70,17 @@
_lineNr = lineNr;
_columnNr = colNr;
_index = -1;
- _nestingDepth = parent == null ? 0 : parent._nestingDepth + 1;
+ _nestingDepth = nestingDepth;
+ }
+
+ /**
+ * @deprecated Since 2.18
+ */
+ @Deprecated // since 2.18
+ public XmlReadContext(XmlReadContext parent, int type, int lineNr, int
colNr)
+ {
+ this(parent, (parent == null) ? 0 : parent._nestingDepth + 1,
+ type, lineNr, colNr);
}
protected final void reset(int type, int lineNr, int colNr)
@@ -98,11 +112,11 @@
*/
public static XmlReadContext createRootContext(int lineNr, int colNr) {
- return new XmlReadContext(null, TYPE_ROOT, lineNr, colNr);
+ return new XmlReadContext(null, 0, TYPE_ROOT, lineNr, colNr);
}
public static XmlReadContext createRootContext() {
- return new XmlReadContext(null, TYPE_ROOT, 1, 0);
+ return new XmlReadContext(null, 0, TYPE_ROOT, 1, 0);
}
public final XmlReadContext createChildArrayContext(int lineNr, int colNr)
@@ -110,7 +124,7 @@
++_index; // not needed for Object, but does not hurt so no need to
check curr type
XmlReadContext ctxt = _child;
if (ctxt == null) {
- _child = ctxt = new XmlReadContext(this, TYPE_ARRAY, lineNr,
colNr);
+ _child = ctxt = new XmlReadContext(this, _nestingDepth+1,
TYPE_ARRAY, lineNr, colNr);
return ctxt;
}
ctxt.reset(TYPE_ARRAY, lineNr, colNr);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java
2026-05-29 02:55:41.000000000 +0200
@@ -818,9 +818,12 @@
if (_nextIsAttribute) {
_xmlWriter.writeAttribute(_nextName.getNamespaceURI(),
_nextName.getLocalPart(), text);
} else if (checkNextIsUnwrapped()) {
+ // Woodstox 7.2.0 change: writeRaw does not close pending
start element; force it
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text);
} else {
_xmlWriter.writeStartElement(_nextName.getNamespaceURI(),
_nextName.getLocalPart());
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text);
_xmlWriter.writeEndElement();
}
@@ -844,9 +847,11 @@
if (_nextIsAttribute) {
_xmlWriter.writeAttribute(_nextName.getNamespaceURI(),
_nextName.getLocalPart(), text.substring(offset, offset + len));
} else if (checkNextIsUnwrapped()) {
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text, offset, len);
} else {
_xmlWriter.writeStartElement(_nextName.getNamespaceURI(),
_nextName.getLocalPart());
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text, offset, len);
_xmlWriter.writeEndElement();
}
@@ -869,9 +874,11 @@
if (_nextIsAttribute) {
_xmlWriter.writeAttribute(_nextName.getNamespaceURI(),
_nextName.getLocalPart(), new String(text, offset, len));
} else if (checkNextIsUnwrapped()) {
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text, offset, len);
} else {
_xmlWriter.writeStartElement(_nextName.getNamespaceURI(),
_nextName.getLocalPart());
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text, offset, len);
_xmlWriter.writeEndElement();
}
@@ -893,6 +900,8 @@
_reportUnimplementedStax2("writeRaw");
}
try {
+ // Woodstox 7.2.0 change: writeRaw does not close pending start
element; force it
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text);
} catch (XMLStreamException e) {
StaxUtil.throwAsGenerationException(e, this);
@@ -907,6 +916,7 @@
_reportUnimplementedStax2("writeRaw");
}
try {
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text, offset, len);
} catch (XMLStreamException e) {
StaxUtil.throwAsGenerationException(e, this);
@@ -921,6 +931,7 @@
_reportUnimplementedStax2("writeRaw");
}
try {
+ _xmlWriter.writeCharacters("");
_xmlWriter.writeRaw(text, offset, len);
} catch (XMLStreamException e) {
StaxUtil.throwAsGenerationException(e, this);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/util/DefaultXmlPrettyPrinter.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/util/DefaultXmlPrettyPrinter.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/util/DefaultXmlPrettyPrinter.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/util/DefaultXmlPrettyPrinter.java
2026-05-29 02:55:41.000000000 +0200
@@ -464,6 +464,8 @@
public void writePrologLinefeed(XMLStreamWriter2 sw) throws
XMLStreamException
{
// 06-Dec-2015, tatu: Alternatively could try calling `writeSpace()`...
+ // Woodstox 7.2.0 change: writeRaw does not close pending start
element; force it
+ sw.writeCharacters("");
sw.writeRaw(_newLine);
}
@@ -505,6 +507,8 @@
public void writeIndentation(XMLStreamWriter2 sw, int level)
throws XMLStreamException
{
+ // Woodstox 7.2.0 change: writeRaw does not close pending start
element; force it
+ sw.writeCharacters("");
sw.writeRaw(" ");
}
@@ -535,10 +539,12 @@
@Override
public void writeIndentation(XMLStreamWriter2 sw, int level) throws
XMLStreamException
{
+ // Woodstox 7.2.0 change: writeRaw does not close pending start
element; force it
+ sw.writeCharacters("");
sw.writeRaw(_newLine);
level += level; // 2 spaces per level
while (level > SPACE_COUNT) { // should never happen but...
- sw.writeRaw(SPACES, 0, SPACE_COUNT);
+ sw.writeRaw(SPACES, 0, SPACE_COUNT);
level -= SPACES.length;
}
sw.writeRaw(SPACES, 0, level);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/util/XmlRootNameLookup.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/util/XmlRootNameLookup.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/main/java/com/fasterxml/jackson/dataformat/xml/util/XmlRootNameLookup.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/main/java/com/fasterxml/jackson/dataformat/xml/util/XmlRootNameLookup.java
2026-05-29 02:55:41.000000000 +0200
@@ -54,17 +54,12 @@
public QName findRootName(Class<?> rootType, MapperConfig<?> config)
{
ClassKey key = new ClassKey(rootType);
- QName name;
- synchronized (_rootNames) {
- name = _rootNames.get(key);
- }
+ QName name = _rootNames.get(key);
if (name != null) {
return name;
}
name = _findRootName(config, rootType);
- synchronized (_rootNames) {
- _rootNames.put(key, name);
- }
+ _rootNames.put(key, name);
return name;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EnumDeserTest.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EnumDeserTest.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EnumDeserTest.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/EnumDeserTest.java
2026-05-29 02:55:41.000000000 +0200
@@ -1,5 +1,8 @@
package com.fasterxml.jackson.dataformat.xml.deser;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
import com.fasterxml.jackson.dataformat.xml.*;
public class EnumDeserTest extends XmlTestBase
@@ -14,6 +17,29 @@
public EnumBean(TestEnum v) { value = v; }
}
+ // [dataformat-xml#682]
+ static enum Country682 {
+ ITALY("Italy"),
+ NETHERLANDS("Netherlands");
+
+ @JsonValue
+ final String value;
+
+ Country682(String value) {
+ this.value = value;
+ }
+
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+ public static Country682 fromValue(String value) {
+ for (Country682 b : Country682.values()) {
+ if (b.value.equals(value)) {
+ return b;
+ }
+ }
+ throw new IllegalArgumentException("Unexpected value '" + value +
"'");
+ }
+ }
+
/*
/**********************************************************
/* Unit tests
@@ -38,4 +64,12 @@
assertNotNull(result);
assertEquals(TestEnum.B, result);
}
+
+ // [dataformat-xml#682]
+ public void testEnumDeser682() throws Exception {
+ String xml = MAPPER.writeValueAsString(Country682.ITALY);
+ assertEquals("<Country682>Italy</Country682>", xml);
+
+ assertEquals(Country682.ITALY, MAPPER.readValue(xml,
Country682.class));
+ }
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/XmlWrapperClass517Test.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/XmlWrapperClass517Test.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/XmlWrapperClass517Test.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/deser/XmlWrapperClass517Test.java
2026-05-29 02:55:41.000000000 +0200
@@ -0,0 +1,102 @@
+package com.fasterxml.jackson.dataformat.xml.deser;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
+import
com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+// [databind#517] XML wrapper doesn't work with java records
+// Equivalent to on in jdk17/.../records/XmlWrapperRecord517Test.java
+public class XmlWrapperClass517Test
+ extends XmlTestBase
+{
+ public static final class Request {
+ @JacksonXmlElementWrapper(localName = "messages")
+ @JacksonXmlProperty(localName = "message")
+ private final List<Message> messages;
+
+ Request() { this.messages = null; }
+ public Request(List<Message> messages) { this.messages = messages; }
+
+ public List<Message> getMessages() { return messages; }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Request)) return false;
+ return Objects.equals(messages, ((Request)o).messages);
+ }
+
+ @Override
+ public int hashCode() { return Objects.hash(messages); }
+
+ @Override
+ public String toString() { return "Request{messages=" + messages +
'}'; }
+ }
+
+ public static final class Message {
+
+ private final String text;
+
+ Message() { this.text = null; }
+ public Message(String text) { this.text = text; }
+
+ public String getText() { return text; }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Message)) return false;
+ Message message = (Message) o;
+ return Objects.equals(text, message.text);
+ }
+
+ @Override
+ public int hashCode() { return Objects.hash(text); }
+
+ @Override
+ public String toString() { return "Message{text='" + text + "\'}"; }
+ }
+
+ private final ObjectMapper mapper = newMapper();
+
+ private final String expectedXML =
+ "<Request>" +
+ "<messages>" +
+ "<message>" +
+ "<text>given text</text>" +
+ "</message>" +
+ "</messages>" +
+ "</Request>";
+
+ @Test
+ public void testShouldSerialize() throws Exception {
+ Request givenRequest = _createRequest("given text");
+
+ String actualXml = mapper.writeValueAsString(givenRequest);
+
+ assertEquals(expectedXML, actualXml);
+ }
+
+ @Test
+ public void testShouldDeserialize() throws Exception {
+ Request expected = _createRequest("given text");
+
+ Request actualRequest = mapper.readValue(expectedXML, Request.class);
+
+ assertEquals(expected, actualRequest);
+ }
+
+ private Request _createRequest(String givenText) {
+ List<Message> messages = new ArrayList<>();
+ messages.add(new Message(givenText));
+ return new Request(messages);
+ }
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ConflictingGetters27Test.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ConflictingGetters27Test.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ConflictingGetters27Test.java
2024-11-01 22:20:25.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ConflictingGetters27Test.java
2026-05-29 02:55:41.000000000 +0200
@@ -6,8 +6,10 @@
import
com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+// For [dataformat-xml#27]
public class ConflictingGetters27Test extends XmlTestBase
{
+ // [dataformat-xml#27]
@JsonRootName("output")
static class Bean {
public BeanInfo[] beanInfo;
@@ -42,10 +44,11 @@
/*
/**********************************************************************
- /* Unit tests
+ /* Test methods
/**********************************************************************
*/
+ // [dataformat-xml#27]
public void testIssue27() throws Exception
{
XmlMapper mapper = new XmlMapper();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/stream/dos/TokenCountTest.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/stream/dos/TokenCountTest.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test/java/com/fasterxml/jackson/dataformat/xml/stream/dos/TokenCountTest.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test/java/com/fasterxml/jackson/dataformat/xml/stream/dos/TokenCountTest.java
2026-05-29 02:55:41.000000000 +0200
@@ -0,0 +1,65 @@
+package com.fasterxml.jackson.dataformat.xml.stream.dos;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.StreamReadConstraints;
+import com.fasterxml.jackson.core.exc.StreamConstraintsException;
+import com.fasterxml.jackson.dataformat.xml.XmlFactory;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
+
+public class TokenCountTest extends XmlTestBase
+{
+ final XmlMapper XML_MAPPER;
+ {
+ final XmlFactory factory = XmlFactory.builder()
+ // token count is only checked when maxTokenCount is set
+ .streamReadConstraints(StreamReadConstraints.builder()
+ .maxTokenCount(1000)
+ .build())
+ .build();
+ XML_MAPPER = mapperBuilder(factory).build();
+ }
+
+ public void testTokenCount10() throws Exception
+ {
+ final String XML = createDeepNestedDoc(10);
+ try (JsonParser p = XML_MAPPER.createParser(XML)) {
+ while (p.nextToken() != null) { }
+ assertEquals(31, p.currentTokenCount());
+ }
+ }
+
+ public void testTokenCount100() throws Exception
+ {
+ final String XML = createDeepNestedDoc(100);
+ try (JsonParser p = XML_MAPPER.createParser(XML)) {
+ while (p.nextToken() != null) { }
+ assertEquals(301, p.currentTokenCount());
+ }
+ }
+
+ public void testDeepDoc() throws Exception
+ {
+ final String XML = createDeepNestedDoc(1000);
+ try (JsonParser p = XML_MAPPER.createParser(XML)) {
+ while (p.nextToken() != null) { }
+ fail("expected StreamReadException");
+ } catch (StreamConstraintsException e) {
+ assertTrue(e.getMessage().contains("Token count (1001) exceeds the
maximum allowed"));
+ }
+ }
+
+ private String createDeepNestedDoc(final int depth) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<a>");
+ for (int i = 0; i < depth; i++) {
+ sb.append("<a>");
+ }
+ sb.append("a");
+ for (int i = 0; i < depth; i++) {
+ sb.append("</a>");
+ }
+ sb.append("</a>");
+ return sb.toString();
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlRecordDeser734Test.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlRecordDeser734Test.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlRecordDeser734Test.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlRecordDeser734Test.java
2026-05-29 02:55:41.000000000 +0200
@@ -0,0 +1,30 @@
+package com.fasterxml.jackson.dataformat.xml.records.failing;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
+
+import static org.junit.Assert.assertEquals;
+
+// [dataformat-xml#734]
+public class XmlRecordDeser734Test extends XmlTestBase
+{
+
+ record Amount(@JacksonXmlText String value,
+ @JacksonXmlProperty(isAttribute = true, localName = "Ccy")
String currency) {}
+
+ private final String XML =
+ a2q("<Amt Ccy='EUR'>1</Amt>");
+
+ //@JacksonTestFailureExpected
+ @Test
+ public void testDeser() throws Exception {
+ XmlMapper mapper = new XmlMapper();
+ Amount amt = mapper.readValue(XML, Amount.class);
+ assertEquals("1", amt.value);
+ assertEquals("EUR", amt.currency);
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlWrapperRecord517Test.java
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlWrapperRecord517Test.java
---
old/jackson-dataformat-xml-jackson-dataformat-xml-2.17.3/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlWrapperRecord517Test.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-dataformat-xml-jackson-dataformat-xml-2.18.8/src/test-jdk17/java/com/fasterxml/jackson/dataformat/xml/records/failing/XmlWrapperRecord517Test.java
2026-05-29 02:55:41.000000000 +0200
@@ -0,0 +1,59 @@
+package com.fasterxml.jackson.dataformat.xml.records.failing;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
+import
com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+// [databind#517] XML wrapper doesn't work with java records
+// Equivalent to on in jdk17/.../deser/XmlWrapperRecord517Test.java
+public class XmlWrapperRecord517Test
+ extends XmlTestBase
+{
+
+ public record Request(
+ @JacksonXmlElementWrapper(localName = "messages")
+ @JacksonXmlProperty(localName = "message")
+ List<Message> messages
+ ) {
+ public Request {}
+
+ private Request() {this(null);}
+ }
+
+ public record Message(String text) {
+ public Message {
+ }
+
+ private Message() {
+ this(null);
+ }
+ }
+
+ private final String expectedXML =
+ "<Request>" +
+ "<messages>" +
+ "<message>" +
+ "<text>Hello, World!</text>" +
+ "</message>" +
+ "</messages>" +
+ "</Request>";
+
+ @Test
+ public void testWrapper() throws Exception {
+ XmlWrapperRecord517Test.Request request = new Request(List.of(new
Message("Hello, World!")));
+
+ // test serialization
+ String xml = newMapper().writeValueAsString(request);
+ assertEquals(expectedXML, xml);
+
+ // test deserialization
+ Request result = newMapper().readValue(xml, Request.class);
+
+ assertEquals(request.messages().size(), result.messages().size());
+ assertEquals(request.messages().get(0).text(),
result.messages().get(0).text());
+ }
+}