You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/04/08 22:54:13 UTC

[sling-whiteboard] branch master updated: [api-regions] check if local APIs set contains the api first, then traverse the hierarchy, not the opposite

This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 9a79461  [api-regions] check if local APIs set contains the api first, then traverse the hierarchy, not the opposite
9a79461 is described below

commit 9a7946132815c9c615f72afedbf86ba86c599139
Author: stripodi <st...@192.168.1.111>
AuthorDate: Tue Apr 9 00:54:05 2019 +0200

    [api-regions] check if local APIs set contains the api first, then
    traverse the hierarchy, not the opposite
---
 .../main/java/org/apache/sling/feature/apiregions/ApiRegion.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/feature-api-regions/src/main/java/org/apache/sling/feature/apiregions/ApiRegion.java b/feature-api-regions/src/main/java/org/apache/sling/feature/apiregions/ApiRegion.java
index 4117cf1..3ac34e1 100644
--- a/feature-api-regions/src/main/java/org/apache/sling/feature/apiregions/ApiRegion.java
+++ b/feature-api-regions/src/main/java/org/apache/sling/feature/apiregions/ApiRegion.java
@@ -137,13 +137,15 @@ public final class ApiRegion implements Iterable<String> {
             return false;
         }
 
-        boolean found = false;
+        if (apis.contains(api)) {
+            return true;
+        }
 
         if (parent != null) {
-            found = found || parent.contains(api);
+            return parent.contains(api);
         }
 
-        return found || apis.contains(api);
+        return false;
     }
 
     public boolean isEmpty() {