tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arvīds Grabovskis <arvids.grabovs...@gmail.com>
Subject NullPointerException for conditions in compiled JSPs
Date Wed, 11 Sep 2013 13:33:32 GMT
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

-- Arvīds

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message