When I return Collections.emptyList() and then use ${list.isEmpty()} in a JSP, a problem occurs (see below). It didn't occur in older Tomcat 7 versions (like 7.0.5). 15: ${user.names}<br /> 16: </div> 17: </c:forEach> 18: <c:if test="${users.isEmpty()}"> 19: <div>${msg.noResults}</div> 20: </c:if> 21: </div> Stacktrace:] with root cause java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class java.util.Collections$EmptyList with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95) at java.lang.reflect.Method.invoke(Method.java:607) at javax.el.BeanELResolver.invoke(BeanELResolver.java:467) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:161) at org.apache.el.parser.AstValue.getValue(AstValue.java:159) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:985) at org.apache.jsp.WEB_002dINF.jsp.externalUsers_jsp._jspx_meth_c_005fif_005f2(externalUsers_jsp.java:2060) at org.apache.jsp.WEB_002dINF.jsp.externalUsers_jsp._jspService(externalUsers_jsp.java:396) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1120) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:890)
I have added unit tests for this in Tomcat 7 that access the list in EL as a property of a bean, in EL directly and from within a JSP and all pass. At this points it looks an application issue. If you still see this problem with the latest Tomcat 7 release then to re-open this issue you'll need to provide the simplest possible JSP that demonstrates this issue.
Gump caught this error with the tests that Mark wrote for this issue. Testsuite: org.apache.el.TestValueExpressionImpl Tests run: 7, Failures: 0, Errors: 2, Time elapsed: 0.131 sec Failed: - testBug51544Bean - testBug51544Direct Testsuite: org.apache.el.TestELInJsp Tests run: 14, Failures: 0, Errors: 1, Time elapsed: 23.259 sec Failed: - testBug51544
Created attachment 27311 [details] A copy of two files from gump output, 25 Jul 2011 08:58:47 (UTC) 1. I am attaching a copy from the logs produced by gump run The log files are http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-test/gump_file/TEST-org.apache.el.TestValueExpressionImpl.BIO.txt.html http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-test/gump_file/TEST-org.apache.el.TestELInJsp.BIO.txt.html 2. I am not able to reproduce this in my environment (Sun JDK 6u26 32-bit, WinXP): tested with BIO connector, like gump did. All tests run fine. bozho, what version of java runtime are you using?
Gump is running open JDK: java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.8) (6b20-1.9.8-0ubuntu1~10.04.1) OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
Hi, My version is: java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.1) (amazon-44.1.9.1.18.amzn1-i386) OpenJDK Client VM (build 19.0-b06, mixed mode)
it's still in testing mode, hence the -client VM. I will change to -server, but I guess it will still be there.
I took a look at the Oracle and OpenJDK implementations of emptyList(). If I modify the test to use size() rather than isEmpty() it fails on the Oracle JDK as well.
Fixed in 7.0.x and will be included in 7.0.20 onwards.