Author: remy.maucherat(a)jboss.com
Date: 2010-11-23 04:27:56 -0500 (Tue, 23 Nov 2010)
New Revision: 1580
Modified:
trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java
trunk/webapps/docs/changelog.xml
Log:
- 49555: Fix use of static inner classes in taglibs.
Modified: trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java 2010-11-19 16:06:19 UTC
(rev 1579)
+++ trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java 2010-11-23 09:27:56 UTC
(rev 1580)
@@ -17,8 +17,12 @@
package org.apache.jasper.compiler;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.*;
import javax.servlet.jsp.tagext.FunctionInfo;
+
+import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
/**
@@ -201,9 +205,9 @@
FunctionInfo funcInfo = f.getFunctionInfo();
String key = f.getPrefix()+ ":" + f.getName();
ds.append(funcMethod + "(\"" + key + "\", " +
- funcInfo.getFunctionClass() + ".class, " +
- '\"' + f.getMethodName() + "\", " +
- "new Class[] {");
+ getCanonicalName(funcInfo.getFunctionClass()) +
+ ".class, " + '\"' + f.getMethodName() + "\",
" +
+ "new Class[] {");
String params[] = f.getParameters();
for (int k = 0; k < params.length; k++) {
if (k != 0) {
@@ -241,7 +245,42 @@
el.setMapName(decName);
}
- /**
+ /**
+ * Convert a binary class name into a canonical one that can be used
+ * when generating Java source code.
+ *
+ * @param className Binary class name
+ * @return Canonical equivalent
+ */
+ private String getCanonicalName(String className) throws JasperException {
+ Class<?> clazz;
+
+ ClassLoader tccl;
+ if (Constants.IS_SECURITY_ENABLED) {
+ PrivilegedAction<ClassLoader> pa = new PrivilegedGetTccl();
+ tccl = AccessController.doPrivileged(pa);
+ } else {
+ tccl = Thread.currentThread().getContextClassLoader();
+ }
+
+ try {
+ clazz = Class.forName(className, true, tccl);
+ } catch (ClassNotFoundException e) {
+ throw new JasperException(e);
+ }
+ return clazz.getCanonicalName();
+ }
+ }
+
+ private static class PrivilegedGetTccl
+ implements PrivilegedAction<ClassLoader> {
+
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ }
+
+ /**
* Find the name of the function mapper for an EL. Reuse a
* previously generated one if possible.
* @param functions An ArrayList of ELNode.Function instances that
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2010-11-19 16:06:19 UTC (rev 1579)
+++ trunk/webapps/docs/changelog.xml 2010-11-23 09:27:56 UTC (rev 1580)
@@ -43,6 +43,9 @@
<bug>50192</bug>: Fix regression getting the EL resolver. Tighter
security can
be enabled back. (remm)
</fix>
+ <fix>
+ <bug>49555</bug>: Fix use of static inner classes in taglibs.
(markt)
+ </fix>
</changelog>
</subsection>
</section>
Show replies by date