Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.6DR#3
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Win XP / Tomcat 5.5.17 / Liferay 4.3
-
ICEsoft Forum Reference:
-
Workaround Description:No workaround -- must pass something other than a String if the converter is to be called.
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".
<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".
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.