sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1763392 - /sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java
Date Wed, 05 Oct 2016 10:20:19 GMT
Author: desruisseaux
Date: Wed Oct  5 10:20:19 2016
New Revision: 1763392

URL: http://svn.apache.org/viewvc?rev=1763392&view=rev
Log:
Bug fix when removing non-ambiguous name from the map.

Modified:
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java?rev=1763392&r1=1763391&r2=1763392&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GenericNameMap.java
[UTF-8] Wed Oct  5 10:20:19 2016
@@ -44,7 +44,7 @@ import org.apache.sis.storage.IllegalNam
  * @version 0.8
  * @module
  */
-public final class GenericNameMap<E> {
+public class GenericNameMap<E> {
     /**
      * All aliases found for all names given to the {@link #add(GenericName, Object)} method.
      * Keys are aliases (never the explicitely given names) and values are names for which
the key is an alias.
@@ -158,7 +158,9 @@ public final class GenericNameMap<E> {
              * is exactly one remaining GenericName, then the alias is not ambiguous anymore
for that name.
              */
             error |= (remaining == null);
-            if (remaining != null && remaining.size() == 1) {
+            if (remaining == null || remaining.isEmpty()) {
+                error |= (values.remove(alias) == null);
+            } else if (remaining.size() == 1) {
                 final String select = remaining.get(0);
                 assert !select.equals(key) : select;     // Should have been removed by removeFromMultiValuesMap(…).
                 error |= (values.putIfAbsent(alias, values.get(select)) != null);



Mime
View raw message