Author: markt Date: Sat Nov 1 22:07:55 2014 New Revision: 1636066 URL: http://svn.apache.org/r1636066 Log: Expand the fix in 1636063 to include imports of static fields.
Modified: tomcat/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java tomcat/trunk/test/org/apache/el/TestELInJsp.java tomcat/trunk/test/webapp/bug5nnnn/bug57141.jsp Modified: tomcat/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java?rev=1636066&r1=1636065&r2=1636066&view=diff ============================================================================== --- tomcat/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java (original) +++ tomcat/trunk/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java Sat Nov 1 22:07:55 2014 @@ -56,13 +56,27 @@ public class ScopedAttributeELResolver e result = page.findAttribute(key); if (result == null) { - // This might be the name of an import class + // This might be the name of an imported class ImportHandler importHandler = context.getImportHandler(); if (importHandler != null) { Class<?> clazz = importHandler.resolveClass(key); if (clazz != null) { result = new ELClass(clazz); } + if (result == null) { + // This might be the name of an imported static field + clazz = importHandler.resolveStatic(key); + if (clazz != null) { + try { + result = clazz.getField(key).get(null); + } catch (IllegalArgumentException | IllegalAccessException | + NoSuchFieldException | SecurityException e) { + // Most (all?) of these should have been + // prevented by the checks when the import + // was defined. + } + } + } } } } Modified: tomcat/trunk/test/org/apache/el/TestELInJsp.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestELInJsp.java?rev=1636066&r1=1636065&r2=1636066&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/el/TestELInJsp.java (original) +++ tomcat/trunk/test/org/apache/el/TestELInJsp.java Sat Nov 1 22:07:55 2014 @@ -398,6 +398,7 @@ public class TestELInJsp extends TomcatB String result = res.toString(); assertEcho(result, "00-true"); assertEcho(result, "01-false"); + assertEcho(result, "02-2147483647"); } Modified: tomcat/trunk/test/webapp/bug5nnnn/bug57141.jsp URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug5nnnn/bug57141.jsp?rev=1636066&r1=1636065&r2=1636066&view=diff ============================================================================== --- tomcat/trunk/test/webapp/bug5nnnn/bug57141.jsp (original) +++ tomcat/trunk/test/webapp/bug5nnnn/bug57141.jsp Sat Nov 1 22:07:55 2014 @@ -18,5 +18,9 @@ <body> <p>00-${Boolean.TRUE}</p> <p>01-${Boolean.FALSE}</p> + <% + pageContext.getELContext().getImportHandler().importStatic("java.lang.Integer.MAX_VALUE"); + %> + <p>02-${MAX_VALUE}</p> </body> </html> \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org