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

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


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


      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:

      Descriptor, Active, Identifiable

      ModelBase extends Descriptor

      Organization extends Active, Identifiable, ModelBase


      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.




            • Assignee:
              manolito Manfred Geiler
              hborders Heath Borders
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: