sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/02: Replace RuntimeException by GeodeticException where appropriate.
Date Tue, 13 Aug 2019 11:59:24 GMT
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 f2591a4de3454da52c87e0747e7f2c2a84d6ae3d
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Aug 13 13:55:31 2019 +0200

    Replace RuntimeException by GeodeticException where appropriate.
---
 .../apache/sis/internal/referencing/EPSGFactoryProxy.java |  7 ++++---
 .../org/apache/sis/referencing/GeodeticException.java     | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGFactoryProxy.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGFactoryProxy.java
index 5b1efff..b1ea2ef 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGFactoryProxy.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGFactoryProxy.java
@@ -17,7 +17,6 @@
 package org.apache.sis.internal.referencing;
 
 import java.util.Set;
-import org.apache.sis.referencing.CRS;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.CRSAuthorityFactory;
@@ -34,6 +33,8 @@ import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
+import org.apache.sis.referencing.CRS;
+import org.apache.sis.referencing.GeodeticException;
 
 
 /**
@@ -60,7 +61,7 @@ public final class EPSGFactoryProxy implements CRSAuthorityFactory {
         try {
             return factory().getAuthority();
         } catch (FactoryException e) {
-            throw new RuntimeException(e);
+            throw new GeodeticException(e);
         }
     }
 
@@ -69,7 +70,7 @@ public final class EPSGFactoryProxy implements CRSAuthorityFactory {
         try {
             return factory().getVendor();
         } catch (FactoryException e) {
-            throw new RuntimeException(e);
+            throw new GeodeticException(e);
         }
     }
 
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticException.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticException.java
index fdeb297..035f522 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticException.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticException.java
@@ -18,8 +18,10 @@ package org.apache.sis.referencing;
 
 
 /**
- * Thrown when an error occurred while computing geodesic or rhumb line between two points.
- * This exception may have a {@link org.opengis.referencing.operation.TransformException}
as its cause.
+ * Unchecked exception thrown when an error occurred while computing a geodetic value.
+ * This exception may be used in contexts where a checked exception can not be thrown.
+ * This exception typically has a {@link org.opengis.util.FactoryException} or
+ * {@link org.opengis.referencing.operation.TransformException} as its cause.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.0
@@ -52,6 +54,15 @@ public class GeodeticException extends RuntimeException {
     }
 
     /**
+     * Constructs a new exception with the specified cause.
+     *
+     * @param cause  the cause, or {@code null} if none.
+     */
+    public GeodeticException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
      * Constructs a new exception with the specified detail message and cause.
      *
      * @param message  the detail message, or {@code null} if none.


Mime
View raw message