sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1801737 - /sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureUtilities.java
Date Wed, 12 Jul 2017 14:23:59 GMT
Author: desruisseaux
Date: Wed Jul 12 14:23:59 2017
New Revision: 1801737

URL: http://svn.apache.org/viewvc?rev=1801737&view=rev
Log:
Paranoiac safety against empty or null collection of dependencies.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureUtilities.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureUtilities.java?rev=1801737&r1=1801736&r2=1801737&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureUtilities.java
[UTF-8] Wed Jul 12 14:23:59 2017
@@ -24,6 +24,7 @@ import org.opengis.parameter.ParameterDe
 import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.feature.AbstractOperation;
+import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.util.Static;
 
 // Branch-dependent imports
@@ -79,7 +80,12 @@ public final class FeatureUtilities exte
         if (property instanceof AbstractOperation) {
             final AbstractOperation op = (AbstractOperation) property;
             if (op.getParameters() == LINK_PARAMS) {
-                return op.getDependencies().iterator().next();          // Should always
have exactly one element.
+                /*
+                 * The dependencies collection contains exactly one element on Apache SIS
implementation.
+                 * However the user could define his own operation with the same parameter
descriptor name.
+                 * This is unlikely since it would probably be a bug, but we are paranoiac.
+                 */
+                return CollectionsExt.first(op.getDependencies());
             }
         }
         return null;



Mime
View raw message