This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 5cd95574c41d4f1312cd3b308c556d8cacf23702 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Feb 10 20:31:11 2022 +0100 Avoid a NullPointerException. This is a temporary fix will waiting a better fix of https://issues.apache.org/jira/browse/SIS-536 --- .../src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java index c62e197..ae9503c 100644 --- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java +++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java @@ -833,7 +833,11 @@ final class CRSBuilder extends ReferencingFactoryContainer { * CommonCRS. We use the CRS name given in the GeoTIFF file for that purpose, exploiting the * fact that it is often a name that can be mapped to a CommonCRS name like "WGS84". */ - String name = getOrDefault(names, DATUM); + String name = getOrDefault(names, DATUM); + if (name == null) { + // TODO: see https://issues.apache.org/jira/browse/SIS-536 + throw new NoSuchElementException(missingValue(GeoKeys.GeogCitation)); + } final Ellipsoid ellipsoid = createEllipsoid(names, linearUnit); final PrimeMeridian meridian = createPrimeMeridian(names, angularUnit); final GeodeticDatum datum = getDatumFactory().createGeodeticDatum(properties(name), ellipsoid, meridian);