Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49978
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 7 Oct 2010 14:13:44 +0000 (14:13 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 7 Oct 2010 14:13:44 +0000 (14:13 +0000)
Don't try to create directories that already exist

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

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

index 132a37f..8037cb4 100644 (file)
@@ -884,9 +884,11 @@ public class WebappLoader extends LifecycleMBeanBase
             } else {
 
                 classRepository = new File(workDir, classesPath);
-                if (!classRepository.mkdirs())
-                    throw new IOException(
-                            sm.getString("webappLoader.mkdirFailure"));
+                if (!classRepository.isDirectory()) {
+                    if (!classRepository.mkdirs())
+                        throw new IOException(
+                                sm.getString("webappLoader.mkdirFailure"));
+                }
                 if (!copyDir(classes, classRepository)) {
                     throw new IOException(
                             sm.getString("webappLoader.copyFailure"));
@@ -934,9 +936,11 @@ public class WebappLoader extends LifecycleMBeanBase
             } else {
                 copyJars = true;
                 destDir = new File(workDir, libPath);
-                if (!destDir.mkdirs())
-                    throw new IOException(
-                            sm.getString("webappLoader.mkdirFailure"));
+                if (!destDir.isDirectory()) {
+                    if (!destDir.mkdirs())
+                        throw new IOException(
+                                sm.getString("webappLoader.mkdirFailure"));
+                }
             }
 
             // Looking up directory /WEB-INF/lib in the context