On 04/12/2014 09:21, mauromol wrote: > 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
Until the EL spec changes, Tomcat's default behaviour isn't going to change. > 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. That we can fix. Indeed, reading section 1.23 of the EL spec we should fix it. My reading of the spec is that we should always give the ELResolver a chance to convert this before applying the defaults. I've raised https://issues.apache.org/bugzilla/show_bug.cgi?id=57309 for this. The fix looks fairly simple. I'll update that ticket when I have something. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org