diff --git a/changes.md b/changes.md index d7788bfa3e..ce46b92349 100644 --- a/changes.md +++ b/changes.md @@ -3,6 +3,9 @@ Changes log - 2.6.0 (??-05-2025) - Misc + - Upgraded to Jakarta EE 10 + - JaxB to 4.0.0 + - Servlet API to 6.0.0 - Upgraded Gson library to 2.13.1. - Upgraded Jackson library to 2.19.1. - Upgraded Jetty library to version 2.0.17. diff --git a/org.restlet.java/org.restlet.ext.jaxb/pom.xml b/org.restlet.java/org.restlet.ext.jaxb/pom.xml index 1754d07a4d..27fe54053d 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/pom.xml +++ b/org.restlet.java/org.restlet.ext.jaxb/pom.xml @@ -16,19 +16,14 @@ - com.sun.xml.bind - jaxb-impl - ${lib-jaxb-ri-version} - - - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api ${lib-jaxb-api-version} - com.sun.istack - istack-commons-runtime - ${lib-istack-version} + org.glassfish.jaxb + jaxb-runtime + ${lib-jaxb-ri-version} org.restlet diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java index 377a73aaca..7947d2e090 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java +++ b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java @@ -12,8 +12,7 @@ import java.io.IOException; import java.util.List; -import javax.xml.bind.annotation.XmlRootElement; - +import jakarta.xml.bind.annotation.XmlRootElement; import org.restlet.data.MediaType; import org.restlet.data.Preference; import org.restlet.engine.converter.ConverterHelper; diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java index a69c881f31..a72835c967 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java +++ b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java @@ -15,12 +15,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.util.JAXBSource; -import javax.xml.parsers.DocumentBuilderFactory; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.ValidationEventHandler; +import jakarta.xml.bind.util.JAXBSource; +import org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper; import org.restlet.Context; import org.restlet.data.MediaType; import org.restlet.ext.jaxb.internal.Marshaller; @@ -28,8 +28,6 @@ import org.restlet.representation.Representation; import org.restlet.representation.WriterRepresentation; -import com.sun.xml.bind.marshaller.NamespacePrefixMapper; - /** * An XML representation based on JAXB that provides easy translation between * XML and JAXB element class trees. @@ -111,8 +109,7 @@ public static synchronized JAXBContext getContext(String contextPath, private volatile boolean formattedOutput; /** - * Indicates whether or not document level events will be generated by the - * Marshaller. + * Indicates whether the Marshaller will generate document level events. */ private volatile boolean fragment; @@ -135,8 +132,6 @@ public static synchronized JAXBContext getContext(String contextPath, * Indicates the desire for validating this type of XML representations * against a DTD. Note that for XML schema or Relax NG validation, use the * "schema" property instead. - * - * @see DocumentBuilderFactory#setValidating(boolean) */ private volatile boolean validatingDtd; @@ -145,10 +140,10 @@ public static synchronized JAXBContext getContext(String contextPath, /** * Indicates the desire for processing XInclude if found in this - * type of XML representations. By default the value of this is set to + * type of XML representations. By default, the value of this is set to * false. * - * @see DocumentBuilderFactory#setXIncludeAware(boolean) + * @see javax.xml.parsers.DocumentBuilderFactory#setXIncludeAware(boolean) */ private volatile boolean xIncludeAware; @@ -441,10 +436,10 @@ public ValidationEventHandler getValidationEventHandler() { } /** - * Indicates if the parser will expand entity reference nodes. By default + * Indicates if the parser expands entity reference nodes. By default, * the value of this is set to true. * - * @return True if the parser will expand entity reference nodes. + * @return True if the parser expands entity reference nodes. */ public boolean isExpandingEntityRefs() { return expandingEntityRefs; @@ -461,11 +456,9 @@ public boolean isFormattedOutput() { } /** - * Indicates whether or not document level events will be generated by the - * Marshaller. + * Indicates whether the Marshaller will generate document level events. * - * @return True if the document level events will be generated by the - * Marshaller. + * @return True if the Marshaller generates the document level events. */ public boolean isFragment() { return fragment; @@ -492,7 +485,7 @@ public boolean isValidatingDtd() { /** * Indicates the desire for processing XInclude if found in this - * type of XML representations. By default the value of this is set to + * type of XML representations. By default, the value of this is set to * false. * * @return The current value of the xIncludeAware flag. @@ -523,11 +516,11 @@ public void setContextPath(String contextPath) { } /** - * Indicates if the parser will expand entity reference nodes. By default + * Indicates if the parser expands entity reference nodes. By default, * the value of this is set to true. * * @param expandEntityRefs - * True if the parser will expand entity reference nodes. + * True if the parser expands entity reference nodes. */ public void setExpandingEntityRefs(boolean expandEntityRefs) { this.expandingEntityRefs = expandEntityRefs; @@ -549,7 +542,7 @@ public void setFormattedOutput(boolean formattedOutput) { * Marshaller. * * @param fragment - * True if the document level events will be generated by the + * True if the document level events are generated by the * Marshaller. */ public void setFragment(boolean fragment) { @@ -634,7 +627,7 @@ public void setValidationEventHandler( /** * Indicates the desire for processing XInclude if found in this - * type of XML representations. By default the value of this is set to + * type of XML representations. By default, the value of this is set to * false. * * @param includeAware @@ -651,7 +644,7 @@ public void setXIncludeAware(boolean includeAware) { * The writer to use when writing. * * @throws IOException - * If any error occurs attempting to write the stream. + * If any error occurs, attempting to write the stream. */ @Override public void write(Writer writer) throws IOException { diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java index f2f5e5d1e8..75c8a07a52 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java +++ b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java @@ -14,8 +14,7 @@ import java.io.Writer; import java.util.logging.Level; -import javax.xml.bind.JAXBException; - +import jakarta.xml.bind.JAXBException; import org.restlet.Context; import org.restlet.ext.jaxb.JaxbRepresentation; @@ -42,31 +41,32 @@ public class Marshaller { /** The parent JAXB representation. */ private final JaxbRepresentation jaxbRepresentation; - /** Use thread identity to preserve safety of access to marshalers. */ - private final ThreadLocal marshaller = new ThreadLocal() { + /** Use thread identity to preserve the safety of access to marshalers. */ + private final ThreadLocal marshaller = new ThreadLocal<>() { @Override - protected synchronized javax.xml.bind.Marshaller initialValue() { - javax.xml.bind.Marshaller m = null; + protected synchronized jakarta.xml.bind.Marshaller initialValue() { + jakarta.xml.bind.Marshaller m = null; try { m = JaxbRepresentation.getContext(getContextPath(), getClassLoader()).createMarshaller(); - m.setProperty("jaxb.formatted.output", getJaxbRepresentation() + + m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, getJaxbRepresentation() .isFormattedOutput()); if (getJaxbRepresentation().getSchemaLocation() != null) { - m.setProperty("jaxb.schemaLocation", + m.setProperty(jakarta.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION, getJaxbRepresentation().getSchemaLocation()); } if (getJaxbRepresentation().getNoNamespaceSchemaLocation() != null) { - m.setProperty("jaxb.noNamespaceSchemaLocation", + m.setProperty(jakarta.xml.bind.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, getJaxbRepresentation() .getNoNamespaceSchemaLocation()); } if (Marshaller.this.jaxbRepresentation.getCharacterSet() != null) { - m.setProperty("jaxb.encoding", + m.setProperty(jakarta.xml.bind.Marshaller.JAXB_ENCODING, Marshaller.this.jaxbRepresentation .getCharacterSet().getName()); } @@ -76,7 +76,7 @@ protected synchronized javax.xml.bind.Marshaller initialValue() { getJaxbRepresentation().getNamespacePrefixMapper()); } - m.setProperty("jaxb.fragment", getJaxbRepresentation() + m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FRAGMENT, getJaxbRepresentation() .isFragment()); } catch (Exception e) { Context.getCurrentLogger().log(Level.WARNING, @@ -143,8 +143,8 @@ public JaxbRepresentation getJaxbRepresentation() { * @return The JAXB marshaller. * @throws JAXBException */ - private javax.xml.bind.Marshaller getMarshaller() throws JAXBException { - final javax.xml.bind.Marshaller m = this.marshaller.get(); + private jakarta.xml.bind.Marshaller getMarshaller() throws JAXBException { + final jakarta.xml.bind.Marshaller m = this.marshaller.get(); if (m == null) { Context.getCurrentLogger().warning("Unable to locate marshaller."); throw new JAXBException("Unable to locate marshaller."); @@ -157,11 +157,11 @@ private javax.xml.bind.Marshaller getMarshaller() throws JAXBException { * stream. * * @param jaxbElement - * The root of the content tree to be marshalled. + * The root of the content tree to be marshaled. * @param stream - * The target output stream write the XML to. + * The target output stream writes the XML to. * @throws JAXBException - * If any unexpected problem occurs during marshalling. + * If any unexpected problem occurs during marshaling. */ public void marshal(Object jaxbElement, OutputStream stream) throws JAXBException { diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java index 28e543ed8f..54c192ea39 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java +++ b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java @@ -15,17 +15,17 @@ import java.io.Reader; import java.util.logging.Level; -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBException; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.sax.SAXSource; - +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.ValidationEventHandler; import org.restlet.Context; import org.restlet.ext.jaxb.JaxbRepresentation; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; +import javax.xml.XMLConstants; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.transform.sax.SAXSource; + /** * This is a utility class to assist in unmarshaling XML into a new Java content * tree. @@ -47,15 +47,14 @@ public class Unmarshaller { private final String contextPath; /** - * Use thread identity to preserve safety of access to unmarshallers. + * Use thread identity to preserve the safety of access to unmarshallers. */ - private final ThreadLocal unmarshaller = new ThreadLocal() { + private final ThreadLocal unmarshaller = new ThreadLocal<>() { @Override - protected synchronized javax.xml.bind.Unmarshaller initialValue() { - javax.xml.bind.Unmarshaller m = null; + protected synchronized jakarta.xml.bind.Unmarshaller initialValue() { + jakarta.xml.bind.Unmarshaller m = null; try { - m = JaxbRepresentation.getContext(getContextPath(), - getClassLoader()).createUnmarshaller(); + m = JaxbRepresentation.getContext(getContextPath(), getClassLoader()).createUnmarshaller(); } catch (Exception e) { Context.getCurrentLogger().log(Level.WARNING, "Problem creating Unmarshaller", e); @@ -102,8 +101,8 @@ public String getContextPath() { * @return The JAXB unmarshaller. * @throws JAXBException */ - private javax.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException { - final javax.xml.bind.Unmarshaller m = this.unmarshaller.get(); + private jakarta.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException { + final jakarta.xml.bind.Unmarshaller m = this.unmarshaller.get(); if (m == null) { Context.getCurrentLogger() .warning("Unable to locate unmarshaller."); diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java index 47809476aa..a1b9e4759a 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java +++ b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java @@ -9,7 +9,7 @@ package org.restlet.ext.jaxb; -import javax.xml.bind.annotation.XmlRegistry; +import jakarta.xml.bind.annotation.XmlRegistry; @XmlRegistry public class ObjectFactory { diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java index cb57eefe00..ea6dc7b52d 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java +++ b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java @@ -9,10 +9,10 @@ package org.restlet.ext.jaxb; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement diff --git a/pom.xml b/pom.xml index 9d77537cf2..b5c81af6f4 100644 --- a/pom.xml +++ b/pom.xml @@ -57,15 +57,15 @@ 2.12.2 3.0.12 2.19.1 - 2.4.0-b180830.0438 - 2.4.0-b180830.0359 + 4.0.0 + 4.0.0 2.14.0 12.0.22 20250517 1.2.17 1.3 4.3.1 - 5.0.0 + 6.0.0 2.0.17 6.2.8 3.1.3.RELEASE