Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0AB21200BBE for ; Fri, 11 Nov 2016 22:42:43 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 093A2160AF6; Fri, 11 Nov 2016 21:42:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4E4BF160AEE for ; Fri, 11 Nov 2016 22:42:42 +0100 (CET) Received: (qmail 25170 invoked by uid 500); 11 Nov 2016 21:42:41 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 25161 invoked by uid 99); 11 Nov 2016 21:42:41 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Nov 2016 21:42:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id F10071A8C31 for ; Fri, 11 Nov 2016 21:42:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id h4oKf_cmC_6B for ; Fri, 11 Nov 2016 21:42:40 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 03C745FC95 for ; Fri, 11 Nov 2016 21:42:40 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4E26CE0652 for ; Fri, 11 Nov 2016 21:42:34 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id F30743A19F6 for ; Fri, 11 Nov 2016 21:42:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@sis.apache.org From: desruisseaux@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161111214233.F30743A19F6@svn01-us-west.apache.org> archived-at: Fri, 11 Nov 2016 21:42:43 -0000 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);