Skip to content

Commit 90ff93f

Browse files
Migrate from JAXB to Jakarta XML-Bind
1 parent a8529f0 commit 90ff93f

14 files changed

+47
-45
lines changed

.github/workflows/maven.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ jobs:
1111
name: build
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v4
1515
- name: Set up JDK
16-
uses: actions/setup-java@v1
16+
uses: actions/setup-java@v3
1717
with:
18-
java-version: 11
18+
distribution: 'zulu'
19+
java-version: 17
1920
- name: Build with Maven
2021
run: ./mvnw --no-transfer-progress clean verify
2122

@@ -24,10 +25,11 @@ jobs:
2425
runs-on: ubuntu-latest
2526
needs: build
2627
steps:
27-
- uses: actions/checkout@v1
28-
- uses: actions/setup-java@v1
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-java@v3
2930
with:
30-
java-version: 11
31+
distribution: 'zulu'
32+
java-version: 17
3133
- name: Run SonarCloud analyse
3234
run: >
3335
./mvnw --batch-mode --no-transfer-progress clean

README.textile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Since version 0.7.1 I have changed the API of _OembedService_ and removed _Optio
2020

2121
Since version 0.8.1 this project is Java 11 *only*.
2222

23-
Since version 1.0.0 this project is Java 17 *only*.
23+
Since version 1.0.0 this project is Java 17 *only* and uses Jakarta XML Bind instead of JAXB for parsing XML.
2424

2525
h2. Usage
2626

pom.xml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
<httpclient.version>4.5.14</httpclient.version>
7777
<httpcore.version>4.4.16</httpcore.version>
7878
<jackson.version>2.20.1</jackson.version>
79+
<jakarta.xml.bind-api.version>3.0.1</jakarta.xml.bind-api.version>
80+
<jaxb-impl.version>3.0.2</jaxb-impl.version>
7981
<jsoup.version>1.21.2</jsoup.version>
8082
<junit.version>6.0.1</junit.version>
8183
<license-maven-plugin.version>5.0.0</license-maven-plugin.version>
@@ -167,28 +169,17 @@
167169
</dependency>
168170
<dependency>
169171
<groupId>com.fasterxml.jackson.module</groupId>
170-
<artifactId>jackson-module-jaxb-annotations</artifactId>
171-
<exclusions>
172-
<exclusion>
173-
<groupId>javax.xml.bind</groupId>
174-
<artifactId>jaxb-api</artifactId>
175-
</exclusion>
176-
</exclusions>
172+
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
177173
</dependency>
178174
<dependency>
179175
<groupId>commons-beanutils</groupId>
180176
<artifactId>commons-beanutils</artifactId>
181177
<version>${commons-beanutils.version}</version>
182178
</dependency>
183179
<dependency>
184-
<groupId>javax.activation</groupId>
185-
<artifactId>javax.activation-api</artifactId>
186-
<version>1.2.0</version>
187-
</dependency>
188-
<dependency>
189-
<groupId>javax.xml.bind</groupId>
190-
<artifactId>jaxb-api</artifactId>
191-
<version>2.3.1</version>
180+
<groupId>jakarta.xml.bind</groupId>
181+
<artifactId>jakarta.xml.bind-api</artifactId>
182+
<version>${jakarta.xml.bind-api.version}</version>
192183
</dependency>
193184
<dependency>
194185
<groupId>net.sf.ehcache</groupId>
@@ -200,11 +191,6 @@
200191
<artifactId>httpclient</artifactId>
201192
<version>${httpclient.version}</version>
202193
</dependency>
203-
<dependency>
204-
<groupId>org.glassfish.jaxb</groupId>
205-
<artifactId>jaxb-runtime</artifactId>
206-
<version>2.3.1</version>
207-
</dependency>
208194
<dependency>
209195
<groupId>org.jsoup</groupId>
210196
<artifactId>jsoup</artifactId>
@@ -214,6 +200,12 @@
214200
<groupId>org.slf4j</groupId>
215201
<artifactId>slf4j-api</artifactId>
216202
</dependency>
203+
<dependency>
204+
<groupId>com.sun.xml.bind</groupId>
205+
<artifactId>jaxb-impl</artifactId>
206+
<version>${jaxb-impl.version}</version>
207+
<scope>runtime</scope>
208+
</dependency>
217209
<!-- Needed for HttpClient -->
218210
<dependency>
219211
<groupId>org.slf4j</groupId>

src/main/java/ac/simons/oembed/AutodiscoveredOembedEndpoint.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
* This is an auto-discovered endpoint. It doesn't support api url generation but only
4242
* fixed api urls. The format is also fixed.
4343
*
44-
* @author Michael J. Simons, 2015-01-01
44+
* @author Michael J. Simons
45+
* @since 2015-01-01
4546
*/
4647
final class AutodiscoveredOembedEndpoint extends OembedEndpoint {
4748

src/main/java/ac/simons/oembed/OembedException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
* An exception for wrapping any checked exception that might happens due parsing of
3838
* responses etc.
3939
*
40-
* @author Michael J. Simons, 2010-12-24
40+
* @author Michael J. Simons
41+
* @since 2010-12-24
4142
*/
4243
public class OembedException extends RuntimeException {
4344

src/main/java/ac/simons/oembed/OembedJsonParser.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@
4242
import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair;
4343
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
4444
import com.fasterxml.jackson.databind.type.TypeFactory;
45-
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
45+
import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector;
4646

4747
/**
4848
* Provides JSON Parsing for {@link OembedResponse}s. This class uses a private
4949
* {@link ObjectMapper} to ensure that the JAXB annotation introspector is configured
5050
* correctly.
5151
*
52-
* @author Michael J. Simons, 2010-12-24
52+
* @author Michael J. Simons
53+
* @since 2010-12-24
5354
*/
5455
public final class OembedJsonParser implements OembedParser {
5556

@@ -64,7 +65,7 @@ public final class OembedJsonParser implements OembedParser {
6465
public OembedJsonParser() {
6566
this.objectMapper = new ObjectMapper()
6667
.setAnnotationIntrospector(new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
67-
new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())))
68+
new JakartaXmlBindAnnotationIntrospector(TypeFactory.defaultInstance())))
6869
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
6970
}
7071

src/main/java/ac/simons/oembed/OembedResponse.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@
3535

3636
import java.io.Serializable;
3737

38-
import javax.xml.bind.annotation.XmlAccessType;
39-
import javax.xml.bind.annotation.XmlAccessorType;
40-
import javax.xml.bind.annotation.XmlElement;
41-
import javax.xml.bind.annotation.XmlRootElement;
42-
4338
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4439
import com.fasterxml.jackson.annotation.JsonInclude;
4540
import com.fasterxml.jackson.annotation.JsonInclude.Include;
41+
import jakarta.xml.bind.annotation.XmlAccessType;
42+
import jakarta.xml.bind.annotation.XmlAccessorType;
43+
import jakarta.xml.bind.annotation.XmlElement;
44+
import jakarta.xml.bind.annotation.XmlRootElement;
4645

4746
/**
4847
* This represents a valid OEmbed response according to the specs from

src/main/java/ac/simons/oembed/OembedXmlParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
import java.io.InputStream;
3737
import java.io.OutputStream;
3838

39-
import javax.xml.bind.JAXBContext;
40-
import javax.xml.bind.JAXBException;
39+
import jakarta.xml.bind.JAXBContext;
40+
import jakarta.xml.bind.JAXBException;
4141

4242
/**
4343
* Provides XML Parsing for {@link OembedResponse}s.

src/test/java/ac/simons/oembed/AutodiscoveredOembedEndpointTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
import static org.assertj.core.api.Assertions.assertThat;
4343

4444
/**
45-
* @author Michael J. Simons, 2015-01-09
45+
* @author Michael J. Simons
46+
* @since 2015-01-09
4647
*/
4748
public class AutodiscoveredOembedEndpointTests {
4849

src/test/java/ac/simons/oembed/BrokenRenderer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
import org.jsoup.nodes.Element;
3737

3838
/**
39-
* @author Michael J. Simons, 2015-01-02
39+
* @author Michael J. Simons
40+
* @since 2015-01-02
4041
*/
4142
class BrokenRenderer implements OembedResponseRenderer {
4243

0 commit comments

Comments
 (0)