Author: violetagg
Date: Wed Dec 18 19:28:21 2013
New Revision: 1552071
URL: http://svn.apache.org/r1552071
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55905
Prevent NPE when the specified tld resource does not exists.
Modified:
tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java
Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1552071&r1=1552070&r2=1552071&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Wed
Dec 18 19:28:21 2013
@@ -402,4 +402,4 @@ org.apache.jasper.compiler.TldCache.serv
org.apache.jasper.servlet.JasperInitializer.onStartup=Initializing Jasper for
context [{0}]
org.apache.jasper.servlet.TldScanner.webxmlSkip=Skipping load of TLD for URI
{1} from resource path {0} as it has already been defined in <jsp-config>
org.apache.jasper.servlet.TldScanner.webxmlAdd=Loading TLD for URI {1} from
resource path {0}
-
+org.apache.jasper.servlet.TldScanner.webxmlFailPathDoesNotExist=Failed to
process TLD with path [{0}] and URI [{1}]. The specified path does not exist.
Modified: tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java?rev=1552071&r1=1552070&r2=1552071&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/TldScanner.java Wed Dec 18
19:28:21 2013
@@ -175,21 +175,27 @@ public class TldScanner {
}
URL url = context.getResource(resourcePath);
- TldResourcePath tldResourcePath;
- if (resourcePath.endsWith(".jar")) {
- // if the path points to a jar file, the TLD is presumed to be
- // inside at META-INF/taglib.tld
- tldResourcePath = new TldResourcePath(
- url, resourcePath, "META-INF/taglib.tld");
+ if (url != null) {
+ TldResourcePath tldResourcePath;
+ if (resourcePath.endsWith(".jar")) {
+ // if the path points to a jar file, the TLD is presumed
to be
+ // inside at META-INF/taglib.tld
+ tldResourcePath = new TldResourcePath(url, resourcePath,
"META-INF/taglib.tld");
+ } else {
+ tldResourcePath = new TldResourcePath(url, resourcePath);
+ }
+ // parse TLD but store using the URI supplied in the descriptor
+ TaglibXml tld = tldParser.parse(tldResourcePath);
+ uriTldResourcePathMap.put(taglibURI, tldResourcePath);
+ tldResourcePathTaglibXmlMap.put(tldResourcePath, tld);
+ if (tld.getListeners() != null) {
+ listeners.addAll(tld.getListeners());
+ }
} else {
- tldResourcePath = new TldResourcePath(url, resourcePath);
- }
- // parse TLD but store using the URI supplied in the descriptor
- TaglibXml tld = tldParser.parse(tldResourcePath);
- uriTldResourcePathMap.put(taglibURI, tldResourcePath);
- tldResourcePathTaglibXmlMap.put(tldResourcePath, tld);
- if (tld.getListeners() != null) {
- listeners.addAll(tld.getListeners());
+ log.warn(Localizer.getMessage(MSG +
".webxmlFailPathDoesNotExist",
+ resourcePath,
+ taglibURI));
+ continue;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]