Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private void checkPosition(Position pos) {
crsTransformerFilterToNative.ifPresent(
t -> {
CoordinateTuple transformed = t.transform(pos.x(), pos.y());
if (Objects.isNull(transformed)) {
// a failed transform yields a tuple with isNull()=true, not a null reference
if (Objects.isNull(transformed) || transformed.isNull()) {
throw new IllegalArgumentException(
String.format(
"Filter is invalid. Coordinate '%s' cannot be transformed to %s.",
Expand All @@ -164,7 +165,7 @@ private void checkPosition(Position pos) {
Position posCrs84 = pos;
if (crsTransformerFilterToCrs84.isPresent()) {
CoordinateTuple transformed = crsTransformerFilterToCrs84.get().transform(pos.x(), pos.y());
if (Objects.nonNull(transformed)) {
if (Objects.nonNull(transformed) && !transformed.isNull()) {
posCrs84 = Position.ofXY(transformed.getX(), transformed.getY());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CqlCoordinateCheckerSpec extends Specification {

xCoordinate | yCoordinate | spatialLiteral | ex
(double) 8.00 | (double) 5 | LineString.of(new double[]{xCoordinate, yCoordinate, xCoordinate, yCoordinate}) | IllegalArgumentException
(double) 0.50 | (double) 1000 | LineString.of(new double[]{xCoordinate, yCoordinate, xCoordinate, yCoordinate}) | NullPointerException
(double) 0.50 | (double) 1000 | LineString.of(new double[]{xCoordinate, yCoordinate, xCoordinate, yCoordinate}) | IllegalArgumentException

}

Expand All @@ -241,7 +241,7 @@ class CqlCoordinateCheckerSpec extends Specification {

xCoordinate | yCoordinate | spatialLiteral | ex
(double) 11.00 | (double) 56.00 | MultiPoint.of(List.of(Point.of(xCoordinate, yCoordinate))) | IllegalArgumentException
(double) 0.50 | (double) 1000 | MultiPoint.of(List.of(Point.of(xCoordinate, yCoordinate))) | NullPointerException
(double) 0.50 | (double) 1000 | MultiPoint.of(List.of(Point.of(xCoordinate, yCoordinate))) | IllegalArgumentException

}

Expand Down Expand Up @@ -269,7 +269,7 @@ class CqlCoordinateCheckerSpec extends Specification {

xCoordinate1 | yCoordinate1 | xCoordinate2 | yCoordinate2 | spatialLiteral | ex
(double) 8.00 | (double) 5 | (double) 4.40 | (double) 51.00 | MultiLineString.of(List.of(LineString.of(xCoordinate1, yCoordinate1, xCoordinate2, yCoordinate2))) | IllegalArgumentException
(double) 0.50 | (double) 1000 | (double) 0.03 | (double) 1 | MultiLineString.of(List.of(LineString.of(xCoordinate1, yCoordinate1, xCoordinate2, yCoordinate2))) | NullPointerException
(double) 0.50 | (double) 1000 | (double) 0.03 | (double) 1 | MultiLineString.of(List.of(LineString.of(xCoordinate1, yCoordinate1, xCoordinate2, yCoordinate2))) | IllegalArgumentException

}

Expand Down Expand Up @@ -299,7 +299,7 @@ class CqlCoordinateCheckerSpec extends Specification {

xCoordinate1 | yCoordinate1 | xCoordinate2 | yCoordinate2 | xCoordinate3 | yCoordinate3 | xCoordinate4 | yCoordinate4 | ex
(double) 8.00 | (double) 5 | (double) 4.40 | (double) 51.00 | (double) 8.00 | (double) 5 | (double) 4.40 | (double) 51.00 | IllegalArgumentException
(double) 0.50 | (double) 1000 | (double) 0.03 | (double) 1 | (double) 0.00 | (double) 100000 | (double) 0.03 | (double) 1 | NullPointerException
(double) 0.50 | (double) 1000 | (double) 0.03 | (double) 1 | (double) 0.00 | (double) 100000 | (double) 0.03 | (double) 1 | IllegalArgumentException

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ default Force getForceAxisOrder() {
@Value.Auxiliary
Optional<String> getUriOverride();

/**
* An alternative identifier under which this CRS is known in a community (e.g. the AdV identifier
* {@code urn:adv:crs:ETRS89_UTM32} for EPSG:25832), declared on the entries of the {@code
* additionalCrs} option of the CRS building block. Unlike {@link #getUriOverride()} — which
* echoes the identifier a request used — the alternative URI is only used when a feature encoding
* renders CRS identifiers on the wire (e.g. the GML {@code srsName} with {@code srsNameStyle:
* TEMPLATE}) and when decoding such identifiers on input. Auxiliary, i.e., excluded from {@code
* equals()}/{@code hashCode()}: instances differing only in this attribute represent the same
* CRS.
*/
@Value.Auxiliary
Optional<String> getAlternativeUri();

@JsonIgnore
@Value.Lazy
default boolean isCompoundCrs() {
Expand Down
Loading
Loading