Violeta Georgieva-2 wrote
> Hi,
> 
> This is incompatible change in EL 3.0.
> Check EL 3.0 Spec 1.23.1 and 1.23.2 the Rule for null String is to coerce
> to "".
> 
> and
> 
> A.4 Incompatibilities between EL 3.0 and EL 2.2
> 
> Regards
> Violeta

This is causing big problems with JSF, indeed. There's an open issue on EL
specification for this:
https://java.net/jira/browse/EL_SPEC-18
As well on JSF SPEC:
https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1203
and Mojarra implementation:
https://java.net/jira/browse/JAVASERVERFACES-3071

In the last link, you'll see that it seems like this problem was somewhat
fixed in Glasshfish implementation of EL in 3.0.1-b05, however it's not
clear *how* this was actually fixed.
In the last-but-one link, instead, you'll see a suggested workaround that
consists in adding an <el-resolver> entry in faces-config.xml which does not
convert null to "".

However, looking Tomcat 8 sources I see this in
org.apache.el.parser.AstValue.setValue(EvaluationContext, Object):

        Target t = getTarget(ctx);
        ctx.setPropertyResolved(false);
        ELResolver resolver = ctx.getELResolver();

        // coerce to the expected type
        Class<?> targetClass = resolver.getType(ctx, t.base, t.property);
        resolver.setValue(ctx, t.base, t.property,
                ELSupport.coerceToType(value, targetClass));

This code shows that null is coerced to String by calling
ELSupport.coerceToType. In other words, the ELResolver is not invoked to do
type conversion (through javax.el.ELResolver.convertToType(ELContext,
Object, Class<?>)), so even if I add a resolver to my resolver chain which
does not convert null to "", I can't override Tomcat's behaviour, which is
using its own ELSupport class directly.

I would appreciate to receive some feedback from Tomcat developers on this.
I'm really out of ideas right now, because, as Koen said,
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL does not work,
even if org.apache.el.parser.COERCE_TO_ZERO=false is passed to Tomcat (which
seemed to work in previous versions, I suspect this change was caused by the
fix to https://issues.apache.org/bugzilla/show_bug.cgi?id=56522).

Thanks in advance,
Mauro

Thanks



--
View this message in context: 
http://tomcat.10.x6.nabble.com/Tomcat8-coercing-behavior-tp5023864p5026387.html
Sent from the Tomcat - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to