MyFaces Core
  1. MyFaces Core
  2. MYFACES-829

<h:selectManyCheckbox> with value bound to an array of int fails

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.2
    • Component/s: JSR-127
    • Labels:
      None
    • Environment:
      Linux, JDK 1.5.0_05

      Description

      The Shale "use cases" example includes a page where an <h:selectManyCheckbox> component is bound to an array of int that represents selected values. A bug was reported against this app:

      http://issues/apache.org/bugzilla/show_bug.cgi?id=37361

      However, further investigation shows that this case works correctly with the JSF RI, leading to the belief that it represents an implementation error in MyFaces. See the above bug report for more details.

      For reference, the page includes the following component:

      <h:selectManyCheckbox id="categories" layout="pageDirection"
      value="#

      {dialog.data.categories}">
      <h:selectItems value="#{domains.supportedCategories}"/>
      </h:selectManyCheckbox>

      where the binding expressions point at values of the following types:

      * #{dialog.data.categories}

      points at an array of int representing
      the currently selected categories

      • # {domains.supportedCategories}

        points at an array of SelectItem,
        where the "value" property of each is an Integer representing the
        primary key for that category.

      1. myfaces-829.patch
        24 kB
        John R. Fallows
      2. myfaces-829-post-reorg.patch
        23 kB
        John R. Fallows

        Activity

        Craig McClanahan created issue -
        sean schofield made changes -
        Field Original Value New Value
        Assignee sean schofield [ schof ]
        Hide
        sean schofield added a comment -

        This is definitely a MyFaces implementation bug. The validateValue method in UISelectMany assumes the converted values to be an instanceof Object[] or List. A primitive array automatically causes a validation error (without even checking the values.) The RI uses a custom iterrator (SelectItemsIterator). That might be a better approach then the current "if .. else" approach we have (now that we know there are more then two cases.)

        Show
        sean schofield added a comment - This is definitely a MyFaces implementation bug. The validateValue method in UISelectMany assumes the converted values to be an instanceof Object[] or List. A primitive array automatically causes a validation error (without even checking the values.) The RI uses a custom iterrator (SelectItemsIterator). That might be a better approach then the current "if .. else" approach we have (now that we know there are more then two cases.)
        Hide
        sean schofield added a comment -

        Upgrading severity since this is a JSF 1.1 compliance issue. The javadoc for UISelectMany clearly states that an array of primitives is to be supported.

        Show
        sean schofield added a comment - Upgrading severity since this is a JSF 1.1 compliance issue. The javadoc for UISelectMany clearly states that an array of primitives is to be supported.
        sean schofield made changes -
        Component/s Implementation [ 12310165 ]
        Component/s JSR-127 [ 12310224 ]
        Priority Major [ 3 ] Critical [ 2 ]
        Howard Abrams made changes -
        Fix Version/s Nightly [ 12310344 ]
        sean schofield made changes -
        Assignee sean schofield [ schof ]
        sean schofield made changes -
        Assignee sean schofield [ schof ]
        sean schofield made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        John R. Fallows added a comment -

        Ensure that a value of type primitive array is validated correctly against the select items.

        UISelectManyTest verifies the correctness of the logic in UISelectMany.validateValue, such as enforcing required, type support for iterating over selected item values, and making sure that the selected values are all in the set of available select item values. When executed against the original code for UISelectMany, this test case passed all tests except primitive int arrays. Now all the tests pass.

        This patch was created against https://svn.apache.org/repos/asf/myfaces/current, revision 359829.

        Show
        John R. Fallows added a comment - Ensure that a value of type primitive array is validated correctly against the select items. UISelectManyTest verifies the correctness of the logic in UISelectMany.validateValue, such as enforcing required, type support for iterating over selected item values, and making sure that the selected values are all in the set of available select item values. When executed against the original code for UISelectMany, this test case passed all tests except primitive int arrays. Now all the tests pass. This patch was created against https://svn.apache.org/repos/asf/myfaces/current , revision 359829.
        John R. Fallows made changes -
        Attachment myfaces-829.patch [ 12321624 ]
        Hide
        John R. Fallows added a comment -

        Reworked the patch for post-reorg maven2 build.

        Introduced a "xx_TEST" locale to serve up javax.faces.Messages bundle messages during unit testing.

        Show
        John R. Fallows added a comment - Reworked the patch for post-reorg maven2 build. Introduced a "xx_TEST" locale to serve up javax.faces.Messages bundle messages during unit testing.
        John R. Fallows made changes -
        Attachment myfaces-829-post-reorg.patch [ 12321643 ]
        Hide
        sean schofield added a comment -

        Patch was applied. NOTE: ASF licenses were added to some files and I moved the mock stuff to a new package 'org.apache.myfaces.mock'.

        Show
        sean schofield added a comment - Patch was applied. NOTE: ASF licenses were added to some files and I moved the mock stuff to a new package 'org.apache.myfaces.mock'.
        sean schofield made changes -
        Fix Version/s Nightly [ 12310660 ]
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        sean schofield made changes -
        Workflow jira [ 12343776 ] MyFaces Workflow [ 12348241 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12348241 ] MyFaces Workflow2 [ 12350643 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12348241 ] MyFaces Workflow2 [ 12350733 ]
        sean schofield made changes -
        Workflow MyFaces Workflow2 [ 12350733 ] MyFaces Workflow [ 12354596 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12354596 ] MyFaces Workflow2 [ 12355911 ]
        sean schofield made changes -
        Workflow MyFaces Workflow2 [ 12355911 ]  MyFaces Workflow [ 12357617 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12357617 ] MyFaces Workflow2 [ 12359131 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12359131 ] MyFaces Workflow2 [ 12359732 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12359732 ] MyFaces Workflow2 [ 12360322 ]
        sean schofield made changes -
        Fix Version/s 1.1.2-SNAPSHOT [ 12310660 ]
        Fix Version/s 1.1.2 [ 12310960 ]

          People

          • Assignee:
            sean schofield
            Reporter:
            Craig McClanahan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development