Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45785
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 14 Sep 2008 20:01:21 +0000 (20:01 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 14 Sep 2008 20:01:21 +0000 (20:01 +0000)
Ignore directories named xxx.jar in WEB-INF/lib

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@695274 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/loader/WebappLoader.java
java/org/apache/catalina/util/ExtensionValidator.java

index 1734f4b..30453db 100644 (file)
@@ -994,6 +994,10 @@ public class WebappLoader
                     // impossible to update it or remove it at runtime)
                     File destFile = new File(destDir, binding.getName());
 
+                    // Ignore directories named xxx.jar
+                    if (destFile.isDirectory())
+                        continue;
+
                     if( log.isDebugEnabled())
                     log.debug(sm.getString("webappLoader.jarDeploy", filename,
                                      destFile.getAbsolutePath()));
index a4763d3..4f7caa0 100644 (file)
@@ -180,8 +180,13 @@ public final class ExtensionValidator {
                 if (!binding.getName().toLowerCase().endsWith(".jar")) {
                     continue;
                 }
-                Resource resource = (Resource)dirContext.lookup
-                                        ("/WEB-INF/lib/" + binding.getName());
+                Object obj =
+                    dirContext.lookup("/WEB-INF/lib/" + binding.getName());
+                if (!(obj instanceof Resource)) {
+                    // Probably a directory named xxx.jar - ignore it
+                    continue;
+                }
+                Resource resource = (Resource) obj;
                 Manifest jmanifest = getManifest(resource.streamContent());
                 if (jmanifest != null) {
                     ManifestResource mre = new ManifestResource(