You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/08/13 14:53:19 UTC
svn commit: r1804923 - in
/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp:
./ jasper/ jasper/compiler/ jasper/runtime/
Author: cziegeler
Date: Sun Aug 13 14:53:19 2017
New Revision: 1804923
URL: http://svn.apache.org/viewvc?rev=1804923&view=rev
Log:
SLING-7044 : Scripted tag files are not found
Removed:
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/EmbeddedServletOptions.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/OriginalTldLocationsCache.java
Modified:
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/SlingTldLocationsCache.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/ParserController.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagFileProcessor.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagLibraryInfoImpl.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TldLocationsCache.java
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ProtectedFunctionMapper.java
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/SlingTldLocationsCache.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/SlingTldLocationsCache.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/SlingTldLocationsCache.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/SlingTldLocationsCache.java Sun Aug 13 14:53:19 2017
@@ -46,7 +46,7 @@ public class SlingTldLocationsCache
private static final String TLD_SCHEME = "tld:";
- private final Map<String, TldLocationEntry> tldLocations = new HashMap<String, TldLocationEntry>();
+ private final Map<String, TldLocationEntry> tldLocations = new HashMap<>();
private ServiceRegistration serviceRegistration;
@@ -62,7 +62,7 @@ public class SlingTldLocationsCache
}
}
- Dictionary<String, Object> tldConfigPrinterProperties = new Hashtable<String, Object>();
+ Dictionary<String, Object> tldConfigPrinterProperties = new Hashtable<>();
tldConfigPrinterProperties.put("felix.webconsole.label", "jsptaglibs");
tldConfigPrinterProperties.put("felix.webconsole.title", "JSP Taglibs");
tldConfigPrinterProperties.put("felix.webconsole.configprinter.modes", "always");
@@ -81,6 +81,7 @@ public class SlingTldLocationsCache
// ---------- Tld Location URL support -------------------------------------
+ @Override
public void bundleChanged(final BundleEvent event) {
if ( event.getType() == BundleEvent.RESOLVED ) {
this.addBundle(event.getBundle());
@@ -89,7 +90,7 @@ public class SlingTldLocationsCache
}
}
- URL getTldLocationURL(String tldLocation) {
+ public URL getTldLocationURL(String tldLocation) {
if (tldLocation.startsWith(TLD_SCHEME)) {
tldLocation = tldLocation.substring(TLD_SCHEME.length());
@@ -111,8 +112,9 @@ public class SlingTldLocationsCache
@Override
public String[] getLocation(final String uri) throws JasperException {
synchronized (tldLocations) {
- if (tldLocations.containsKey(uri)) {
- return new String[] { TLD_SCHEME + uri, null };
+ final TldLocationEntry entry = tldLocations.get(uri);
+ if ( entry != null ) {
+ return new String[] { TLD_SCHEME + uri, entry.getTldURL().toString() };
}
}
@@ -187,7 +189,7 @@ public class SlingTldLocationsCache
public void printConfiguration(final PrintWriter pw) {
pw.println("Currently available JSP Taglibs:");
- final SortedMap<String, String> taglibs = new TreeMap<String, String>();
+ final SortedMap<String, String> taglibs = new TreeMap<>();
for (final Map.Entry<String, TldLocationEntry> entry : tldLocations.entrySet()) {
final long bundleId = entry.getValue().getBundleId();
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java Sun Aug 13 14:53:19 2017
@@ -108,7 +108,7 @@ public class JspCompilationContext {
}
this.rctxt = rctxt;
- this.tagFileJarUrls = new HashMap<String, URL>();
+ this.tagFileJarUrls = new HashMap<>();
this.basePackageName = Constants.JSP_PACKAGE_NAME;
this.defaultIsSession = defaultIsSession;
}
@@ -269,6 +269,14 @@ public class JspCompilationContext {
this.tagFileJarUrls.put(tagFile, tagFileURL);
}
+ public URL getTagFileUrl(String tagFile) {
+ return this.tagFileJarUrls.get("tagfile:" + tagFile);
+ }
+
+ public void setTagFileUrl(String tagFile, URL tagFileURL) {
+ this.tagFileJarUrls.put("tagfile:" + tagFile, tagFileURL);
+ }
+
/**
* Returns the JAR file in which the tag file for which this
* JspCompilationContext was created is packaged, or null if this
@@ -562,7 +570,7 @@ public class JspCompilationContext {
private static final String canonicalURI(String s) {
if (s == null) return null;
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
final int len = s.length();
int pos = 0;
while (pos < len) {
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java Sun Aug 13 14:53:19 2017
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
+import java.net.URL;
import java.util.Vector;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
@@ -612,6 +613,7 @@ public class JspUtil {
* (not thread-safe)
* @deprecated
*/
+ @Deprecated
public static void resetTemporaryVariableName() {
tempSequenceNumber = 0;
}
@@ -621,6 +623,7 @@ public class JspUtil {
* (not thread-safe)
* @deprecated
*/
+ @Deprecated
public static String nextTemporaryVariableName() {
return Constants.TEMP_VARIABLE_NAME_PREFIX + (tempSequenceNumber++);
}
@@ -834,22 +837,31 @@ public class JspUtil {
InputStream in = null;
- if (jarFile != null) {
- String jarEntryName = fname.substring(1, fname.length());
- ZipEntry jarEntry = jarFile.getEntry(jarEntryName);
- if (jarEntry == null) {
- err.jspError("jsp.error.file.not.found", fname);
+ if (jarFile != null) {
+ String jarEntryName = fname.substring(1, fname.length());
+ ZipEntry jarEntry = jarFile.getEntry(jarEntryName);
+ if (jarEntry == null) {
+ err.jspError("jsp.error.file.not.found", fname);
+ }
+ in = jarFile.getInputStream(jarEntry);
+ } else {
+ if ( fname.startsWith(META_INF_TAGS) ) {
+ final URL url = ctxt.getTagFileUrl(fname);
+ if ( url != null ) {
+ return url.openConnection().getInputStream();
+ }
+ }
+ in = ctxt.getResourceAsStream(fname);
+ if ( in == null ) {
+ in = ctxt.getInputStream(fname);
+ }
}
- in = jarFile.getInputStream(jarEntry);
- } else {
- in = ctxt.getResourceAsStream(fname);
- }
- if (in == null) {
- err.jspError("jsp.error.file.not.found", fname);
- }
+ if (in == null) {
+ err.jspError("jsp.error.file.not.found", fname);
+ }
- return in;
+ return in;
}
/**
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/ParserController.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/ParserController.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/ParserController.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/ParserController.java Sun Aug 13 14:53:19 2017
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -74,7 +74,7 @@ class ParserController implements TagCon
* Constructor
*/
public ParserController(JspCompilationContext ctxt, Compiler compiler) {
- this.ctxt = ctxt;
+ this.ctxt = ctxt;
this.compiler = compiler;
this.err = compiler.getErrorDispatcher();
}
@@ -95,7 +95,7 @@ class ParserController implements TagCon
public Node.Nodes parse(String inFileName)
throws FileNotFoundException, JasperException, IOException {
// If we're parsing a packaged tag file or a resource included by it
- // (using an include directive), ctxt.getTagFileJar() returns the
+ // (using an include directive), ctxt.getTagFileJar() returns the
// JAR file from which to read the tag file or included resource,
// respectively.
isTagFile = ctxt.isTagFile();
@@ -123,7 +123,7 @@ class ParserController implements TagCon
* Extracts tag file directive information from the tag file with the
* given name.
*
- * This is invoked by the compiler
+ * This is invoked by the compiler
*
* @param inFileName The name of the tag file to be parsed.
*/
@@ -158,7 +158,6 @@ class ParserController implements TagCon
Node parent,
URL jarFileUrl)
throws FileNotFoundException, JasperException, IOException {
-
Node.Nodes parsedPage = null;
isEncodingSpecifiedInProlog = false;
isBomPresent = false;
@@ -245,7 +244,7 @@ class ParserController implements TagCon
*
* @param absFileName The URI to match
*
- * @return The value of the <page-encoding> attribute of the
+ * @return The value of the <page-encoding> attribute of the
* jsp-property-group with matching URL pattern
*/
private String getJspConfigPageEncoding(String absFileName)
@@ -326,7 +325,7 @@ class ParserController implements TagCon
* We need to be careful, because the page may be encoded in
* ISO-8859-1 (or something entirely different), and may
* contain byte sequences that will cause a UTF-8 converter to
- * throw exceptions.
+ * throw exceptions.
*
* It is safe to use a source encoding of ISO-8859-1 in this
* case, as there are no invalid byte sequences in ISO-8859-1,
@@ -348,11 +347,11 @@ class ParserController implements TagCon
/*
* At this point, 'isExternal' or 'isXml' is FALSE.
- * Search for jsp:root action, in order to determine if we're dealing
- * with XML or standard syntax (unless we already know what we're
+ * Search for jsp:root action, in order to determine if we're dealing
+ * with XML or standard syntax (unless we already know what we're
* dealing with, i.e., when 'isExternal' is TRUE and 'isXml' is FALSE).
* No check for XML prolog, since nothing prevents a page from
- * outputting XML and still using JSP syntax (in this case, the
+ * outputting XML and still using JSP syntax (in this case, the
* XML prolog is treated as template text).
*/
JspReader jspReader = null;
@@ -397,7 +396,7 @@ class ParserController implements TagCon
}
}
}
-
+
}
/*
@@ -510,9 +509,9 @@ class ParserController implements TagCon
private String resolveFileName(String inFileName) {
String fileName = inFileName.replace('\\', '/');
boolean isAbsolute = fileName.startsWith("/");
- fileName = isAbsolute ? fileName
+ fileName = isAbsolute ? fileName
: (String) baseDirStack.peek() + fileName;
- String baseDir =
+ String baseDir =
fileName.substring(0, fileName.lastIndexOf("/") + 1);
baseDirStack.push(baseDir);
return fileName;
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagFileProcessor.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagFileProcessor.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagFileProcessor.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagFileProcessor.java Sun Aug 13 14:53:19 2017
@@ -533,7 +533,6 @@ class TagFileProcessor {
*/
private void loadTagFile(Compiler compiler, String tagFilePath,
Node.CustomTag n, PageInfo parentPageInfo) throws JasperException {
-
JspCompilationContext ctxt = compiler.getCompilationContext();
JspRuntimeContext rctxt = ctxt.getRuntimeContext();
@@ -671,7 +670,7 @@ class TagFileProcessor {
public void loadTagFiles(Compiler compiler, Node.Nodes page)
throws JasperException {
- tempVector = new Vector<Compiler>();
+ tempVector = new Vector<>();
page.visit(new TagFileLoaderVisitor(compiler));
}
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagLibraryInfoImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagLibraryInfoImpl.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagLibraryInfoImpl.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TagLibraryInfoImpl.java Sun Aug 13 14:53:19 2017
@@ -23,6 +23,7 @@ import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.JarURLConnection;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collection;
import java.util.Enumeration;
@@ -82,6 +83,7 @@ class TagLibraryInfoImpl extends TagLibr
}
}
+ @Override
public String toString() {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
@@ -200,6 +202,7 @@ class TagLibraryInfoImpl extends TagLibr
}
+ @Override
public TagLibraryInfo[] getTagLibraryInfos() {
Collection coll = pi.getTaglibs();
return (TagLibraryInfo[]) coll.toArray(new TagLibraryInfo[0]);
@@ -477,7 +480,24 @@ class TagLibraryInfoImpl extends TagLibr
if (path.startsWith("/META-INF/tags")) {
// Tag file packaged in JAR
- ctxt.setTagFileJarUrl(path, jarFileUrl);
+ if ( jarFileUrl != null ) {
+ ctxt.setTagFileJarUrl(path, jarFileUrl);
+ } else {
+ final URL baseUrl = ctxt.getOptions().getTldLocationsCache().getTldLocationURL(uri);
+ if ( baseUrl != null ) {
+ final String baseUrlStr = baseUrl.toString();
+ final int index = baseUrlStr.indexOf("/META-INF/");
+ if ( index != -1 ) {
+ URL finalUrl;
+ try {
+ finalUrl = new URL(baseUrlStr.substring(0, index) + path);
+ ctxt.setTagFileUrl(path, finalUrl);
+ } catch (MalformedURLException e) {
+ // we ignore this
+ }
+ }
+ }
+ }
} else if (!path.startsWith("/WEB-INF/tags")) {
err.jspError("jsp.error.tagfile.illegalPath", path);
}
@@ -492,7 +512,7 @@ class TagLibraryInfoImpl extends TagLibr
String type = null;
String expectedType = null;
String methodSignature = null;
- boolean required = false, rtexprvalue = false, reqTime = false, isFragment = false, deferredValue = false, deferredMethod = false;
+ boolean required = false, rtexprvalue = false, isFragment = false, deferredValue = false, deferredMethod = false;
Iterator list = elem.findChildren();
while (list.hasNext()) {
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TldLocationsCache.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TldLocationsCache.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/TldLocationsCache.java Sun Aug 13 14:53:19 2017
@@ -17,6 +17,8 @@
package org.apache.sling.scripting.jsp.jasper.compiler;
+import java.net.URL;
+
import org.apache.sling.scripting.jsp.jasper.JasperException;
@@ -64,6 +66,8 @@ public abstract class TldLocationsCache
public abstract String[] getLocation(String uri) throws JasperException;
+ public abstract URL getTldLocationURL(String tldLocation);
+
/**
* Returns the type of a URI:
* ABS_URI
Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ProtectedFunctionMapper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ProtectedFunctionMapper.java?rev=1804923&r1=1804922&r2=1804923&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ProtectedFunctionMapper.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ProtectedFunctionMapper.java Sun Aug 13 14:53:19 2017
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,12 +17,13 @@
package org.apache.sling.scripting.jsp.jasper.runtime;
-import java.util.HashMap;
+import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
-import java.lang.reflect.Method;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+
import javax.servlet.jsp.el.FunctionMapper;
import org.apache.sling.scripting.jsp.jasper.security.SecurityUtil;
@@ -30,7 +31,7 @@ import org.apache.sling.scripting.jsp.ja
/**
* Maps EL functions to their Java method counterparts. Keeps the actual Method
* objects protected so that JSP pages can't indirectly do reflection.
- *
+ *
* @author Mark Roth
* @author Kin-man Chung
*/
@@ -40,12 +41,12 @@ public final class ProtectedFunctionMapp
/**
* Maps "prefix:name" to java.lang.Method objects.
*/
- private HashMap fnmap = null;
+ private HashMap<String, Method> fnmap;
/**
* If there is only one function in the map, this is the Method for it.
*/
- private Method theMethod = null;
+ private Method theMethod;
/**
* Constructor has protected access.
@@ -58,29 +59,30 @@ public final class ProtectedFunctionMapp
* retrieve an instance of the ProtectedFunctionMapper. This is necessary
* since generated code does not have access to create instances of classes
* in this package.
- *
+ *
* @return A new protected function mapper.
*/
public static ProtectedFunctionMapper getInstance() {
ProtectedFunctionMapper funcMapper;
if (SecurityUtil.isPackageProtectionEnabled()) {
- funcMapper = (ProtectedFunctionMapper) AccessController
- .doPrivileged(new PrivilegedAction() {
- public Object run() {
+ funcMapper = AccessController
+ .doPrivileged(new PrivilegedAction<ProtectedFunctionMapper>() {
+ @Override
+ public ProtectedFunctionMapper run() {
return new ProtectedFunctionMapper();
}
});
} else {
funcMapper = new ProtectedFunctionMapper();
}
- funcMapper.fnmap = new java.util.HashMap();
+ funcMapper.fnmap = new java.util.HashMap<>();
return funcMapper;
}
/**
* Stores a mapping from the given EL function prefix and name to the given
* Java method.
- *
+ *
* @param fnQName
* The EL function qualified name (including prefix)
* @param c
@@ -92,15 +94,16 @@ public final class ProtectedFunctionMapp
* @throws RuntimeException
* if no method with the given signature could be found.
*/
- public void mapFunction(String fnQName, final Class c,
- final String methodName, final Class[] args) {
+ public void mapFunction(String fnQName, final Class<?> c,
+ final String methodName, final Class<?>[] args) {
java.lang.reflect.Method method;
if (SecurityUtil.isPackageProtectionEnabled()) {
try {
- method = (java.lang.reflect.Method) AccessController
- .doPrivileged(new PrivilegedExceptionAction() {
+ method = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Method>() {
- public Object run() throws Exception {
+ @Override
+ public Method run() throws Exception {
return c.getDeclaredMethod(methodName, args);
}
});
@@ -126,7 +129,7 @@ public final class ProtectedFunctionMapp
* Creates an instance for this class, and stores the Method for the given
* EL function prefix and name. This method is used for the case when there
* is only one function in the EL expression.
- *
+ *
* @param fnQName
* The EL function qualified name (including prefix)
* @param c
@@ -139,22 +142,24 @@ public final class ProtectedFunctionMapp
* if no method with the given signature could be found.
*/
public static ProtectedFunctionMapper getMapForFunction(String fnQName,
- final Class c, final String methodName, final Class[] args) {
+ final Class<?> c, final String methodName, final Class<?>[] args) {
java.lang.reflect.Method method;
ProtectedFunctionMapper funcMapper;
if (SecurityUtil.isPackageProtectionEnabled()) {
- funcMapper = (ProtectedFunctionMapper) AccessController
- .doPrivileged(new PrivilegedAction() {
- public Object run() {
+ funcMapper = AccessController
+ .doPrivileged(new PrivilegedAction<ProtectedFunctionMapper>() {
+ @Override
+ public ProtectedFunctionMapper run() {
return new ProtectedFunctionMapper();
}
});
try {
- method = (java.lang.reflect.Method) AccessController
- .doPrivileged(new PrivilegedExceptionAction() {
+ method = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Method>() {
- public Object run() throws Exception {
+ @Override
+ public Method run() throws Exception {
return c.getDeclaredMethod(methodName, args);
}
});
@@ -180,16 +185,17 @@ public final class ProtectedFunctionMapp
/**
* Resolves the specified local name and prefix into a Java.lang.Method.
* Returns null if the prefix and local name are not found.
- *
+ *
* @param prefix
* the prefix of the function
* @param localName
* the short name of the function
* @return the result of the method mapping. Null means no entry found.
*/
+ @Override
public Method resolveFunction(String prefix, String localName) {
if (this.fnmap != null) {
- return (Method) this.fnmap.get(prefix + ":" + localName);
+ return this.fnmap.get(prefix + ":" + localName);
}
return theMethod;
}