sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1730020 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing: AuthorityFactories.java CommonCRS.java
Date Fri, 12 Feb 2016 13:17:33 GMT
Author: desruisseaux
Date: Fri Feb 12 13:17:33 2016
New Revision: 1730020

URL: http://svn.apache.org/viewvc?rev=1730020&view=rev
Log:
Log warnings only once for CommonCRS too.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java?rev=1730020&r1=1730019&r2=1730020&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
[UTF-8] Fri Feb 12 13:17:33 2016
@@ -142,6 +142,22 @@ final class AuthorityFactories<T extends
     }
 
     /**
+     * Notifies that a factory is unavailable, but without giving a fallback and without
logging.
+     * The caller is responsible for logging a warning and to provide its own fallback.
+     */
+    static void failure(final UnavailableFactoryException e) {
+        if (!(e.getCause() instanceof SQLTransientException)) {
+            final AuthorityFactory unavailable = e.getUnavailableFactory();
+            synchronized (EPSG) {
+                if (unavailable == EPSG[0]) {
+                    ALL.reload();
+                    EPSG[0] = EPSGFactoryFallback.INSTANCE;
+                }
+            }
+        }
+    }
+
+    /**
      * Logs the given exception at the given level. This method pretends that the logging
come from
      * {@link CRS#getAuthorityFactory(String)}, which is the public facade for {@link #EPSG()}.
      */

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1730020&r1=1730019&r2=1730020&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
[UTF-8] Fri Feb 12 13:17:33 2016
@@ -57,6 +57,7 @@ import org.apache.sis.referencing.crs.De
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultGeocentricCRS;
+import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.referencing.provider.TransverseMercator;
 import org.apache.sis.internal.referencing.Formulas;
@@ -1537,6 +1538,9 @@ public enum CommonCRS {
      * After invoking this method, the caller will fallback on hard-coded values.
      */
     static void failure(final Object caller, final String method, final FactoryException
e) {
+        if (e instanceof UnavailableFactoryException) {
+            AuthorityFactories.failure((UnavailableFactoryException) e);
+        }
         Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), caller.getClass(),
method, e);
     }
 }



Mime
View raw message