You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2005/09/22 16:48:53 UTC

svn commit: r290952 - /myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/HtmlComponentUtils.java

Author: mmarinschek
Date: Thu Sep 22 07:48:48 2005
New Revision: 290952

URL: http://svn.apache.org/viewcvs?rev=290952&view=rev
Log:
fix for ClassCastException if forceId is used with facelets

Modified:
    myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/HtmlComponentUtils.java

Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/HtmlComponentUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/HtmlComponentUtils.java?rev=290952&r1=290951&r2=290952&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/HtmlComponentUtils.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/HtmlComponentUtils.java Thu Sep 22 07:48:48 2005
@@ -55,7 +55,23 @@
                                      FacesContext context)
     {
         // see if the originally supplied id should be used 
-        Boolean forceValue = (Boolean)component.getAttributes().get(JSFAttr.FORCE_ID_ATTR);
+        Boolean forceValue = null;
+
+        Object forceValueObj = component.getAttributes().get(JSFAttr.FORCE_ID_ATTR);
+
+        if(forceValueObj instanceof Boolean)
+        {
+            forceValue = (Boolean)forceValueObj;
+        }
+        else if(forceValueObj instanceof String)
+        {
+            forceValue = Boolean.valueOf((String) forceValueObj);
+        }
+        else if(forceValueObj != null)
+        {
+            throw new IllegalStateException("forceId must be instanceof 'Boolean' or 'String'");
+        }
+
         boolean forceId = false;
         
         if (forceValue != null)