MyFaces Commons
  1. MyFaces Commons
  2. MFCOMMONS-8

EnumConverter can't fetch target class automatically

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.1
    • Labels:
      None
    • Environment:
      java version "1.6.0_13"
      Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)

      myfaces-converters11 Version 1.0.0

      Description

      The EnumConverter can't get the Enum-Class if the Enum is public enum xyz

      {..}

      and not an anonymous inner enum.

      Background:
      http://bugs.sun.com/view_bug.do?bug_id=6708424

      Issue:
      In line 71 of EnumConverter '} else if (value.getClass().isEnum()) {' only works with anonymous inner classes. Otherwise it is false and
      'javax.faces.convert.ConverterException: No target class selected.' is thrown.

      possible solution:
      change 'getClass()' to 'getDeclaringClass()'. This works with public enums but must be checked for anonymous inner classes.

        Activity

        Sven Bunge created issue -
        Sven Bunge made changes -
        Field Original Value New Value
        Description The EnumConverter can't get the Enum-Class if the Enum is public enum xyz {..} and not an anonymous inner enum.

        Background:
        http://bugs.sun.com/view_bug.do;jsessionid=1d047c12af80141dd0d9e71e102c?bug_id=6708424

        Issue:
        In line 71 of EnumConverter '} else if (value.getClass().isEnum()) {' only works with anonymous inner classes. Otherwise it is false and
        'javax.faces.convert.ConverterException: No target class selected.' is thrown.

        possible solution:
        change 'getClass()' to 'getDeclaringClass()'. This works with public enums but must be checked for anonymous inner classes.
        The EnumConverter can't get the Enum-Class if the Enum is public enum xyz {..} and not an anonymous inner enum.

        Background:
        http://bugs.sun.com/view_bug.do?bug_id=6708424

        Issue:
        In line 71 of EnumConverter '} else if (value.getClass().isEnum()) {' only works with anonymous inner classes. Otherwise it is false and
        'javax.faces.convert.ConverterException: No target class selected.' is thrown.

        possible solution:
        change 'getClass()' to 'getDeclaringClass()'. This works with public enums but must be checked for anonymous inner classes.
        Volker Weber made changes -
        Assignee Volker Weber [ volkerweber ]
        Volker Weber made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Volker Weber made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 1.0.1-SNAPSHOT [ 12313539 ]
        Resolution Fixed [ 1 ]
        Leonardo Uribe made changes -
        Fix Version/s 1.0.1 [ 12315967 ]
        Fix Version/s 1.0.1-SNAPSHOT [ 12313539 ]
        Leonardo Uribe made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Volker Weber
            Reporter:
            Sven Bunge
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development