Skip to content

Commit 9a5803f

Browse files
thboileauThierry Boileau
andauthored
2.6 jakarta ee 10 (#1461)
* Upgraded JaxB 4.0.0 * Upgraded Servlet API to 6.0.0 --------- Co-authored-by: Thierry Boileau <[email protected]>
1 parent f0d1f7c commit 9a5803f

File tree

9 files changed

+64
-75
lines changed

9 files changed

+64
-75
lines changed

changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Changes log
33

44
- 2.6.0 (??-05-2025)
55
- Misc
6+
- Upgraded to Jakarta EE 10
7+
- JaxB to 4.0.0
8+
- Servlet API to 6.0.0
69
- Upgraded Gson library to 2.13.1.
710
- Upgraded Jackson library to 2.19.1.
811
- Upgraded Jetty library to version 2.0.17.

org.restlet.java/org.restlet.ext.jaxb/pom.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,14 @@
1616

1717
<dependencies>
1818
<dependency>
19-
<groupId>com.sun.xml.bind</groupId>
20-
<artifactId>jaxb-impl</artifactId>
21-
<version>${lib-jaxb-ri-version}</version>
22-
</dependency>
23-
<dependency>
24-
<groupId>javax.xml.bind</groupId>
25-
<artifactId>jaxb-api</artifactId>
19+
<groupId>jakarta.xml.bind</groupId>
20+
<artifactId>jakarta.xml.bind-api</artifactId>
2621
<version>${lib-jaxb-api-version}</version>
2722
</dependency>
2823
<dependency>
29-
<groupId>com.sun.istack</groupId>
30-
<artifactId>istack-commons-runtime</artifactId>
31-
<version>${lib-istack-version}</version>
24+
<groupId>org.glassfish.jaxb</groupId>
25+
<artifactId>jaxb-runtime</artifactId>
26+
<version>${lib-jaxb-ri-version}</version>
3227
</dependency>
3328
<dependency>
3429
<groupId>org.restlet</groupId>

org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
import java.io.IOException;
1313
import java.util.List;
1414

15-
import javax.xml.bind.annotation.XmlRootElement;
16-
15+
import jakarta.xml.bind.annotation.XmlRootElement;
1716
import org.restlet.data.MediaType;
1817
import org.restlet.data.Preference;
1918
import org.restlet.engine.converter.ConverterHelper;

org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@
1515
import java.util.concurrent.ConcurrentHashMap;
1616
import java.util.logging.Level;
1717

18-
import javax.xml.bind.JAXBContext;
19-
import javax.xml.bind.JAXBException;
20-
import javax.xml.bind.ValidationEventHandler;
21-
import javax.xml.bind.util.JAXBSource;
22-
import javax.xml.parsers.DocumentBuilderFactory;
18+
import jakarta.xml.bind.JAXBContext;
19+
import jakarta.xml.bind.JAXBException;
20+
import jakarta.xml.bind.ValidationEventHandler;
21+
import jakarta.xml.bind.util.JAXBSource;
2322

23+
import org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper;
2424
import org.restlet.Context;
2525
import org.restlet.data.MediaType;
2626
import org.restlet.ext.jaxb.internal.Marshaller;
2727
import org.restlet.ext.jaxb.internal.Unmarshaller;
2828
import org.restlet.representation.Representation;
2929
import org.restlet.representation.WriterRepresentation;
3030

31-
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
32-
3331
/**
3432
* An XML representation based on JAXB that provides easy translation between
3533
* XML and JAXB element class trees.
@@ -111,8 +109,7 @@ public static synchronized JAXBContext getContext(String contextPath,
111109
private volatile boolean formattedOutput;
112110

113111
/**
114-
* Indicates whether or not document level events will be generated by the
115-
* Marshaller.
112+
* Indicates whether the Marshaller will generate document level events.
116113
*/
117114
private volatile boolean fragment;
118115

@@ -135,8 +132,6 @@ public static synchronized JAXBContext getContext(String contextPath,
135132
* Indicates the desire for validating this type of XML representations
136133
* against a DTD. Note that for XML schema or Relax NG validation, use the
137134
* "schema" property instead.
138-
*
139-
* @see DocumentBuilderFactory#setValidating(boolean)
140135
*/
141136
private volatile boolean validatingDtd;
142137

@@ -145,10 +140,10 @@ public static synchronized JAXBContext getContext(String contextPath,
145140

146141
/**
147142
* Indicates the desire for processing <em>XInclude</em> if found in this
148-
* type of XML representations. By default the value of this is set to
143+
* type of XML representations. By default, the value of this is set to
149144
* false.
150145
*
151-
* @see DocumentBuilderFactory#setXIncludeAware(boolean)
146+
* @see javax.xml.parsers.DocumentBuilderFactory#setXIncludeAware(boolean)
152147
*/
153148
private volatile boolean xIncludeAware;
154149

@@ -441,10 +436,10 @@ public ValidationEventHandler getValidationEventHandler() {
441436
}
442437

443438
/**
444-
* Indicates if the parser will expand entity reference nodes. By default
439+
* Indicates if the parser expands entity reference nodes. By default,
445440
* the value of this is set to true.
446441
*
447-
* @return True if the parser will expand entity reference nodes.
442+
* @return True if the parser expands entity reference nodes.
448443
*/
449444
public boolean isExpandingEntityRefs() {
450445
return expandingEntityRefs;
@@ -461,11 +456,9 @@ public boolean isFormattedOutput() {
461456
}
462457

463458
/**
464-
* Indicates whether or not document level events will be generated by the
465-
* Marshaller.
459+
* Indicates whether the Marshaller will generate document level events.
466460
*
467-
* @return True if the document level events will be generated by the
468-
* Marshaller.
461+
* @return True if the Marshaller generates the document level events.
469462
*/
470463
public boolean isFragment() {
471464
return fragment;
@@ -492,7 +485,7 @@ public boolean isValidatingDtd() {
492485

493486
/**
494487
* Indicates the desire for processing <em>XInclude</em> if found in this
495-
* type of XML representations. By default the value of this is set to
488+
* type of XML representations. By default, the value of this is set to
496489
* false.
497490
*
498491
* @return The current value of the xIncludeAware flag.
@@ -523,11 +516,11 @@ public void setContextPath(String contextPath) {
523516
}
524517

525518
/**
526-
* Indicates if the parser will expand entity reference nodes. By default
519+
* Indicates if the parser expands entity reference nodes. By default,
527520
* the value of this is set to true.
528521
*
529522
* @param expandEntityRefs
530-
* True if the parser will expand entity reference nodes.
523+
* True if the parser expands entity reference nodes.
531524
*/
532525
public void setExpandingEntityRefs(boolean expandEntityRefs) {
533526
this.expandingEntityRefs = expandEntityRefs;
@@ -549,7 +542,7 @@ public void setFormattedOutput(boolean formattedOutput) {
549542
* Marshaller.
550543
*
551544
* @param fragment
552-
* True if the document level events will be generated by the
545+
* True if the document level events are generated by the
553546
* Marshaller.
554547
*/
555548
public void setFragment(boolean fragment) {
@@ -634,7 +627,7 @@ public void setValidationEventHandler(
634627

635628
/**
636629
* Indicates the desire for processing <em>XInclude</em> if found in this
637-
* type of XML representations. By default the value of this is set to
630+
* type of XML representations. By default, the value of this is set to
638631
* false.
639632
*
640633
* @param includeAware
@@ -651,7 +644,7 @@ public void setXIncludeAware(boolean includeAware) {
651644
* The writer to use when writing.
652645
*
653646
* @throws IOException
654-
* If any error occurs attempting to write the stream.
647+
* If any error occurs, attempting to write the stream.
655648
*/
656649
@Override
657650
public void write(Writer writer) throws IOException {

org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
import java.io.Writer;
1515
import java.util.logging.Level;
1616

17-
import javax.xml.bind.JAXBException;
18-
17+
import jakarta.xml.bind.JAXBException;
1918
import org.restlet.Context;
2019
import org.restlet.ext.jaxb.JaxbRepresentation;
2120

@@ -42,31 +41,32 @@ public class Marshaller<T> {
4241
/** The parent JAXB representation. */
4342
private final JaxbRepresentation<T> jaxbRepresentation;
4443

45-
/** Use thread identity to preserve safety of access to marshalers. */
46-
private final ThreadLocal<javax.xml.bind.Marshaller> marshaller = new ThreadLocal<javax.xml.bind.Marshaller>() {
44+
/** Use thread identity to preserve the safety of access to marshalers. */
45+
private final ThreadLocal<jakarta.xml.bind.Marshaller> marshaller = new ThreadLocal<>() {
4746

4847
@Override
49-
protected synchronized javax.xml.bind.Marshaller initialValue() {
50-
javax.xml.bind.Marshaller m = null;
48+
protected synchronized jakarta.xml.bind.Marshaller initialValue() {
49+
jakarta.xml.bind.Marshaller m = null;
5150

5251
try {
5352
m = JaxbRepresentation.getContext(getContextPath(),
5453
getClassLoader()).createMarshaller();
55-
m.setProperty("jaxb.formatted.output", getJaxbRepresentation()
54+
55+
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, getJaxbRepresentation()
5656
.isFormattedOutput());
5757

5858
if (getJaxbRepresentation().getSchemaLocation() != null) {
59-
m.setProperty("jaxb.schemaLocation",
59+
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION,
6060
getJaxbRepresentation().getSchemaLocation());
6161
}
6262
if (getJaxbRepresentation().getNoNamespaceSchemaLocation() != null) {
63-
m.setProperty("jaxb.noNamespaceSchemaLocation",
63+
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
6464
getJaxbRepresentation()
6565
.getNoNamespaceSchemaLocation());
6666
}
6767

6868
if (Marshaller.this.jaxbRepresentation.getCharacterSet() != null) {
69-
m.setProperty("jaxb.encoding",
69+
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_ENCODING,
7070
Marshaller.this.jaxbRepresentation
7171
.getCharacterSet().getName());
7272
}
@@ -76,7 +76,7 @@ protected synchronized javax.xml.bind.Marshaller initialValue() {
7676
getJaxbRepresentation().getNamespacePrefixMapper());
7777
}
7878

79-
m.setProperty("jaxb.fragment", getJaxbRepresentation()
79+
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FRAGMENT, getJaxbRepresentation()
8080
.isFragment());
8181
} catch (Exception e) {
8282
Context.getCurrentLogger().log(Level.WARNING,
@@ -143,8 +143,8 @@ public JaxbRepresentation<T> getJaxbRepresentation() {
143143
* @return The JAXB marshaller.
144144
* @throws JAXBException
145145
*/
146-
private javax.xml.bind.Marshaller getMarshaller() throws JAXBException {
147-
final javax.xml.bind.Marshaller m = this.marshaller.get();
146+
private jakarta.xml.bind.Marshaller getMarshaller() throws JAXBException {
147+
final jakarta.xml.bind.Marshaller m = this.marshaller.get();
148148
if (m == null) {
149149
Context.getCurrentLogger().warning("Unable to locate marshaller.");
150150
throw new JAXBException("Unable to locate marshaller.");
@@ -157,11 +157,11 @@ private javax.xml.bind.Marshaller getMarshaller() throws JAXBException {
157157
* stream.
158158
*
159159
* @param jaxbElement
160-
* The root of the content tree to be marshalled.
160+
* The root of the content tree to be marshaled.
161161
* @param stream
162-
* The target output stream write the XML to.
162+
* The target output stream writes the XML to.
163163
* @throws JAXBException
164-
* If any unexpected problem occurs during marshalling.
164+
* If any unexpected problem occurs during marshaling.
165165
*/
166166
public void marshal(Object jaxbElement, OutputStream stream)
167167
throws JAXBException {

org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
import java.io.Reader;
1616
import java.util.logging.Level;
1717

18-
import javax.xml.XMLConstants;
19-
import javax.xml.bind.JAXBException;
20-
import javax.xml.bind.ValidationEventHandler;
21-
import javax.xml.parsers.SAXParserFactory;
22-
import javax.xml.transform.sax.SAXSource;
23-
18+
import jakarta.xml.bind.JAXBException;
19+
import jakarta.xml.bind.ValidationEventHandler;
2420
import org.restlet.Context;
2521
import org.restlet.ext.jaxb.JaxbRepresentation;
2622
import org.xml.sax.InputSource;
2723
import org.xml.sax.XMLReader;
2824

25+
import javax.xml.XMLConstants;
26+
import javax.xml.parsers.SAXParserFactory;
27+
import javax.xml.transform.sax.SAXSource;
28+
2929
/**
3030
* This is a utility class to assist in unmarshaling XML into a new Java content
3131
* tree.
@@ -47,15 +47,14 @@ public class Unmarshaller<T> {
4747
private final String contextPath;
4848

4949
/**
50-
* Use thread identity to preserve safety of access to unmarshallers.
50+
* Use thread identity to preserve the safety of access to unmarshallers.
5151
*/
52-
private final ThreadLocal<javax.xml.bind.Unmarshaller> unmarshaller = new ThreadLocal<javax.xml.bind.Unmarshaller>() {
52+
private final ThreadLocal<jakarta.xml.bind.Unmarshaller> unmarshaller = new ThreadLocal<>() {
5353
@Override
54-
protected synchronized javax.xml.bind.Unmarshaller initialValue() {
55-
javax.xml.bind.Unmarshaller m = null;
54+
protected synchronized jakarta.xml.bind.Unmarshaller initialValue() {
55+
jakarta.xml.bind.Unmarshaller m = null;
5656
try {
57-
m = JaxbRepresentation.getContext(getContextPath(),
58-
getClassLoader()).createUnmarshaller();
57+
m = JaxbRepresentation.getContext(getContextPath(), getClassLoader()).createUnmarshaller();
5958
} catch (Exception e) {
6059
Context.getCurrentLogger().log(Level.WARNING,
6160
"Problem creating Unmarshaller", e);
@@ -102,8 +101,8 @@ public String getContextPath() {
102101
* @return The JAXB unmarshaller.
103102
* @throws JAXBException
104103
*/
105-
private javax.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException {
106-
final javax.xml.bind.Unmarshaller m = this.unmarshaller.get();
104+
private jakarta.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException {
105+
final jakarta.xml.bind.Unmarshaller m = this.unmarshaller.get();
107106
if (m == null) {
108107
Context.getCurrentLogger()
109108
.warning("Unable to locate unmarshaller.");

org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
package org.restlet.ext.jaxb;
1111

12-
import javax.xml.bind.annotation.XmlRegistry;
12+
import jakarta.xml.bind.annotation.XmlRegistry;
1313

1414
@XmlRegistry
1515
public class ObjectFactory {

org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
package org.restlet.ext.jaxb;
1111

12-
import javax.xml.bind.annotation.XmlAccessType;
13-
import javax.xml.bind.annotation.XmlAccessorType;
14-
import javax.xml.bind.annotation.XmlElement;
15-
import javax.xml.bind.annotation.XmlRootElement;
12+
import jakarta.xml.bind.annotation.XmlAccessType;
13+
import jakarta.xml.bind.annotation.XmlAccessorType;
14+
import jakarta.xml.bind.annotation.XmlElement;
15+
import jakarta.xml.bind.annotation.XmlRootElement;
1616

1717
@XmlAccessorType(XmlAccessType.FIELD)
1818
@XmlRootElement

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
<lib-gwt-server-version>2.12.2</lib-gwt-server-version>
5858
<lib-istack-version>3.0.12</lib-istack-version>
5959
<lib-jackson-version>2.19.1</lib-jackson-version>
60-
<lib-jaxb-ri-version>2.4.0-b180830.0438</lib-jaxb-ri-version>
61-
<lib-jaxb-api-version>2.4.0-b180830.0359</lib-jaxb-api-version>
60+
<lib-jaxb-ri-version>4.0.0</lib-jaxb-ri-version>
61+
<lib-jaxb-api-version>4.0.0</lib-jaxb-api-version>
6262
<lib-joda-time-version>2.14.0</lib-joda-time-version>
6363
<lib-jetty-version>12.0.22</lib-jetty-version>
6464
<lib-json-version>20250517</lib-json-version>
6565
<lib-log4j-version>1.2.17</lib-log4j-version>
6666
<lib-hamcrest-version>1.3</lib-hamcrest-version>
6767
<lib-osgi-version>4.3.1</lib-osgi-version>
68-
<lib-servlet-version>5.0.0</lib-servlet-version>
68+
<lib-servlet-version>6.0.0</lib-servlet-version>
6969
<lib-slf4j-version>2.0.17</lib-slf4j-version>
7070
<lib-spring-version>6.2.8</lib-spring-version>
7171
<lib-thymeleaf-version>3.1.3.RELEASE</lib-thymeleaf-version>

0 commit comments

Comments
 (0)