Skip to content

Commit

Permalink
Use jakarta.xml.bind
Browse files Browse the repository at this point in the history
  • Loading branch information
plutext committed Dec 6, 2021
1 parent 3b93e53 commit 431a6f5
Show file tree
Hide file tree
Showing 2,782 changed files with 14,355 additions and 14,320 deletions.
2 changes: 1 addition & 1 deletion docx4j-JAXB-Jakarta/README-JAXB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</dependency>

had module name java.xml.bind
and packages javax.xml.bind
and packages jakarta.xml.bind


<dependency>
Expand Down
2 changes: 1 addition & 1 deletion docx4j-JAXB-MOXy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.7.4</version>
<version>3.0.1</version>
</dependency>

<dependency>
Expand Down
17 changes: 10 additions & 7 deletions docx4j-JAXB-ReferenceImpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
<!-- 2.3.2 should be good: https://github.com/eclipse-ee4j/jaxb-ri/issues/1168
See also https://javaee.github.io/jaxb-v2/doc/user-guide/release-documentation.html#deployment-jaxb-on-jpms
-->
<version>3.0.2</version>
</dependency>

<!--
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.0</version>
</dependency>
-->

<!--
Expand Down
3 changes: 2 additions & 1 deletion docx4j-JAXB-ReferenceImpl/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
requires org.slf4j;
requires org.docx4j.core;

requires com.sun.xml.bind; // should require the below!
// requires com.sun.xml.bind;
requires org.glassfish.jaxb.runtime;

// requires transitive org.jvnet.staxex;
// requires transitive com.sun.xml.txw2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.docx4j.jaxb.NamespacePrefixMapperUtils;
import org.docx4j.jaxb.NamespacePrefixMappings;

public class NamespacePrefixMapper extends com.sun.xml.bind.marshaller.NamespacePrefixMapper
public class NamespacePrefixMapper extends org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper
implements NamespacePrefixMapperInterface, McIgnorableNamespaceDeclarator {

private ThreadLocal<String> mcIgnorable = new ThreadLocal<String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.docx4j.jaxb.NamespacePrefixMapperUtils;
import org.docx4j.jaxb.NamespacePrefixMappings;

public class NamespacePrefixMapperRelationshipsPart extends com.sun.xml.bind.marshaller.NamespacePrefixMapper implements NamespacePrefixMapperInterface, McIgnorableNamespaceDeclarator {
public class NamespacePrefixMapperRelationshipsPart extends org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper implements NamespacePrefixMapperInterface, McIgnorableNamespaceDeclarator {

// private String mcIgnorable;
public void setMcIgnorable(String mcIgnorable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;

public class MarshalTest {

Expand Down
6 changes: 3 additions & 3 deletions docx4j-core-tests/src/test/java/org/docx4j/ParentFixTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;

import junit.framework.Assert;

Expand Down Expand Up @@ -191,7 +191,7 @@ public void testUnmarshalString() throws JAXBException {
} else if (o2.getParent() instanceof JAXBElement) {

// 3.3.0: Sad but true
// <= 3.3.0: org.docx4j.wml.CTBookmark has parent class javax.xml.bind.JAXBElement - NOT GOOD
// <= 3.3.0: org.docx4j.wml.CTBookmark has parent class jakarta.xml.bind.JAXBElement - NOT GOOD
Assert.assertEquals(JAXBElement.class, o2.getParent().getClass() );

// Traverse to fix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.junit.Assert.*;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import junit.framework.Assert;

Expand All @@ -21,11 +21,11 @@ public class XmlUtilsDeepCopyTest {
*
* With moxY:
*
* java.lang.IllegalArgumentException: javax.xml.bind.UnmarshalException
* java.lang.IllegalArgumentException: jakarta.xml.bind.UnmarshalException
*
- with linked exception:
[Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor for class javax.xml.bind.JAXBElement was not found in the project.
Exception Description: A descriptor for class jakarta.xml.bind.JAXBElement was not found in the project.
For JAXB, if the JAXBContext was bootstrapped using TypeMappingInfo[] you must call a marshal method that accepts TypeMappingInfo
as an input parameter.]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.io.OutputStream;
import java.math.BigInteger;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.docx4j.Docx4J;
import org.docx4j.Docx4jProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.io.FileInputStream;
import java.util.List;

import javax.xml.bind.Binder;
import jakarta.xml.bind.Binder;

import org.apache.commons.io.IOUtils;
import org.docx4j.XmlUtils;
Expand Down Expand Up @@ -294,7 +294,7 @@ public void testAltContentMarkNotSupported() throws Exception {
System.out.println(XmlUtils.marshaltoString(o));
Assert.fail("Expect an exception, since mark not supported");

} catch (javax.xml.bind.UnmarshalException e){
} catch (jakarta.xml.bind.UnmarshalException e){
System.out.println("OK " + e.getMessage() + " OK");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.io.IOException;
import java.io.InputStream;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;

import org.docx4j.Docx4jProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.io.InputStream;
import java.io.StringWriter;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

import java.io.FileInputStream;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.Unmarshaller;

import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

import javax.xml.bind.Binder;
import jakarta.xml.bind.Binder;

import org.docx4j.XmlUtils;
import org.docx4j.jaxb.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import static org.junit.Assert.*;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;

import org.docx4j.XmlUtils;
import org.docx4j.wml.P;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.math.BigInteger;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import junit.framework.Assert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.junit.Assert.*;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;

import org.docx4j.Docx4J;
import org.docx4j.openpackaging.exceptions.Docx4JException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.util.List;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;

import junit.framework.Assert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import java.io.ByteArrayOutputStream;
import java.io.File;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;

import junit.framework.Assert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.junit.Assert.*;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.docx4j.jaxb.Context;
import org.junit.Assert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import java.util.List;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;

import org.docx4j.TraversalUtil.CallbackImpl;
import org.docx4j.XmlUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.IOException;
import java.util.List;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.docx4j.com.microsoft.schemas.office.word.x2010.wordprocessingShape.CTWordprocessingShape;
import org.docx4j.dml.Graphic;
Expand Down
12 changes: 6 additions & 6 deletions docx4j-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@
javax.xml.transform.stream,
javax.xml.validation,
javax.xml.xpath,
javax.xml.bind,
javax.xml.bind.util,
javax.xml.bind.annotation,
javax.xml.bind.annotation.adapters,
javax.xml.bind.attachment,
javax.xml.bind.helpers,
jakarta.xml.bind,
jakarta.xml.bind.util,
jakarta.xml.bind.annotation,
jakarta.xml.bind.annotation.adapters,
jakarta.xml.bind.attachment,
jakarta.xml.bind.helpers,
org.w3c.dom,
org.w3c.dom.bootstrap,
org.w3c.dom.css,
Expand Down
18 changes: 9 additions & 9 deletions docx4j-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
requires transitive antlr.runtime;
requires transitive java.desktop;
requires transitive java.xml;
requires transitive java.xml.bind;
requires transitive jdk.xml.dom;
requires transitive mbassador;
requires transitive org.apache.commons.io;
Expand All @@ -37,6 +36,7 @@
requires java.logging;
requires org.apache.fontbox;
requires qdox;
requires jakarta.xml.bind;

exports org.docx4j;
exports org.docx4j.convert.in;
Expand Down Expand Up @@ -160,15 +160,15 @@
exports org.opendope.questions;
exports org.opendope.xpaths;

opens org.opendope.SmartArt.dataHierarchy to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.answers to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.components to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.conditions to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.questions to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.xpaths to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.SmartArt.dataHierarchy to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.answers to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.components to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.conditions to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.questions to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.opendope.xpaths to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;

opens org.docx4j.openpackaging.contenttype to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.docx4j.model.structure.jaxb to java.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.docx4j.openpackaging.contenttype to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;
opens org.docx4j.model.structure.jaxb to jakarta.xml.bind, com.sun.xml.bind, org.eclipse.persistence.moxy, org.eclipse.persistence.core;

opens org.docx4j.model.datastorage;// to java.xml.bind, com.sun.xml.bind; // for HistgramQNameTest

Expand Down
6 changes: 3 additions & 3 deletions docx4j-core/src/main/java/org/docx4j/TextUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.io.StringWriter;
import java.io.Writer;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.Marshaller;
import javax.xml.namespace.QName;

import org.slf4j.Logger;
Expand Down
6 changes: 3 additions & 3 deletions docx4j-core/src/main/java/org/docx4j/TraversalUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;

import org.docx4j.com.microsoft.schemas.office.word.x2010.wordprocessingShape.CTWordprocessingShape;
import org.docx4j.dml.CTHyperlink;
Expand Down Expand Up @@ -124,7 +124,7 @@ public void walkJAXBElements(Object parent) {
for (Object o : children) {

// In 3.3.4, we don't expect to do any parent fixes here.
if (o instanceof javax.xml.bind.JAXBElement) {
if (o instanceof jakarta.xml.bind.JAXBElement) {
// get its value; this is ok,
// provided the results of the Callback
// won't be marshalled
Expand Down Expand Up @@ -595,7 +595,7 @@ public static void replaceChildren(Object o, List<Object> newChildren) {
} else {
for (Object o : getChildren(parent) ) {
// if its wrapped in javax.xml.bind.JAXBElement, get its value
// if its wrapped in jakarta.xml.bind.JAXBElement, get its value
o = XmlUtils.unwrap(o);
newChildren.addAll(this.apply(o));
Expand Down
Loading

0 comments on commit 431a6f5

Please sign in to comment.