myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cjhow...@apache.org
Subject svn commit: r808544 - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite: AttributeHandler.java CompositeComponentResourceTagHandler.java
Date Thu, 27 Aug 2009 17:16:51 GMT
Author: cjhoward
Date: Thu Aug 27 17:16:51 2009
New Revision: 808544

URL: http://svn.apache.org/viewvc?rev=808544&view=rev
Log:
MYFACES-2340 - minor bugs with CC attribute validation

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java?rev=808544&r1=808543&r2=808544&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java
Thu Aug 27 17:16:51 2009
@@ -177,8 +177,11 @@
             PropertyDescriptor attribute = _createPropertyDescriptor(ctx, parent);
             attributeList.add(attribute);
         }
-                
-        nextHandler.apply(ctx, parent);
+        
+        // Any "next" handler is going to be used to process nested attributes, which we
don't want
+        // to do since they can only possibly refer to bean properties.
+        
+        //nextHandler.apply(ctx, parent);
     }
     
     /**

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java?rev=808544&r1=808543&r2=808544&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
Thu Aug 27 17:16:51 2009
@@ -89,10 +89,30 @@
                 ValueExpression ve = (ValueExpression) propertyDescriptor.getValue("required");
                 if (ve != null)
                 {
-                    Boolean required = Boolean.valueOf((String)ve.getValue(facesContext.getELContext()));
+                    Object value = ve.getValue (facesContext.getELContext());
+                    Boolean required = null;
+                    
+                    // FIXME: almost positive that the value expression is supposed to evaluate
to a boolean, but originally
+                    // the code assumed it to be a string.  Can someone verify what the right
type is?
+                    
+                    if (value instanceof Boolean)
+                    {
+                        required = (Boolean) value;
+                    }
+                    
+                    else
+                    {
+                        required = Boolean.valueOf((String) value);
+                    }
+                    
                     if (required != null && required.booleanValue())
                     {
-                        throw new TagException(this.tag, "Attribute '" + propertyDescriptor.getName()
+ "' is required");
+                        Object attrValue = this.tag.getAttributes().get (propertyDescriptor.getName());
+                        
+                        if (attrValue == null)
+                        {
+                            throw new TagException(this.tag, "Attribute '" + propertyDescriptor.getName()
+ "' is required");
+                        }
                     }
                 }
             }



Mime
View raw message