fix previous changes;

add new check;
This commit is contained in:
Skalii 2021-01-08 19:05:02 +02:00
parent 53b3addcb5
commit 3566ec7652

View file

@ -553,14 +553,19 @@ public class GeoPointParserUtil {
} }
if (searchRequest != null) { if (searchRequest != null) {
String searchPattern = Pattern.compile("(?:\\.|,|\\s+|\\+|[+-]?\\d+(?:\\.\\d+)?)").pattern();
String[] search = searchRequest.split(searchPattern);
if (search.length > 0) {
return new GeoParsedPoint(searchRequest);
}
final Matcher positionInSearchRequestMatcher = final Matcher positionInSearchRequestMatcher =
positionPattern.matcher(searchRequest); positionPattern.matcher(searchRequest);
if (lat == 0.0 && lon == 0.0 && positionInSearchRequestMatcher.find()) { if (lat == 0.0 && lon == 0.0 && positionInSearchRequestMatcher.find()) {
lat = Double.valueOf(positionInSearchRequestMatcher.group(1)); double tempLat = Double.valueOf(positionInSearchRequestMatcher.group(1));
lon = Double.valueOf(positionInSearchRequestMatcher.group(2)); double tempLon = Double.valueOf(positionInSearchRequestMatcher.group(2));
if (lat < -90 || lat > 90 || lon < -180 || lon > 180) { if (tempLat >= -90 && tempLat <= 90 && tempLon >= -180 && tempLon <= 180) {
lat = 0.0; lat = tempLat;
lon = 0.0; lon = tempLon;
} }
} }
} }