Skip to content

Commit

Permalink
Merge pull request #794 from lonvia/update-jts-library
Browse files Browse the repository at this point in the history
Update jts and slf dependencies to latest version
  • Loading branch information
lonvia authored Apr 23, 2024
2 parents 15d9a70 + 9bd71c2 commit 447e0bd
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 79 deletions.
17 changes: 8 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,26 @@ sourceSets {

dependencies {
implementation('org.elasticsearch:elasticsearch:5.6.16') {
exclude(module: 'log4j-api')
exclude(module: 'log4j-api')
}
implementation 'org.elasticsearch.plugin:transport-netty4-client:5.6.16'
implementation 'org.apache.logging.log4j:log4j-core:2.22.0'
implementation 'org.apache.logging.log4j:log4j-api:2.22.0'
implementation 'org.apache.logging.log4j:log4j-core:2.23.1'
implementation 'org.apache.logging.log4j:log4j-api:2.23.1'
implementation('org.elasticsearch.client:transport:5.6.16') {
exclude(module: 'commons-logging')
exclude(module: 'commons-logging')
}
implementation 'org.postgresql:postgresql:42.7.2'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.22.0'
implementation 'org.slf4j:slf4j-api:2.0.13'
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.23.1'
implementation 'com.beust:jcommander:1.82'
implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation 'org.springframework:spring-jdbc:5.3.32'
implementation('org.apache.commons:commons-dbcp2:2.12.0') {
exclude(module: 'commons-logging')
}
implementation 'com.vividsolutions:jts:1.13'
implementation 'org.locationtech.jts:jts-core:1.19.0'
implementation 'com.sparkjava:spark-core:2.9.4'
implementation 'net.postgis:postgis-jdbc:2.5.0'
implementation 'net.postgis:postgis-jdbc-jtsparser:2.2.2'
implementation 'net.postgis:postgis-jdbc:2023.1.0'
implementation 'org.json:json:20240303'

testImplementation(platform("org.junit:junit-bom:5.10.2"))
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/komoot/photon/PhotonDoc.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.komoot.photon;

import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.nominatim.model.AddressType;
import org.slf4j.Logger;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/komoot/photon/Utils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon;

import com.vividsolutions.jts.geom.Envelope;
import org.locationtech.jts.geom.Envelope;
import de.komoot.photon.nominatim.model.AddressType;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.elasticsearch;

import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.query.ReverseRequest;
import de.komoot.photon.searcher.PhotonResult;
import de.komoot.photon.searcher.ReverseHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.komoot.photon.elasticsearch;


import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.searcher.TagFilter;
import org.elasticsearch.common.lucene.search.function.CombineFunction;
import org.elasticsearch.common.lucene.search.function.FiltersFunctionScoreQuery.ScoreMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.elasticsearch;

import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.searcher.TagFilter;
import org.elasticsearch.common.unit.DistanceUnit;
import org.elasticsearch.index.query.BoolQueryBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.nominatim;

import com.vividsolutions.jts.geom.Geometry;
import org.locationtech.jts.geom.Geometry;
import org.springframework.jdbc.core.JdbcTemplate;

import java.sql.ResultSet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package de.komoot.photon.nominatim;

import com.vividsolutions.jts.geom.Geometry;
import org.locationtech.jts.geom.Geometry;
import de.komoot.photon.Importer;
import de.komoot.photon.PhotonDoc;
import de.komoot.photon.nominatim.model.AddressRow;
import de.komoot.photon.nominatim.model.AddressType;
import org.apache.commons.dbcp2.BasicDataSource;
import org.postgis.jts.JtsWrapper;
import org.slf4j.Logger;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
Expand Down Expand Up @@ -152,12 +151,11 @@ public NominatimConnector(String host, int port, String database, String usernam
static BasicDataSource buildDataSource(String host, int port, String database, String username, String password, boolean autocommit) {
BasicDataSource dataSource = new BasicDataSource();

dataSource.setUrl(String.format("jdbc:postgres_jts://%s:%d/%s", host, port, database));
dataSource.setUrl(String.format("jdbc:postgresql://%s:%d/%s", host, port, database));
dataSource.setUsername(username);
if (password != null) {
dataSource.setPassword(password);
}
dataSource.setDriverClassName(JtsWrapper.class.getCanonicalName());
dataSource.setDefaultAutoCommit(autocommit);
return dataSource;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/komoot/photon/nominatim/NominatimResult.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package de.komoot.photon.nominatim;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.linearref.LengthIndexedLine;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.linearref.LengthIndexedLine;
import de.komoot.photon.PhotonDoc;

import java.util.*;
Expand Down
21 changes: 15 additions & 6 deletions src/main/java/de/komoot/photon/nominatim/PostgisDataAdapter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package de.komoot.photon.nominatim;

import com.vividsolutions.jts.geom.Geometry;
import org.postgis.jts.JtsGeometry;
import net.postgis.jdbc.PGgeometry;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;

Expand All @@ -27,11 +29,18 @@ public Map<String, String> getMap(ResultSet rs, String columnName) throws SQLExc

@Override
public Geometry extractGeometry(ResultSet rs, String columnName) throws SQLException {
JtsGeometry geom = (JtsGeometry) rs.getObject(columnName);
if (geom == null) {
return null;
PGgeometry wkt = (PGgeometry) rs.getObject(columnName);
if (wkt != null) {
try {
StringBuffer sb = new StringBuffer();
wkt.getGeometry().outerWKT(sb);
return new WKTReader().read(sb.toString());
} catch (ParseException e) {
// ignore
}
}
return geom.getGeometry();

return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.query;

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

import spark.Request;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.PrecisionModel;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.PrecisionModel;

import spark.Request;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/komoot/photon/query/PhotonRequest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.searcher.TagFilter;

import java.util.*;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/komoot/photon/query/ReverseRequest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.query;

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

import de.komoot.photon.searcher.TagFilter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.searcher.TagFilter;
import spark.QueryParamsMap;
import spark.Request;
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/de/komoot/photon/ESBaseTester.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package de.komoot.photon;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.PrecisionModel;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.PrecisionModel;
import de.komoot.photon.elasticsearch.ElasticTestServer;
import de.komoot.photon.searcher.PhotonResult;
import org.junit.jupiter.api.AfterEach;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/de/komoot/photon/api/ApiLanguagesTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.komoot.photon.api;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Point;

import de.komoot.photon.App;
import de.komoot.photon.ESBaseTester;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package de.komoot.photon.elasticsearch;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.ESBaseTester;
import de.komoot.photon.Importer;
import de.komoot.photon.PhotonDoc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.nominatim;

import com.vividsolutions.jts.io.ParseException;
import org.locationtech.jts.io.ParseException;
import de.komoot.photon.AssertUtil;
import de.komoot.photon.PhotonDoc;
import de.komoot.photon.ReflectionTestUtil;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.komoot.photon.nominatim;

import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import de.komoot.photon.PhotonDoc;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.nominatim.testdb;

import com.vividsolutions.jts.io.ParseException;
import org.locationtech.jts.io.ParseException;
import de.komoot.photon.Importer;
import de.komoot.photon.PhotonDoc;

Expand Down
15 changes: 2 additions & 13 deletions src/test/java/de/komoot/photon/nominatim/testdb/H2DataAdapter.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package de.komoot.photon.nominatim.testdb;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import org.locationtech.jts.geom.Geometry;
import de.komoot.photon.nominatim.DBDataAdapter;
import org.json.JSONObject;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down Expand Up @@ -30,16 +28,7 @@ public Map<String, String> getMap(ResultSet rs, String columnName) throws SQLExc

@Override
public Geometry extractGeometry(ResultSet rs, String columnName) throws SQLException {
String wkt = (String) rs.getObject(columnName);
if (wkt != null) {
try {
return new WKTReader().read(wkt);
} catch (ParseException e) {
// ignore
}
}

return null;
return (Geometry) rs.getObject(columnName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.nominatim.testdb;

import com.vividsolutions.jts.geom.Geometry;
import org.locationtech.jts.geom.Geometry;
import org.springframework.lang.Nullable;

import java.sql.ResultSet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.komoot.photon.nominatim.testdb;

import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import de.komoot.photon.PhotonDoc;
import org.json.JSONObject;
import org.junit.jupiter.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Envelope;
import org.locationtech.jts.geom.Envelope;
import de.komoot.photon.searcher.TagFilter;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Coordinate;
import org.locationtech.jts.geom.Coordinate;
import de.komoot.photon.ESBaseTester;
import de.komoot.photon.Importer;
import de.komoot.photon.PhotonDoc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.ESBaseTester;
import de.komoot.photon.Importer;
import de.komoot.photon.PhotonDoc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import org.junit.jupiter.params.provider.MethodSource;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import static org.junit.jupiter.params.provider.Arguments.arguments;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Point;

import de.komoot.photon.ESBaseTester;
import de.komoot.photon.Importer;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/de/komoot/photon/query/QueryReverseTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.komoot.photon.query;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Point;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Point;
import de.komoot.photon.ESBaseTester;
import de.komoot.photon.Importer;
import de.komoot.photon.searcher.PhotonResult;
Expand Down

0 comments on commit 447e0bd

Please sign in to comment.