2013/9/11 Arvīds Grabovskis <arvids.grabovs...@gmail.com>:
> Hi,
>
> If JSP includes a line "<c:if test="${nonExisting}">Hello,world!</c:if>"
> where "nonExisting" is attribute that does not exist, then
> NullPointerException will be thrown. The cause is at
> http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
> at
> line #421 which generates something like:
> ((java.lang.Boolean)
> org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${nonExisting}",
> java.lang.Boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context,
> null, false)).booleanValue()
>
> The result of proprietaryEvaluate() is null (because of EL 3.0 changes
> regarding coercing), hence calling booleanValue() will throw NPE. The
> latest changes in EL specification does require guarding against such null
> pointer access (otherwise it will break lots of existing applications). I
> really hope that this is not intended behavior.
>
> Double checked the existence of error with Tomcat v8.0.0-RC1 (the same
> problem affects the Glassfish v4, but they have a forked version of JSPC
>

1. Why does it try to convert to "boolean" and not to "Boolean"?

2. Yes, a null cannot be converted to primitive boolean value, so an
NPE is the correct behaviour here. So the generated code is correct.

So the question is why EL expression "${nonExisting}" or "${null}" was
not evaluated to Boolean.FALSE.

What version of JSTL are you using?
Are you sure that you are using EL-aware versions of the tags
(JSTL 1.1+) instead of older JSTL 1.0 ones?

What are the steps to reproduce the issue on a clear installation?
What is your version of Tomcat?
What is you stacktrace?


Best regards,
Konstantin Kolinko

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

Reply via email to