diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d948d03987e3a56bfb03d0f0fc8ec55fdf66e63b..5f1a7265a5d7b9ca53ff3a881350c90d360807d6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,7 +3,7 @@ stages:
run tests in branches:
stage: build
- image: maven:3-jdk-8
+ image: maven:3-openjdk-11
script:
- MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn" mvn test -B -U
except:
@@ -12,7 +12,7 @@ run tests in branches:
publish maven snapshot artifacts:
stage: build
- image: maven:3-jdk-8
+ image: maven:3-openjdk-11
before_script:
- echo "${GPG_KEY_SECRET}" | gpg --batch --import
- gpg --list-keys
@@ -23,7 +23,7 @@ publish maven snapshot artifacts:
publish maven artifacts:
stage: build
- image: maven:3-jdk-8
+ image: maven:3-openjdk-11
before_script:
- echo "${GPG_KEY_SECRET}" | gpg --batch --import
- gpg --list-keys
diff --git a/genesys-geotools/pom.xml b/genesys-geotools/pom.xml
index be24e6dcfe29becaaf011fa8e6714a6323287605..91745d29bd9677a930bca56a9f1e6428a67a86f8 100644
--- a/genesys-geotools/pom.xml
+++ b/genesys-geotools/pom.xml
@@ -3,7 +3,7 @@
org.genesys-pgr
geo-tools
- 1.1-SNAPSHOT
+ 3.0-SNAPSHOT
genesys-geotools
Genesys Geo Tools library
@@ -38,10 +38,10 @@
UTF-8
- 1.8
- 1.8
+ 11
+ 11
- 23.1
+ 24.1
org.genesys.geotools.cli.CLI
@@ -49,12 +49,12 @@
org.slf4j
slf4j-api
- 1.7.21
+ 1.7.30
org.apache.commons
commons-lang3
- 3.3.2
+ 3.11
org.geotools
@@ -74,7 +74,7 @@
com.google.guava
guava
- 19.0
+ 30.1-jre
@@ -82,7 +82,7 @@
junit
junit
- 4.12
+ 4.13.1
test
diff --git a/genesys-geotools/src/main/java/org/genesys/geotools/service/CountryOfOriginService.java b/genesys-geotools/src/main/java/org/genesys/geotools/service/CountryOfOriginService.java
index 13454c6d82dbf411250786cbf6acbac75688dade..b807cfa34226896d0b91060c2a3877b292c60923 100644
--- a/genesys-geotools/src/main/java/org/genesys/geotools/service/CountryOfOriginService.java
+++ b/genesys-geotools/src/main/java/org/genesys/geotools/service/CountryOfOriginService.java
@@ -40,7 +40,7 @@ public interface CountryOfOriginService {
* @param latitude the latitude
* @param origCty the country ISO code
* @return distance to closest point on country border or -1 if not found
- * @throws Exception
+ * @throws Exception the exception
*/
double distanceToBorder(float longitude, float latitude, String origCty) throws Exception;
diff --git a/genesys-geotools/src/main/java/org/genesys/geotools/service/LandOrSeaService.java b/genesys-geotools/src/main/java/org/genesys/geotools/service/LandOrSeaService.java
index 5ec1fe3f748046819ceb6445e7588860ecbf3e63..53d3265a7745c60530d825d54369f9d686760292 100644
--- a/genesys-geotools/src/main/java/org/genesys/geotools/service/LandOrSeaService.java
+++ b/genesys-geotools/src/main/java/org/genesys/geotools/service/LandOrSeaService.java
@@ -37,9 +37,9 @@ public interface LandOrSeaService {
*
* @param longitude the longitude
* @param latitude the latitude
- * @param allowedDistanceFromLand the allowed distance from land
+ * @param allowedDistanceMargin the allowed distance from land
* @return Land, Coastal or Water
- * @throws Exception
+ * @throws Exception the exception
*/
String classifyLocation(float longitude, float latitude, int allowedDistanceMargin) throws Exception;
diff --git a/genesys-geotools/src/main/java/org/genesys/geotools/service/ShapefileUtils.java b/genesys-geotools/src/main/java/org/genesys/geotools/service/ShapefileUtils.java
index e1b101eaf71dbb547c769a73744f32f07b1857c0..f7bb6b56480b729c51fbdcd9f047c46ffa89ea5a 100644
--- a/genesys-geotools/src/main/java/org/genesys/geotools/service/ShapefileUtils.java
+++ b/genesys-geotools/src/main/java/org/genesys/geotools/service/ShapefileUtils.java
@@ -51,7 +51,7 @@ public class ShapefileUtils {
/**
* Open shape file.
*
- * @param shapeFilePath the shape file path
+ * @param shapeFile the shape file
* @return the data store
* @throws MalformedURLException the malformed url exception
* @throws IOException Signals that an I/O exception has occurred.
diff --git a/geotools-cli/pom.xml b/geotools-cli/pom.xml
index a4ae8285dfa09265538b475421287d9ebb2ebcf3..4c99c7493ca6f859ee518462d4b1cff12da598b2 100644
--- a/geotools-cli/pom.xml
+++ b/geotools-cli/pom.xml
@@ -3,7 +3,7 @@
org.genesys-pgr
geo-tools
- 1.1-SNAPSHOT
+ 3.0-SNAPSHOT
geotools-cli
Genesys Geo Tools
@@ -38,10 +38,8 @@
UTF-8
- 1.8
- 1.8
-
- 15-SNAPSHOT
+ 11
+ 11
org.genesys.geotools.cli.CLI
@@ -49,29 +47,24 @@
org.slf4j
slf4j-log4j12
- 1.7.21
+ 1.7.30
org.genesys-pgr
genesys-geotools
- 1.1-SNAPSHOT
+ 3.0-SNAPSHOT
-
com.opencsv
opencsv
- 3.6
+ 5.3
junit
junit
- 4.12
+ 4.13.1
test
diff --git a/geotools-cli/src/main/java/org/genesys/geotools/cli/CSV2KML.java b/geotools-cli/src/main/java/org/genesys/geotools/cli/CSV2KML.java
index 748b315e1a76838922d7c2980ff1826528d14582..570f4354d6a8d16cba5bda0085307db644a10a29 100644
--- a/geotools-cli/src/main/java/org/genesys/geotools/cli/CSV2KML.java
+++ b/geotools-cli/src/main/java/org/genesys/geotools/cli/CSV2KML.java
@@ -16,10 +16,15 @@
package org.genesys.geotools.cli;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import com.opencsv.CSVParser;
+import com.opencsv.CSVParserBuilder;
import com.opencsv.CSVReader;
+import com.opencsv.CSVReaderBuilder;
+import com.opencsv.exceptions.CsvValidationException;
/**
* Generate a KML/KMZ file from CSV data.
@@ -40,43 +45,48 @@ public class CSV2KML {
final int columnLongitude = 3;
final int columnOrigCty = 5;
- final CSVReader reader = new CSVReader(new InputStreamReader(System.in), ',', '"', '\\', 0, false);
+ final CSVParser parser = new CSVParserBuilder().withSeparator(',').withQuoteChar('"').withEscapeChar('\\').withIgnoreQuotations(false).build();
+ final CSVReader reader = new CSVReaderBuilder(new BufferedReader(new InputStreamReader(System.in))).withCSVParser(parser).withSkipLines(0).build();
System.out.println("");
System.out.println("");
System.out.println("");
String[] nextLine;
- while ((nextLine = reader.readNext()) != null) {
- try {
- final String acceNumb = nextLine[columnAcceNumb].trim();
- final String remarks = nextLine[nextLine.length - 1].trim();
- final String origCty = nextLine[columnOrigCty].trim();
- final float latitude = Float.parseFloat(nextLine[columnLatitude].trim());
- final float longitude = Float.parseFloat(nextLine[columnLongitude].trim());
+ try {
+ while ((nextLine = reader.readNext()) != null) {
+ try {
+ final String acceNumb = nextLine[columnAcceNumb].trim();
+ final String remarks = nextLine[nextLine.length - 1].trim();
+ final String origCty = nextLine[columnOrigCty].trim();
+ final float latitude = Float.parseFloat(nextLine[columnLatitude].trim());
+ final float longitude = Float.parseFloat(nextLine[columnLongitude].trim());
- System.out.println("");
- System.out.print("");
- System.out.print(nextLine[columnInstCode].trim());
- System.out.print(": ");
- System.out.print(acceNumb);
- if (origCty != null)
- System.out.print(" " + origCty);
- System.out.println("");
- System.out.print("");
- System.out.print("https://www.genesys-pgr.org/acn/id/" + nextLine[columnGenesysId].trim());
- if (remarks != null)
- System.out.print("\n" + remarks);
- System.out.println("");
- System.out.println("");
- System.out.print(longitude);
- System.out.print(",");
- System.out.print(latitude);
- System.out.println("");
- System.out.println("");
- } catch (final NumberFormatException e) {
- System.err.println(e.getMessage());
+ System.out.println("");
+ System.out.print("");
+ System.out.print(nextLine[columnInstCode].trim());
+ System.out.print(": ");
+ System.out.print(acceNumb);
+ if (origCty != null)
+ System.out.print(" " + origCty);
+ System.out.println("");
+ System.out.print("");
+ System.out.print("https://www.genesys-pgr.org/acn/id/" + nextLine[columnGenesysId].trim());
+ if (remarks != null)
+ System.out.print("\n" + remarks);
+ System.out.println("");
+ System.out.println("");
+ System.out.print(longitude);
+ System.out.print(",");
+ System.out.print(latitude);
+ System.out.println("");
+ System.out.println("");
+ } catch (final NumberFormatException e) {
+ System.err.println(e.getMessage());
+ }
}
+ } catch (CsvValidationException e) {
+ throw new IOException(e.getMessage(), e);
}
System.out.println("");
System.out.println("");
diff --git a/geotools-cli/src/main/java/org/genesys/geotools/cli/CountryCLI.java b/geotools-cli/src/main/java/org/genesys/geotools/cli/CountryCLI.java
index 22ca4d15f212610b40e6114cb5e255439e21b8ec..22ce1506fcedfdaf818e89b7a76ca204fddcc401 100644
--- a/geotools-cli/src/main/java/org/genesys/geotools/cli/CountryCLI.java
+++ b/geotools-cli/src/main/java/org/genesys/geotools/cli/CountryCLI.java
@@ -34,6 +34,10 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.opencsv.CSVParser;
+import com.opencsv.CSVParserBuilder;
+import com.opencsv.CSVReaderBuilder;
+import com.opencsv.exceptions.CsvValidationException;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
@@ -99,8 +103,8 @@ public class CountryCLI implements GeoTool {
public void execute(final InputStream input, final OutputStream output, final char separatorChar, final char quoteChar,
final char escapeChar) throws IOException {
- try (CSVReader reader = new CSVReader(new BufferedReader(new InputStreamReader(input), 10000), separatorChar, quoteChar, escapeChar, 0,
- false)) {
+ final CSVParser parser = new CSVParserBuilder().withSeparator(separatorChar).withQuoteChar(quoteChar).withEscapeChar(escapeChar).withIgnoreQuotations(false).build();
+ try (CSVReader reader = new CSVReaderBuilder(new BufferedReader(new InputStreamReader(input), 10000)).withCSVParser(parser).withSkipLines(0).build()) {
// Scan for headers
final String[] headers = reader.readNext();
@@ -249,6 +253,8 @@ public class CountryCLI implements GeoTool {
countryOfOriginService.printCache();
}
+ } catch (CsvValidationException e) {
+ throw new IOException(e.getMessage(), e);
}
}
}
diff --git a/geotools-cli/src/main/java/org/genesys/geotools/cli/LandOrSeaCLI.java b/geotools-cli/src/main/java/org/genesys/geotools/cli/LandOrSeaCLI.java
index a6905db9078ea4e8fb4b7a0f31b1cc03071a6202..1a61808e5082c69e8eb6679d8740ec44b9fea507 100644
--- a/geotools-cli/src/main/java/org/genesys/geotools/cli/LandOrSeaCLI.java
+++ b/geotools-cli/src/main/java/org/genesys/geotools/cli/LandOrSeaCLI.java
@@ -29,6 +29,10 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.opencsv.CSVParser;
+import com.opencsv.CSVParserBuilder;
+import com.opencsv.CSVReaderBuilder;
+import com.opencsv.exceptions.CsvValidationException;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.genesys.geotools.service.HeaderUtils;
@@ -111,8 +115,8 @@ public class LandOrSeaCLI implements GeoTool {
public void execute(final InputStream input, final OutputStream output, final char separatorChar, final char quoteChar,
final char escapeChar) throws IOException {
- try (CSVReader reader = new CSVReader(new BufferedReader(new InputStreamReader(input), 10000), separatorChar, quoteChar, escapeChar, 0,
- false)) {
+ final CSVParser parser = new CSVParserBuilder().withSeparator(separatorChar).withQuoteChar(quoteChar).withEscapeChar(escapeChar).withIgnoreQuotations(false).build();
+ try (CSVReader reader = new CSVReaderBuilder(new BufferedReader(new InputStreamReader(input), 10000)).withCSVParser(parser).withSkipLines(0).build()) {
// Scan for headers
final String[] headers = reader.readNext();
@@ -181,6 +185,8 @@ public class LandOrSeaCLI implements GeoTool {
writer.writeNext(outputLine);
}
}
+ } catch (CsvValidationException e) {
+ throw new IOException(e.getMessage(), e);
}
}
}
diff --git a/pom.xml b/pom.xml
index a401d3689027006653305c2b250482b27505da00..c91ea8a3665d435ca2073f74b56bb99b3d9f7ddc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
4.0.0
org.genesys-pgr
geo-tools
- 1.1-SNAPSHOT
+ 3.0-SNAPSHOT
pom
Genesys GEO tools
https://gitlab.croptrust.org/genesys-pgr/geo-tools
@@ -63,8 +63,8 @@
UTF-8
- 1.8
- 1.8
+ 11
+ 11
1.6