ICEfaces
  1. ICEfaces
  2. ICE-1537

<ice:outputText> converter attribute not calling custom converter if value is a java.lang.String

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6DR#3
    • Fix Version/s: 1.6.2, 1.7DR#1, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Win XP / Tomcat 5.5.17 / Liferay 4.3

      Description

      If I have something like this:

      <ice:outputText converter="MyConverter" value="#{MyBean.value}"/>

      The MyConverer.getAsString() method does not get called if MyBean.getValue() returns a java.lang.String object.
      See: http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/convert/Converter.html

      In the forum post, the user named "edykory" identified a fix:

      > Edit core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java
      > and comment out around line 217:
      >
      > if (currentValue instanceof String) {
      > return (String) currentValue;
      > }
       
      My guess is that you all put this code in there to increase performance, but you're assuming that the Converter would not want to convert the java.lang.String value into some other type of String.

      For example, you might want to convert the String "true" to "Yes" or "false" to "No".

        Activity

        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P2
        Assignee Mark Collette [ mark.collette ]
        Ken Fyten made changes -
        Fix Version/s 1.7 [ 10080 ]
        Mark Collette made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mark Collette added a comment -

        Backport to 1.6.2 : ICE-1537
        icefaces\component\src\com\icesoft\faces\component\ext\HtmlInputText.java
        icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java
        Committed revision 15025.

        Show
        Mark Collette added a comment - Backport to 1.6.2 : ICE-1537 icefaces\component\src\com\icesoft\faces\component\ext\HtmlInputText.java icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java Committed revision 15025.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #15025 Thu Oct 25 12:41:40 MDT 2007 mark.collette Backport to 1.6.2 : ICE-1537
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/ext/HtmlInputText.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/DomBasicRenderer.java
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Ken Fyten made changes -
        Fix Version/s 1.6.2 [ 10111 ]
        Mark Collette made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mark Collette added a comment -

        Changed the conversion process in our code to adhere to the JSF spec, which allows for String <--> String conversion.

        Subversion 14861
        icefaces\component\src\com\icesoft\faces\component\ext\HtmlInputText.java
        icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java

        Show
        Mark Collette added a comment - Changed the conversion process in our code to adhere to the JSF spec, which allows for String <--> String conversion. Subversion 14861 icefaces\component\src\com\icesoft\faces\component\ext\HtmlInputText.java icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14861 Wed Sep 26 10:08:46 MDT 2007 mark.collette ICE-1537 : <ice:outputText> converter attribute not calling custom converter if value is a java.lang.String
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/HtmlInputText.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/DomBasicRenderer.java
        Hide
        Mark Collette added a comment -

        Perhaps we should always invoke the converter. But if the converter returns a String, and that String equals the original String, then we should return the original instance.

        Show
        Mark Collette added a comment - Perhaps we should always invoke the converter. But if the converter returns a String, and that String equals the original String, then we should return the original instance.
        Ken Fyten made changes -
        Field Original Value New Value
        Fix Version/s 1.7DR#1 [ 10100 ]
        Assignee Priority P2
        Assignee Mark Collette [ mark.collette ]
        Hide
        Neil Griffin added a comment -

        I see in the latest ICEfaces 1.6-DR#4 code, the following comments have been added by an ICEsoft developer:

        // Don't convert currentValues that are already a String. Some 3rd party converters attempt
        // to cast this to a specific instance.

        So that explains why. But can we open a dialog as to why this is the best approach?

        Thank you,

        Neil Griffin
        Liferay, Inc.

        Show
        Neil Griffin added a comment - I see in the latest ICEfaces 1.6-DR#4 code, the following comments have been added by an ICEsoft developer: // Don't convert currentValues that are already a String. Some 3rd party converters attempt // to cast this to a specific instance. So that explains why. But can we open a dialog as to why this is the best approach? Thank you, Neil Griffin Liferay, Inc.
        Neil Griffin created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Neil Griffin
          • Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: