Commit f693ca5b authored by Matija Obreza's avatar Matija Obreza

Better handling of null origCty value

parent 7cd5e683
Pipeline #5203 passed with stage
in 1 minute and 7 seconds
...@@ -22,6 +22,7 @@ import java.net.MalformedURLException; ...@@ -22,6 +22,7 @@ import java.net.MalformedURLException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch; import org.apache.commons.lang3.time.StopWatch;
import org.genesys.geotools.service.CountryOfOriginService; import org.genesys.geotools.service.CountryOfOriginService;
import org.genesys.geotools.service.LonLatCacheKey; import org.genesys.geotools.service.LonLatCacheKey;
...@@ -204,7 +205,7 @@ public class CountryOfOriginServiceImpl implements CountryOfOriginService { ...@@ -204,7 +205,7 @@ public class CountryOfOriginServiceImpl implements CountryOfOriginService {
LOG.debug("Processing time split: " + processingTime); LOG.debug("Processing time split: " + processingTime);
} }
if ((sb.length() == 0) || !sb.toString().contains(origCtyISO)) { if ((sb.length() == 0) || StringUtils.trimToNull(origCtyISO) == null || !sb.toString().contains(origCtyISO)) {
// if (sb.length() > 0) sb.append(", "); // if (sb.length() > 0) sb.append(", ");
// sb.append("???"); // sb.append("???");
// Filter filterBuffered = // Filter filterBuffered =
...@@ -258,6 +259,7 @@ public class CountryOfOriginServiceImpl implements CountryOfOriginService { ...@@ -258,6 +259,7 @@ public class CountryOfOriginServiceImpl implements CountryOfOriginService {
final Point point = geometryFactory.createPoint(coordinate); final Point point = geometryFactory.createPoint(coordinate);
final Filter filterExact = ff.equal(ff.property("ISO3"), ff.literal(origCty), false); final Filter filterExact = ff.equal(ff.property("ISO3"), ff.literal(origCty), false);
LOG.trace("Distance of {} to {}", coordinate, origCty);
try { try {
final FeatureCollection<SimpleFeatureType, SimpleFeature> matchingFeatures = sourceAdmin0.getFeatures(filterExact); final FeatureCollection<SimpleFeatureType, SimpleFeature> matchingFeatures = sourceAdmin0.getFeatures(filterExact);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment