You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2023/09/30 16:05:25 UTC

[sis] 03/05: When the "gr3df97a.txt" datum shift grid file is not found, the exception should be `MissingFactoryResourceException` instead of `FactoryDataException`.

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 32d7c5d57acb9d0c973a938cba7266d2c1bb6d80
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Sep 30 16:02:22 2023 +0200

    When the "gr3df97a.txt" datum shift grid file is not found,
    the exception should be `MissingFactoryResourceException`
    instead of `FactoryDataException`.
---
 .../org/apache/sis/referencing/factory/FactoryDataException.java     | 5 ++++-
 .../sis/referencing/factory/MissingFactoryResourceException.java     | 1 +
 .../sis/referencing/operation/provider/DatumShiftGridLoader.java     | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/FactoryDataException.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/FactoryDataException.java
index d79afb6e17..f5038ff681 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/FactoryDataException.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/FactoryDataException.java
@@ -27,7 +27,10 @@ import org.opengis.util.FactoryException;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.2
- * @since   0.7
+ *
+ * @see MissingFactoryResourceException
+ *
+ * @since 0.7
  */
 public class FactoryDataException extends FactoryException {
     /**
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MissingFactoryResourceException.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MissingFactoryResourceException.java
index 470d50d21c..86b4dd1ea0 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MissingFactoryResourceException.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MissingFactoryResourceException.java
@@ -35,6 +35,7 @@ import org.opengis.util.FactoryException;
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.7
  *
+ * @see FactoryDataException
  * @see ConcurrentAuthorityFactory#newDataAccess()
  *
  * @since 0.7
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/DatumShiftGridLoader.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/DatumShiftGridLoader.java
index 6b6d2580d7..bc03ecc036 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/DatumShiftGridLoader.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/DatumShiftGridLoader.java
@@ -21,6 +21,7 @@ import java.util.logging.LogRecord;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.io.EOFException;
 import java.io.IOException;
+import java.io.FileNotFoundException;
 import java.nio.ByteBuffer;
 import java.net.URI;
 import java.nio.file.Path;
@@ -235,7 +236,7 @@ abstract class DatumShiftGridLoader {
                 Logging.completeAndLog(AbstractProvider.LOGGER, DatumShiftGridLoader.class, "readGrid", record);
             }
         }
-        final boolean notFound = (cause instanceof NoSuchFileException);
+        final boolean notFound = (cause instanceof NoSuchFileException) || (cause instanceof FileNotFoundException);
         final String message = Resources.format(notFound ? Resources.Keys.FileNotFound_2
                                                          : Resources.Keys.FileNotReadable_2, format, file);
         if (notFound) {