You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2021/03/07 18:22:55 UTC

[myfaces] branch 2.2.x updated: MYFACES-4285

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

tandraschko pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/2.2.x by this push:
     new 2dbb70b  MYFACES-4285
     new 42efa13  Merge pull request #180 from ivy-arus/MYFACES-4285
2dbb70b is described below

commit 2dbb70bc962879850954c8057f301414d48d4c81
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Mar 15 19:41:48 2019 +0100

    MYFACES-4285
---
 .../view/facelets/tag/TagAttributeImpl.java        | 38 ++++++++++++----------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
index da4c937..c47092e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
@@ -300,15 +300,17 @@ public final class TagAttributeImpl extends TagAttribute
                 if ((this.capabilities & EL_CC) != 0)
                 {
                     Location currentLocation = getLocation();
-                    Location ccLocation = (Location) actx.getFaceletCompositionContext().
-                            getCompositeComponentFromStack().getAttributes().get(
-                                    CompositeComponentELUtils.LOCATION_KEY);
-                    if (ccLocation != null && !ccLocation.getPath().equals(currentLocation.getPath()))
+                    UIComponent cc = actx.getFaceletCompositionContext().getCompositeComponentFromStack();
+                    if (cc != null)
                     {
-                        // #{cc} from a template called from inside a composite component, disable caching on 
-                        // this expression. The reason is we need to change the Location object used as
-                        // reference as the one in the stack, and that depends on the template hierarchy.
-                        currentLocation = ccLocation;
+                        Location ccLocation = (Location) cc.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
+                        if (ccLocation != null && !ccLocation.getPath().equals(currentLocation.getPath()))
+                        {
+                            // #{cc} from a template called from inside a composite component, disable caching on 
+                            // this expression. The reason is we need to change the Location object used as
+                            // reference as the one in the stack, and that depends on the template hierarchy.
+                            currentLocation = ccLocation;
+                        }
                     }
                     methodExpression = new LocationMethodExpression(currentLocation, methodExpression, 
                             actx.getFaceletCompositionContext().getCompositeComponentLevel());
@@ -565,16 +567,18 @@ public final class TagAttributeImpl extends TagAttribute
                 // the location of the composite component from the stack directly, but only when the path
                 // is different.
                 Location currentLocation = getLocation();
-                Location ccLocation = (Location) actx.getFaceletCompositionContext().
-                        getCompositeComponentFromStack().getAttributes().get(
-                                CompositeComponentELUtils.LOCATION_KEY);
-                if (ccLocation != null && !ccLocation.getPath().equals(currentLocation.getPath()))
+                UIComponent cc = actx.getFaceletCompositionContext().getCompositeComponentFromStack();
+                if (cc != null)
                 {
-                    // #{cc} from a template called from inside a composite component, disable caching on 
-                    // this expression. The reason is we need to change the Location object used as
-                    // reference as the one in the stack, and that depends on the template hierarchy.
-                    //cacheable = false;
-                    currentLocation = ccLocation;
+                    Location ccLocation = (Location) cc.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
+                    if (ccLocation != null && !ccLocation.getPath().equals(currentLocation.getPath()))
+                    {
+                        // #{cc} from a template called from inside a composite component, disable caching on 
+                        // this expression. The reason is we need to change the Location object used as
+                        // reference as the one in the stack, and that depends on the template hierarchy.
+                        //cacheable = false;
+                        currentLocation = ccLocation;
+                    }
                 }
                 if (ExternalSpecifications.isUnifiedELAvailable())
                 {