javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-1650

FacesConverter should honor both: value and forClass

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.0.2, 2.1.16
    • Fix Version/s: 2.1.24, 2.2.1
    • Component/s: conversion
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,650
    • Status Whiteboard:
      Hide

      size_small importance_medium

      Show
      size_small importance_medium

      Description

      When a converter is annotated with @FacesConverter and both attributes (value and forClass) are given,
      the forClass seems to be ignored.

      See also my post at http://forums.sun.com/thread.jspa?threadID=5437835

        Issue Links

          Activity

          Hide
          Manfred Riem added a comment -

          Reverting out of 2.2 trunk,

          svn commit -m "Reverting out #1650"
          Sending jsf-ri\src\main\java\com\sun\faces\application\annotation\ConverterConfigHandler.java
          Sending jsf-ri\src\main\java\com\sun\faces\config\processor\ConverterConfigProcessor.java
          Sending test\agnostic\facelets\core\src\test\java\com\sun\faces\test\agnostic\facelets\core\Issue1650IT.java
          Transmitting file data ...
          Committed revision 11734.

          Show
          Manfred Riem added a comment - Reverting out of 2.2 trunk, svn commit -m "Reverting out #1650" Sending jsf-ri\src\main\java\com\sun\faces\application\annotation\ConverterConfigHandler.java Sending jsf-ri\src\main\java\com\sun\faces\config\processor\ConverterConfigProcessor.java Sending test\agnostic\facelets\core\src\test\java\com\sun\faces\test\agnostic\facelets\core\Issue1650IT.java Transmitting file data ... Committed revision 11734.
          Hide
          Manfred Riem added a comment -

          The following text was added to the Javadocs of FacesConverter in JSF 2.2:

          The preceding text contains an important subtlety which application users should understand. It is not possible to use a single @FacesConverter annotation to register a single Converter implementation both in the by-class and the by-converter-id data structures. One way to achieve this result is to put the actual converter logic in an abstract base class, without a @FacesConverter annotation, and derive two sub-classes, each with a @FacesConverter annotation. One sub-class has a value attribute but no forClass attribute, and the other sub-class has the converse.

          In this light I will close this issue as Invalid.

          Show
          Manfred Riem added a comment - The following text was added to the Javadocs of FacesConverter in JSF 2.2: The preceding text contains an important subtlety which application users should understand. It is not possible to use a single @FacesConverter annotation to register a single Converter implementation both in the by-class and the by-converter-id data structures. One way to achieve this result is to put the actual converter logic in an abstract base class, without a @FacesConverter annotation, and derive two sub-classes, each with a @FacesConverter annotation. One sub-class has a value attribute but no forClass attribute, and the other sub-class has the converse. In this light I will close this issue as Invalid.
          Hide
          arjan tijms added a comment -

          Manfred, the JavaDoc is now very clear, thanks! But maybe the implementation should log a warning if both attributes are used anyway? Just like the stateless feature logs a warning when the view scoped is used with it?

          Show
          arjan tijms added a comment - Manfred, the JavaDoc is now very clear, thanks! But maybe the implementation should log a warning if both attributes are used anyway? Just like the stateless feature logs a warning when the view scoped is used with it?
          Hide
          Manfred Riem added a comment -

          Arjan,

          Can you file this as an enhancement request, linked to this issue and I will take care of it in the next release cycle.

          Show
          Manfred Riem added a comment - Arjan, Can you file this as an enhancement request, linked to this issue and I will take care of it in the next release cycle.
          Hide
          arjan tijms added a comment -

          I've created this as issue JAVASERVERFACES-2921. Thanks for looking into it!

          Show
          arjan tijms added a comment - I've created this as issue JAVASERVERFACES-2921 . Thanks for looking into it!

            People

            • Assignee:
              Manfred Riem
              Reporter:
              sprehn
            • Votes:
              5 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: