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 2011/08/14 20:10:45 UTC
svn commit: r1157591 -
/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
Author: lu4242
Date: Sun Aug 14 18:10:45 2011
New Revision: 1157591
URL: http://svn.apache.org/viewvc?rev=1157591&view=rev
Log:
MYFACES-3279 composite component default values for method expressions cannot be evaluated on attribute map
Modified:
myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java?rev=1157591&r1=1157590&r2=1157591&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java Sun Aug 14 18:10:45 2011
@@ -283,8 +283,33 @@ class _ComponentAttributesMap implements
{
if (attribute.getName().equals(key))
{
- value = attribute.getValue("default");
- break;
+ String attributeName = attribute.getName();
+ boolean isKnownMethod = "action".equals(attributeName) || "actionListener".equals(attributeName)
+ || "validator".equals(attributeName) || "valueChangeListener".equals(attributeName);
+
+ // <composite:attribute> method-signature attribute is
+ // ValueExpression that must evaluate to String
+ ValueExpression methodSignatureExpression
+ = (ValueExpression) attribute.getValue("method-signature");
+ String methodSignature = null;
+ if (methodSignatureExpression != null)
+ {
+ // Check if the value expression holds a method signature
+ // Note that it could be null, so in that case we don't have to do anything
+ methodSignature = (String) methodSignatureExpression.getValue(_component.getFacesContext().getELContext());
+ }
+
+ // either the attributeName has to be a knownMethod or there has to be a method-signature
+ if (isKnownMethod || methodSignature != null)
+ {
+ //In this case it is expecting a ValueExpression
+ return attribute.getValue("default");
+ }
+ else
+ {
+ value = attribute.getValue("default");
+ break;
+ }
}
}
// We have to check for a ValueExpression and also evaluate it