MyFaces Core
  1. MyFaces Core
  2. MYFACES-1592

cannot render selectBooleanCheckbox tag when a boolean value is supplied

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.2.0
    • Component/s: JSR-252
    • Labels:
      None

      Description

      The tag descriptor generated by the maven plugin for HtmlSelectBooleanCheckboxTag has the following attribute:
      <attribute>
      <description><![CDATA[The initial value of this component.]]></description>
      <name>value</name>
      <deferred-value></deferred-value>
      </attribute>

      So when a JSP contains a tag like this:
      <h:selectBooleanCheckbox id="foo1" value="true"/>

      The following unhandled exception is thrown:
      javax.servlet.ServletException: Expected submitted value of type Boolean for Component :

      {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /mytest.jsp][Class: javax.faces.component.html.HtmlForm,Id: form][Class: javax.faces.component.html.HtmlSelectBooleanCheckbox,Id: foo1]}

      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
      at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:333)
      at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:543)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
      at java.lang.Thread.run(Thread.java:613)

      This exception is thrown because RendererUtils.getBooleanValue() expects HtmlSelectBooleanCheckbox.getValue() to return a Boolean but instead it returns an Object. Changing the type for the "value" attribute in h.tld as shown below avoids the exception and passes the currently failing TCK test for that component:
      <attribute>
      <description><![CDATA[The initial value of this component.]]></description>
      <name>value</name>
      <deferred-value>
      <type>boolean</type>
      </deferred-value>
      </attribute>

      1. MYFACES-1592.patch
        0.8 kB
        Martin Haimberger

        Activity

        Hide
        Paul McMahan added a comment -

        patch applied with a minor modification, thanks Martin!

        Show
        Paul McMahan added a comment - patch applied with a minor modification, thanks Martin!
        Hide
        Paul McMahan added a comment -

        Thanks Martin, I haven't looked at the RI and didn't realize that it also declares SelectBooleanCheckbox as an object. So based on that observation I think your approach is right and will apply your patch unless there is some objection.

        Show
        Paul McMahan added a comment - Thanks Martin, I haven't looked at the RI and didn't realize that it also declares SelectBooleanCheckbox as an object. So based on that observation I think your approach is right and will apply your patch unless there is some objection.
        Hide
        Martin Haimberger added a comment -

        Hi,

        i have looked into the ri tag declaration (standart-html-renderkit.xml) and the value of the SelectBooleanCheckbox is also an object. So i think this is right. I have modified the methode getBooleanValue so it checks if the value is a String and tries to convert it to a boolean value.

        Is this the right solution ?

        Regards,

        Martin Haimberger

        Show
        Martin Haimberger added a comment - Hi, i have looked into the ri tag declaration (standart-html-renderkit.xml) and the value of the SelectBooleanCheckbox is also an object. So i think this is right. I have modified the methode getBooleanValue so it checks if the value is a String and tries to convert it to a boolean value. Is this the right solution ? Regards, Martin Haimberger

          People

          • Assignee:
            Martin Haimberger
            Reporter:
            Paul McMahan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development