You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/09/11 01:57:56 UTC

svn commit: r1383169 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java

Author: lu4242
Date: Mon Sep 10 23:57:55 2012
New Revision: 1383169

URL: http://svn.apache.org/viewvc?rev=1383169&view=rev
Log:
MYFACES-3605 Expression ClassCastException 

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java?rev=1383169&r1=1383168&r2=1383169&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java Mon Sep 10 23:57:55 2012
@@ -196,7 +196,8 @@ public final class TagAttributeImpl exte
         //volatile reads are atomic, so take the tuple to later comparison.
         Object[] localCachedExpression = cachedExpression; 
         
-        if (actx.isAllowCacheELExpressions() && localCachedExpression != null && (localCachedExpression.length % 3 == 0))
+        if (actx.isAllowCacheELExpressions() && localCachedExpression != null &&
+            (localCachedExpression.length % 3 == 0))
         {
             //If the expected type and paramTypes are the same return the cached one
             for (int i = 0; i < (localCachedExpression.length/3); i++)
@@ -205,7 +206,8 @@ public final class TagAttributeImpl exte
                      (type != null && type.equals(localCachedExpression[(i*3)])) ) &&
                      (Arrays.equals(paramTypes, (Class[]) localCachedExpression[(i*3)+1])) )
                 {
-                    if ((this.capabilities & EL_CC) != 0)
+                    if ((this.capabilities & EL_CC) != 0 &&
+                        localCachedExpression[(i*3)+2] instanceof LocationMethodExpression)
                     {
                         return ((LocationMethodExpression)localCachedExpression[(i*3)+2]).apply(
                                 actx.getFaceletCompositionContext().getCompositeComponentLevel());
@@ -243,12 +245,30 @@ public final class TagAttributeImpl exte
                 
                 ValueExpression valueExpr = this.getValueExpression(ctx, Object.class);
                 methodExpression = new ValueExpressionMethodExpression(valueExpr);
+                
+                if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
+                {
+                    methodExpression = new ContextAwareTagMethodExpression(this, methodExpression);
+                }
+                else
+                {
+                    methodExpression = new TagMethodExpression(this, methodExpression);
+                }
             }
             else
             {
                 ExpressionFactory f = ctx.getExpressionFactory();
                 methodExpression = f.createMethodExpression(ctx, this.value, type, paramTypes);
-                    
+
+                if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
+                {
+                    methodExpression = new ContextAwareTagMethodExpression(this, methodExpression);
+                }
+                else
+                {
+                    methodExpression = new TagMethodExpression(this, methodExpression);
+                }
+
                 // if the MethodExpression contains a reference to the current composite
                 // component, the Location also has to be stored in the MethodExpression 
                 // to be able to resolve the right composite component (the one that was
@@ -261,14 +281,6 @@ public final class TagAttributeImpl exte
                 }
             }
             
-            if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
-            {
-                methodExpression = new ContextAwareTagMethodExpression(this, methodExpression);
-            }
-            else
-            {
-                methodExpression = new TagMethodExpression(this, methodExpression);
-            }
                 
             if (actx.isAllowCacheELExpressions() && !actx.isAnyFaceletsVariableResolved())
             {