Skip to content

Commit

Permalink
Merge pull request #4643 from adamretter/refactor/remove-xalan
Browse files Browse the repository at this point in the history
Remove the last small dependency on Apache Xalan
  • Loading branch information
dizzzz authored Oct 11, 2024
2 parents 9737c4c + becb0f9 commit 3e9f799
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 124 deletions.
19 changes: 0 additions & 19 deletions exist-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -385,24 +385,6 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>${xalan.version}</version> <!-- needed at compile time for various dependencies -->
<exclusions>
<exclusion> <!-- conflicts with Java 17's javax.xml module -->
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>xalan</groupId>
<artifactId>serializer</artifactId>
<version>${xalan.version}</version>
</dependency>

<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
Expand Down Expand Up @@ -1043,7 +1025,6 @@ The BaseX Team. The original license statement is also included below.]]></pream
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-jcl:jar:${log4j.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-slf4j2-impl:jar:${log4j.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-jul:jar:${log4j.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>xalan:serializer:jar:${xalan.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.eclipse.angus:angus-activation:jar:${eclipse.angus-activation.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.glassfish.jaxb:jaxb-runtime:jar:${jaxb.impl.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.fusesource.jansi:jansi:jar:${jansi.version}</ignoredUnusedDeclaredDependency>
Expand Down
4 changes: 2 additions & 2 deletions exist-core/src/main/java/org/exist/dom/memtree/NodeImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
package org.exist.dom.memtree;

import org.apache.xml.utils.XML11Char;
import org.apache.xml.utils.XMLChar;
import org.apache.xerces.util.XML11Char;
import org.apache.xerces.util.XMLChar;
import org.exist.collections.Collection;
import org.exist.dom.INode;
import org.exist.dom.NodeListImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public class TransformerFactoryAllocatorTest {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "net.sf.saxon.TransformerFactoryImpl" },
{ "org.apache.xalan.processor.TransformerFactoryImpl" }
{ "net.sf.saxon.TransformerFactoryImpl" }
});
}

Expand Down
6 changes: 4 additions & 2 deletions exist-core/src/test/resources/org/exist/config/conf1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@

<serializer add-exist-id="none" compress-output="no" enable-xinclude="yes" enable-xsl="no" indent="yes" match-tagging-attributes="no" match-tagging-elements="no"/>


<transformer class="org.apache.xalan.processor.TransformerFactoryImpl"/>

<transformer class="net.sf.saxon.TransformerFactoryImpl" caching="yes">
<attribute name="http://saxon.sf.net/feature/version-warning" value="false" type="boolean"/>
</transformer>


<validation mode="auto">
Expand Down
6 changes: 4 additions & 2 deletions exist-core/src/test/resources/org/exist/config/conf2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@

<serializer add-exist-id="none" compress-output="no" enable-xinclude="yes" enable-xsl="no" indent="yes" match-tagging-attributes="no" match-tagging-elements="no"/>


<transformer class="org.apache.xalan.processor.TransformerFactoryImpl"/>

<transformer class="net.sf.saxon.TransformerFactoryImpl" caching="yes">
<attribute name="http://saxon.sf.net/feature/version-warning" value="false" type="boolean"/>
</transformer>


<validation mode="auto">
Expand Down
1 change: 0 additions & 1 deletion exist-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<milton.servlet.version>1.8.1.3-jakarta5</milton.servlet.version>
<nekohtml.version>2.1.3</nekohtml.version>
<saxon.version>9.9.1-8</saxon.version>
<xalan.version>2.7.3</xalan.version>
<xmlresolver.version>5.2.3</xmlresolver.version>
<xmlunit.version>2.10.0</xmlunit.version>
<junit.version>4.13.2</junit.version>
Expand Down
89 changes: 14 additions & 75 deletions extensions/indexes/spatial/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</scm>

<properties>
<geotools.version>2.4.5</geotools.version>
<geotools.version>32.0</geotools.version>
</properties>

<dependencies>
Expand All @@ -60,31 +60,15 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>

<dependency>
<groupId>org.opengis</groupId>
<artifactId>geoapi-nogenerics</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-api</artifactId>
<artifactId>gt-api</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-main</artifactId>
<artifactId>gt-main</artifactId>
<version>${geotools.version}</version>
<exclusions>
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
Expand All @@ -94,41 +78,29 @@
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-referencing</artifactId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-epsg-extension</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-metadata</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-xml</artifactId>
<version>${geotools.version}</version>
</dependency>
-->
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
<groupId>org.geotools</groupId>
<artifactId>gt-xml</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.7.1</version>
<!-- NOTE: needed for both scopes: <scope>runtime</scope><scope>test</scope> -->
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.19.0</version>
</dependency>

<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt2-epsg-wkt</artifactId>
<artifactId>gt-epsg-wkt</artifactId>
<version>${geotools.version}</version>
<scope>runtime</scope>
</dependency>
Expand Down Expand Up @@ -188,7 +160,7 @@
<configuration>
<failOnWarning>true</failOnWarning>
<ignoredUnusedDeclaredDependencies>
<ignoredUnusedDeclaredDependency>org.geotools:gt2-epsg-wkt:jar:${geotools.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.geotools:gt-epsg-wkt:jar:${geotools.version}</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.hsqldb:hsqldb:jar</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>java3d:vecmath:jar:1.3.1</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>javax.media:jai_core:jar:1.1.3</ignoredUnusedDeclaredDependency>
Expand Down Expand Up @@ -223,42 +195,9 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TODO the version of GeoTools that we use is not compatible with Java 9+
so we skip the tests by default, and only enable them in a profile (below) if Java 8
See: https://medium.com/codefx-weekly/geotools-on-java-9-e8717e347a1f
See: https://github.com/geotools/geotools/pull/1670
-->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>test-java8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>osgeo</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
*/
package org.exist.indexing.spatial;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKBReader;
import com.vividsolutions.jts.io.WKBWriter;
import com.vividsolutions.jts.io.WKTReader;
import com.vividsolutions.jts.io.WKTWriter;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKBReader;
import org.locationtech.jts.io.WKBWriter;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.io.WKTWriter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.exist.collections.Collection;
Expand Down Expand Up @@ -55,10 +55,10 @@
import org.geotools.gml.GMLHandlerJTS;
import org.geotools.gml.producer.GeometryTransformer;
import org.geotools.referencing.CRS;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.OperationNotFoundException;
import org.opengis.referencing.operation.TransformException;
import org.geotools.api.referencing.FactoryException;
import org.geotools.api.referencing.operation.MathTransform;
import org.geotools.api.referencing.operation.OperationNotFoundException;
import org.geotools.api.referencing.operation.TransformException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
Expand All @@ -74,6 +74,7 @@
import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
Expand Down Expand Up @@ -111,7 +112,7 @@ public abstract class AbstractGMLJDBCIndexWorker implements IndexWorker {
protected TreeMap<String, MathTransform> transformations = new TreeMap<>();
protected boolean useLenientMode = false;
protected GeometryCoordinateSequenceTransformer coordinateTransformer = new GeometryCoordinateSequenceTransformer();
protected GeometryTransformer gmlTransformer = new GeometryTransformer();
protected final GeometryTransformer gmlTransformer;
protected WKBWriter wkbWriter = new WKBWriter();
protected WKBReader wkbReader = new WKBReader();
protected WKTWriter wktWriter = new WKTWriter();
Expand All @@ -120,6 +121,11 @@ public abstract class AbstractGMLJDBCIndexWorker implements IndexWorker {
public AbstractGMLJDBCIndexWorker(AbstractGMLJDBCIndex index, DBBroker broker) {
this.index = index;
this.broker = broker;
this.gmlTransformer = new GeometryTransformer();
gmlTransformer.setEncoding(StandardCharsets.UTF_8);
gmlTransformer.setIndentation(4);
gmlTransformer.setNamespaceDeclarationEnabled(true);
gmlTransformer.setOmitXMLDeclaration(false);
}

protected DBBroker getBroker() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import org.exist.xquery.value.StringValue;
import org.exist.xquery.value.ValueSequence;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.ParseException;
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
import org.exist.xquery.XQueryContext;
import org.exist.xquery.value.Base64BinaryValueType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
import org.exist.xquery.value.Type;
import org.w3c.dom.Element;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import com.vividsolutions.jts.operation.buffer.BufferOp;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.operation.buffer.BufferOp;

/**
* @author <a href="mailto:pierrick.brihaye@free.fr">Pierrick Brihaye</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
import org.exist.xquery.value.Type;
import org.w3c.dom.Element;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKBWriter;
import com.vividsolutions.jts.io.WKTWriter;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKBWriter;
import org.locationtech.jts.io.WKTWriter;

/**
* @author <a href="mailto:pierrick.brihaye@free.fr">Pierrick Brihaye</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.exist.xquery.value.Type;
import org.w3c.dom.Element;

import com.vividsolutions.jts.geom.Geometry;
import org.locationtech.jts.geom.Geometry;

/**
* @author <a href="mailto:pierrick.brihaye@free.fr">Pierrick Brihaye</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import org.xml.sax.*;
import org.xml.sax.helpers.XMLFilterImpl;

import com.vividsolutions.jts.geom.Geometry;
import org.locationtech.jts.geom.Geometry;

import static org.junit.Assert.*;

Expand Down

0 comments on commit 3e9f799

Please sign in to comment.