MyFaces Core
  1. MyFaces Core
  2. MYFACES-45

ApplicationImpl does not correctly traverse a Class' hierarchy to create a Converter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.7 beta
    • Fix Version/s: 1.0.8 beta
    • Component/s: None
    • Labels:
      None
    • Environment:
      WSAD 5.1.2

      Description

      The JSF spec doesn't go into much detail about the way that the
      Application needs to search for a converter for a given Object type.
      Currently, we only search a Class' direct interfaces and, recursively,
      its superclasses for a match. This can be problematic if the
      converter definition refers to an interface. The only checking will
      be for its direct parents.

      Here is an example outlining my problem:

      Interfaces:
      Descriptor, Active, Identifiable

      ModelBase extends Descriptor

      Organization extends Active, Identifiable, ModelBase

      Classes:

      DescriptorImpl implements Descriptor

      ModelBaseImpl extends DescriptorImpl implements ModelBase

      OrganizationImpl extends ModelBaseImpl implements Organization

      This means that if I register my Converter on a Descriptor and a JSF
      component needs to find a Converter for an Organization, it will not
      find one because the search will go something like this:

      Organization = no match
      search interfaces: Active = no match
      Identifiable = no match
      ModelBase = no match
      search superclass: null = no match

      return null;

      Of course, we should just recursively search the interfaces as well.
      Preferably, we would want users to be able to define a different
      Converter for a Descriptor and an Organization with confidence that
      the Organization would always get an OrganizationConverter.

      That outlines the bug, which I intend to fix. The real question is
      one of strategy.

      Here are the strategies we could use:
      A: use Class.isAssignableFrom(Class) on each key in the
      _converterTypeMap to match the Class to a converter, then get that
      converter from the Map. There could be additional algorithms employed
      to choose between multiple matches.

      B: When checking an interface, we just see if it is present in the
      Map. We could execute the internalCreateConverter(Class) method on
      it, so that its SuperInterfaces will be searched.

        Activity

        Heath Borders created issue -
        Heath Borders made changes -
        Field Original Value New Value
        Attachment ApplicationImpl.java [ 18281 ]
        Manfred Geiler made changes -
        Resolution Fixed [ 1 ]
        Assignee Manfred Geiler [ manolito ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.0.8 beta [ 10972 ]
        Manfred Geiler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        sean schofield made changes -
        Workflow jira [ 38713 ] MyFaces Workflow [ 12347893 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12347893 ] MyFaces Workflow2 [ 12349822 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12347893 ] MyFaces Workflow2 [ 12349844 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12347893 ] MyFaces Workflow2 [ 12349923 ]
        sean schofield made changes -
        Workflow MyFaces Workflow2 [ 12349923 ] MyFaces Workflow [ 12354042 ]
        sean schofield made changes -
        Workflow MyFaces Workflow [ 12354042 ] MyFaces Workflow2 [ 12355564 ]
        sean schofield made changes -
        Workflow MyFaces Workflow2 [ 12355564 ]  MyFaces Workflow [ 12357270 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12357270 ] MyFaces Workflow2 [ 12358271 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12358271 ] MyFaces Workflow2 [ 12358760 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12358760 ] MyFaces Workflow2 [ 12359361 ]
        sean schofield made changes -
        Workflow  MyFaces Workflow [ 12359361 ] MyFaces Workflow2 [ 12359950 ]

          People

          • Assignee:
            Manfred Geiler
            Reporter:
            Heath Borders
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development