dev@javaserverfaces.java.net

Re: [DateTimeConverter] Tag issue ?

From: Matthias Wessendorf <matzew_at_apache.org>
Date: Wed, 24 Oct 2007 18:09:48 +0200

Hi,

in com.sun.el.lang.ELSupport.coerceToString()
 I noticed that a in case of a null String, the method returns "";


The way down.
In the converter:
        if (patternExpression != null) {
            pattern = (String)
            ELUtils.evaluateValueExpression(patternExpression, elContext);
        }

in

com.sun.faces.el.ELUtils.evaluateValueExpression()
(expectedType == String... for the pattern)

        if (this.expectedType != null) {
            return ELSupport.coerceToType(value, this.expectedType);
        }

coerceToType CALLs the coerceToString()


    public final static String coerceToString(final Object obj) {
        if (obj == null) {
            return "";
...
}

So, that is the reason why "" is returned.

Stupid question... is that correct ?

thx,
Matthias


On 10/24/07, Matthias Wessendorf <matzew_at_apache.org> wrote:
> Hi,
>
> using JSF RI (1_2_04-p02) + Trinidad 1.2.x
>
> I noticed the following, when a "pattern" is null, like
>
>
> <tr:inputText >
> <tr:convertDateTime pattern="#{null}"/>
> </tr:inputText>
>
> A "default" date is visible.
>
> But with f: (using the RI Tag to create the overridden DateTimeConverter)
> <tr:inputText >
> <f:convertDateTime pattern="#{null}"/>
> </tr:inputText>
>
> nothing is displayed.
>
> The null get's resolved as "" and therefore the DateFormat "parser"
> returns no date.
>
> Someone noticed this too ?
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://matthiaswessendorf.wordpress.com/
> mail: matzew-at-apache-dot-org
>


-- 
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org