sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1795673 - /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
Date Sat, 20 May 2017 16:09:37 GMT
Author: desruisseaux
Date: Sat May 20 16:09:37 2017
New Revision: 1795673

URL: http://svn.apache.org/viewvc?rev=1795673&view=rev
Log:
Should preserve the previous state of Semaphores.METADATA_ONLY flag.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1795673&r1=1795672&r2=1795673&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
[UTF-8] Sat May 20 16:09:37 2017
@@ -388,7 +388,7 @@ class CoordinateOperationRegistry {
         }
         final boolean inverse;
         Collection<CoordinateOperation> operations;
-        Semaphores.queryAndSet(Semaphores.METADATA_ONLY);           // See comment for the
same call inside the loop.
+        boolean mdOnly = Semaphores.queryAndSet(Semaphores.METADATA_ONLY);    // See comment
for the same call inside the loop.
         try {
             try {
                 operations = registry.createFromCoordinateReferenceSystemCodes(sourceID,
targetID);
@@ -405,7 +405,9 @@ class CoordinateOperationRegistry {
                     }
                 }
             } finally {
-                Semaphores.clear(Semaphores.METADATA_ONLY);
+                if (!mdOnly) {
+                    Semaphores.clear(Semaphores.METADATA_ONLY);
+                }
             }
         } catch (NoSuchAuthorityCodeException | MissingFactoryResourceException e) {
             /*
@@ -441,13 +443,15 @@ class CoordinateOperationRegistry {
                  * The non-public Semaphores.METADATA_ONLY mechanism instructs EPSGDataAccess
to
                  * instantiate DeferredCoordinateOperation instead of full coordinate operations.
                  */
-                Semaphores.queryAndSet(Semaphores.METADATA_ONLY);
+                mdOnly = Semaphores.queryAndSet(Semaphores.METADATA_ONLY);
                 try {
                     try {
                         if (!it.hasNext()) break;
                         candidate = it.next();
                     } finally {
-                        Semaphores.clear(Semaphores.METADATA_ONLY);
+                        if (!mdOnly) {
+                            Semaphores.clear(Semaphores.METADATA_ONLY);
+                        }
                     }
                 } catch (BackingStoreException exception) {
                     throw exception.unwrapOrRethrow(FactoryException.class);



Mime
View raw message