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

Setter method for list-entries and map-entries called regardless of value returned by getter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.1.4
    • None
    • JSR-127
    • None

    Description

      Section 5.3.1.3 states that lists returned by getters for list-entries properties should be used if they are non-null:

      For <list-entries>:
      1. Call the property getter, if it exists.
      2. If the getter returns null or doesn't exist, create a java.util.ArrayList,
      otherwise use the returned Object (an array or a java.util.List).
      ...
      5. If a new java.util.List was created in step 2) and the property is of type
      List, set the property by calling the setter method, or log an error if there is no
      setter method.

      From point 5, it's obvious that the corresponding setter should only be called only if a new list was created in step 2, which only happens if there is no getter or the getter returns null. The implementation in MyFaces (org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(...)) does however always call the setter, even when a list was returned from the getter.

      The implementation should remember if a new list had to be created (either because it was null/no getter present, or because an array was returned from the getter), and only call the setter if that was the case.

      Attachments

        1. MYFACES-1524.patch
          3 kB
          Skjalg Stilson Arstad

        Activity

          People

            Unassigned Unassigned
            skjalg Skjalg Stilson Arstad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: