sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1769348 - /sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
Date Fri, 11 Nov 2016 21:42:33 GMT
Author: desruisseaux
Date: Fri Nov 11 21:42:33 2016
New Revision: 1769348

URL: http://svn.apache.org/viewvc?rev=1769348&view=rev
Log:
GeoTiffStore does not need to check for null CRS. Add a comment explaining why.

Modified:
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1769348&r1=1769347&r2=1769348&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
[UTF-8] Fri Nov 11 21:42:33 2016
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.nio.charset.Charset;
 import java.util.logging.LogRecord;
 import java.nio.charset.StandardCharsets;
+import org.opengis.util.FactoryException;
 import org.opengis.metadata.Metadata;
 import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.DataStore;
@@ -31,8 +32,6 @@ import org.apache.sis.internal.storage.C
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Classes;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.util.FactoryException;
 
 
 /**
@@ -105,15 +104,12 @@ public class GeoTiffStore extends DataSt
             while ((dir = reader.getImageFileDirectory(n++)) != null) {
                 dir.completeMetadata(reader.metadata, locale);
             }
-
-            //-- add geotiff CRS if exist
-            //-- tiff image may not contain any CRS.
-            {
-                final CoordinateReferenceSystem crs = reader.crsBuilder.build();
-                //-- add if exist
-                if (crs != null) reader.metadata.add(crs);
-            }
-
+            /*
+             * Add Coordinate Reference System built from GeoTIFF tags.  Note that the CRS
may not exist,
+             * in which case the CRS builder returns null. This is safe since all MetadataBuilder
methods
+             * ignore null values (a design choice because this pattern come very often).
+             */
+            reader.metadata.add(reader.crsBuilder.build());
             metadata = reader.metadata.build(true);
         } catch (IOException e) {
             throw new DataStoreException(reader.errors().getString(Errors.Keys.CanNotRead_1,
reader.input.filename), e);



Mime
View raw message