From 601a0bcd841af0e0685e5b3889875029ce98a829 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Wed, 7 Dec 2022 19:37:40 +0000 Subject: [PATCH 1/5] [refactor] Remove the last small dependency on Apache Xalan, instead use the equivalent classes from Apache Xerces --- exist-core/pom.xml | 19 ------------------- .../java/org/exist/dom/memtree/NodeImpl.java | 4 ++-- .../xslt/TransformerFactoryAllocatorTest.java | 3 +-- .../test/resources/org/exist/config/conf1.xml | 6 ++++-- .../test/resources/org/exist/config/conf2.xml | 6 ++++-- exist-parent/pom.xml | 1 - 6 files changed, 11 insertions(+), 28 deletions(-) diff --git a/exist-core/pom.xml b/exist-core/pom.xml index 1918542adff..e2b30f26918 100644 --- a/exist-core/pom.xml +++ b/exist-core/pom.xml @@ -385,24 +385,6 @@ runtime - - xalan - xalan - ${xalan.version} - - - xml-apis - xml-apis - - - - - - xalan - serializer - ${xalan.version} - - net.sf.saxon Saxon-HE @@ -1041,7 +1023,6 @@ The BaseX Team. The original license statement is also included below.]]>org.apache.logging.log4j:log4j-jcl:jar:${log4j.version} org.apache.logging.log4j:log4j-slf4j2-impl:jar:${log4j.version} org.apache.logging.log4j:log4j-jul:jar:${log4j.version} - xalan:serializer:jar:${xalan.version} org.eclipse.angus:angus-activation:jar:${eclipse.angus-activation.version} org.glassfish.jaxb:jaxb-runtime:jar:${jaxb.impl.version} org.fusesource.jansi:jansi:jar:${jansi.version} diff --git a/exist-core/src/main/java/org/exist/dom/memtree/NodeImpl.java b/exist-core/src/main/java/org/exist/dom/memtree/NodeImpl.java index 7c69574049f..40754e5e811 100644 --- a/exist-core/src/main/java/org/exist/dom/memtree/NodeImpl.java +++ b/exist-core/src/main/java/org/exist/dom/memtree/NodeImpl.java @@ -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; diff --git a/exist-core/src/test/java/org/exist/xslt/TransformerFactoryAllocatorTest.java b/exist-core/src/test/java/org/exist/xslt/TransformerFactoryAllocatorTest.java index d11442b4040..62170a22974 100644 --- a/exist-core/src/test/java/org/exist/xslt/TransformerFactoryAllocatorTest.java +++ b/exist-core/src/test/java/org/exist/xslt/TransformerFactoryAllocatorTest.java @@ -48,8 +48,7 @@ public class TransformerFactoryAllocatorTest { @Parameters(name = "{0}") public static Collection data() { return Arrays.asList(new Object[][] { - { "net.sf.saxon.TransformerFactoryImpl" }, - { "org.apache.xalan.processor.TransformerFactoryImpl" } + { "net.sf.saxon.TransformerFactoryImpl" } }); } diff --git a/exist-core/src/test/resources/org/exist/config/conf1.xml b/exist-core/src/test/resources/org/exist/config/conf1.xml index 9177d288bb9..f3cbf46fb68 100644 --- a/exist-core/src/test/resources/org/exist/config/conf1.xml +++ b/exist-core/src/test/resources/org/exist/config/conf1.xml @@ -71,8 +71,10 @@ - - + + + + diff --git a/exist-core/src/test/resources/org/exist/config/conf2.xml b/exist-core/src/test/resources/org/exist/config/conf2.xml index e772b1bdab7..0e424ae4bc7 100644 --- a/exist-core/src/test/resources/org/exist/config/conf2.xml +++ b/exist-core/src/test/resources/org/exist/config/conf2.xml @@ -73,8 +73,10 @@ - - + + + + diff --git a/exist-parent/pom.xml b/exist-parent/pom.xml index 733d5b8fa92..8e58a6e1555 100644 --- a/exist-parent/pom.xml +++ b/exist-parent/pom.xml @@ -120,7 +120,6 @@ 1.8.1.3-jakarta5 2.1.3 9.9.1-8 - 2.7.3 5.2.3 2.10.0 4.13.2 From 32e1d62c2d22588f448e85c3d8a89a7f1a809e73 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 8 Dec 2022 16:03:18 +0000 Subject: [PATCH 2/5] [refactor] Update the Spatial Index to use the latest version of GeoTools (chasing out a dependency on Xalan) --- extensions/indexes/spatial/pom.xml | 46 ++++++------------- .../spatial/AbstractGMLJDBCIndexWorker.java | 10 ++-- .../indexing/spatial/GMLHSQLIndexWorker.java | 4 +- .../modules/spatial/FunGMLProducers.java | 8 ++-- .../spatial/FunGeometricProperties.java | 6 +-- .../modules/spatial/FunSpatialSearch.java | 2 +- .../exist/indexing/spatial/GMLIndexTest.java | 2 +- 7 files changed, 30 insertions(+), 48 deletions(-) diff --git a/extensions/indexes/spatial/pom.xml b/extensions/indexes/spatial/pom.xml index 3fa857eebee..b26b6d1ce67 100644 --- a/extensions/indexes/spatial/pom.xml +++ b/extensions/indexes/spatial/pom.xml @@ -46,7 +46,7 @@ - 2.4.5 + 28.5 @@ -60,20 +60,14 @@ org.apache.logging.log4j log4j-api - - - org.opengis - geoapi-nogenerics - 2.1.1 - org.geotools - gt2-api + gt-main ${geotools.version} org.geotools - gt2-main + gt-opengis ${geotools.version} @@ -94,30 +88,13 @@ org.geotools - gt2-referencing + gt-referencing ${geotools.version} - - com.vividsolutions - jts - 1.13 + org.geotools + gt-xml + ${geotools.version} org.hsqldb @@ -125,10 +102,15 @@ 2.7.1 + + org.locationtech.jts + jts-core + 1.19.0 + org.geotools - gt2-epsg-wkt + gt-epsg-wkt ${geotools.version} runtime @@ -188,7 +170,7 @@ true - org.geotools:gt2-epsg-wkt:jar:${geotools.version} + org.geotools:gt-epsg-wkt:jar:${geotools.version} org.hsqldb:hsqldb:jar java3d:vecmath:jar:1.3.1 javax.media:jai_core:jar:1.1.3 diff --git a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java index 224093ead5f..83993d7899d 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java @@ -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; diff --git a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/GMLHSQLIndexWorker.java b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/GMLHSQLIndexWorker.java index c1ad96efde7..748b5a8763b 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/GMLHSQLIndexWorker.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/GMLHSQLIndexWorker.java @@ -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; diff --git a/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGMLProducers.java b/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGMLProducers.java index f6bc852b8f5..539943b34fd 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGMLProducers.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGMLProducers.java @@ -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 Pierrick Brihaye diff --git a/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGeometricProperties.java b/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGeometricProperties.java index 5447d9e2aa3..7c1218a01d1 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGeometricProperties.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunGeometricProperties.java @@ -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 Pierrick Brihaye diff --git a/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunSpatialSearch.java b/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunSpatialSearch.java index fa52cd2f473..24c6172acea 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunSpatialSearch.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/xquery/modules/spatial/FunSpatialSearch.java @@ -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 Pierrick Brihaye diff --git a/extensions/indexes/spatial/src/test/java/org/exist/indexing/spatial/GMLIndexTest.java b/extensions/indexes/spatial/src/test/java/org/exist/indexing/spatial/GMLIndexTest.java index 1fa33f2821a..cd590b64528 100644 --- a/extensions/indexes/spatial/src/test/java/org/exist/indexing/spatial/GMLIndexTest.java +++ b/extensions/indexes/spatial/src/test/java/org/exist/indexing/spatial/GMLIndexTest.java @@ -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.*; From 44165afc83158c0afdee25cad4d4402e9c7932fd Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Sun, 5 Feb 2023 22:47:22 +0000 Subject: [PATCH 3/5] [feature] Spatial Index Tests can now run on JDK 9 and newer --- extensions/indexes/spatial/pom.xml | 33 ------------------------------ 1 file changed, 33 deletions(-) diff --git a/extensions/indexes/spatial/pom.xml b/extensions/indexes/spatial/pom.xml index b26b6d1ce67..992fa43f006 100644 --- a/extensions/indexes/spatial/pom.xml +++ b/extensions/indexes/spatial/pom.xml @@ -205,42 +205,9 @@ - - - org.apache.maven.plugins - maven-surefire-plugin - - - true - - - - - test-java8 - - 1.8 - - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - - - osgeo From 981014be56a6afe886d44fd1587ef5fc28415c79 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Mon, 6 Feb 2023 12:01:37 +0000 Subject: [PATCH 4/5] [bugfix] Set GmlTransformer options --- .../indexing/spatial/AbstractGMLJDBCIndexWorker.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java index 83993d7899d..a98ba976052 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java @@ -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; @@ -111,7 +112,7 @@ public abstract class AbstractGMLJDBCIndexWorker implements IndexWorker { protected TreeMap 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(); @@ -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() { From becb0f9c65f7414577c4d82f9eb8d59b7db6182c Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 10 Oct 2024 13:23:34 +0200 Subject: [PATCH 5/5] [refactor] Update the Spatial Index to use the latest version of GeoTools (that includes my fixes for Saxon use) --- extensions/indexes/spatial/pom.xml | 16 +++------------- .../spatial/AbstractGMLJDBCIndexWorker.java | 8 ++++---- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/extensions/indexes/spatial/pom.xml b/extensions/indexes/spatial/pom.xml index 992fa43f006..84d4e914572 100644 --- a/extensions/indexes/spatial/pom.xml +++ b/extensions/indexes/spatial/pom.xml @@ -46,7 +46,7 @@ - 28.5 + 32.0 @@ -62,23 +62,13 @@ org.geotools - gt-main + gt-api ${geotools.version} org.geotools - gt-opengis + gt-main ${geotools.version} - - - jdom - jdom - - - commons-beanutils - commons-beanutils - - org.jdom diff --git a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java index a98ba976052..80e1f70a908 100644 --- a/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java +++ b/extensions/indexes/spatial/src/main/java/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java @@ -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;