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

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


The following commit(s) were added to refs/heads/master by this push:
     new ff8fd2a  SLING-7691 bind getPrevious pipe to referrers'
ff8fd2a is described below

commit ff8fd2ae4bc6a6ea77ba10ff68e633280a13a72d
Author: Nicolas Peltier <[email protected]>
AuthorDate: Tue May 29 16:48:48 2018 +0200

    SLING-7691 bind getPrevious pipe to referrers'
---
 src/main/java/org/apache/sling/pipes/ContainerPipe.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/pipes/ContainerPipe.java 
b/src/main/java/org/apache/sling/pipes/ContainerPipe.java
index e6122f8..d8900f9 100644
--- a/src/main/java/org/apache/sling/pipes/ContainerPipe.java
+++ b/src/main/java/org/apache/sling/pipes/ContainerPipe.java
@@ -98,11 +98,17 @@ public class ContainerPipe extends BasePipe {
      */
     public Pipe getPreviousPipe(Pipe pipe){
         Pipe previousPipe = null;
-        for (Pipe candidate : pipeList){
-            if (candidate.equals(pipe)){
-                return previousPipe;
+        if (!pipeList.isEmpty()){
+            if (pipeList.get(0).equals(pipe) && referrer != null){
+                //in case this pipe is referred, previous pipe is the one of 
the referrer
+                return referrer.getPreviousPipe();
+            }
+            for (Pipe candidate : pipeList){
+                if (candidate.equals(pipe)){
+                    return previousPipe;
+                }
+                previousPipe = candidate;
             }
-            previousPipe = candidate;
         }
         return null;
     }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to