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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new bdb58f7  Fix a NoSuchElementException in Convention.find(Decoder). 
Remove the comment about synchronization and the synchronized statement, since 
we are using LazySet workaround.
bdb58f7 is described below

commit bdb58f75a4e1bbb5451861a9d08f256a45421a26
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu Feb 21 19:01:44 2019 +0100

    Fix a NoSuchElementException in Convention.find(Decoder).
    Remove the comment about synchronization and the synchronized statement, 
since we are using LazySet workaround.
---
 .../src/main/java/org/apache/sis/internal/netcdf/Convention.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
index 631636c..29a745e 100644
--- 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
+++ 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
@@ -94,13 +94,8 @@ public class Convention {
     /**
      * Finds the convention to apply to the file opened by the given decoder, 
or {@code null} if none.
      * This method does not change the state of the given {@link Decoder}.
-     *
-     * @todo this method is temporarily synchronized because of a {@link 
java.util.ServiceLoader} bug in JDK 8,
-     *       which does not support the use of a new {@link Iterator} while 
another iteration is in progress,
-     *       even if they are in the same thread. We will remove this 
synchronization in JDK9 if that bug is fixed.
-     *       Only the {@code synchronized (AVAILABLES)} statements should stay.
      */
-    static synchronized Convention find(final Decoder decoder) {
+    static Convention find(final Decoder decoder) {
         final Iterator<Convention> it;
         Convention c;
         synchronized (AVAILABLES) {
@@ -117,7 +112,7 @@ public class Convention {
          */
         while (!c.isApplicableTo(decoder)) {
             synchronized (AVAILABLES) {
-                if (it.hasNext()) {
+                if (!it.hasNext()) {
                     c = DEFAULT;
                     break;
                 }

Reply via email to