Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-251

selectManyCheckbox returns conversion error if nothing is selected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.0.9m9
    • 1.2.3
    • General
    • None
    • winXP professional SP2

    Description

      when I use <h:selectManyCheckbox> with a few checkboxes, it works correctly if I select at least one item from the checkboxes. However, if I don't select anything and submit the form, myfaces always gives "conversion error" in the context message <h:messages>, no exception stacktrace or log trace.

      I found another user has the same problem http://mail-archives.apache.org/mod_mbox/myfaces-users/200505.mbox/%3cd05cabe70505060731604585d0@mail.gmail.com%3e

      I'm using myfaces version 1.0.9, build on (2005-04-13 13:17 EDT)

      after I digging around for awhile, I found out that myfaces only checks either null or String[] types, but in fact, an empty selection returns "", a zero length string. It works correct after I made changes to src/share/org.apache.myfaces.renderkit.RendererUtils.java's public static Object getConvertedUISelectManyValue() method, and add zero length string check between null and String[] check, as shown below:

      else if (submittedValue instanceof String &&
      ((String)submittedValue).length() == 0)

      { // to fix bug that caused "conversion error" when nothing is selected. return null; }

      Attachments

        Activity

          People

            lothian Simon Lessard
            dorrenchen Dorren Chen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: