Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48009
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 21 Oct 2009 20:53:47 +0000 (20:53 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 21 Oct 2009 20:53:47 +0000 (20:53 +0000)
Add a check in case the file is in the middle of being renamed. It isn't perfect (it can't be) but this should cover most cases

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

java/org/apache/catalina/startup/HostConfig.java

index 9ff98b7..3d28825 100644 (file)
@@ -1103,6 +1103,17 @@ public class HostConfig
                     return;
                 }
             } else {
+                // There is a chance the the resource was only missing
+                // temporarily eg renamed during a text editor save
+                try {
+                    Thread.sleep(500);
+                } catch (InterruptedException e1) {
+                    // Ignore
+                }
+                // Recheck the resource to see if it was really deleted
+                if (resource.exists()) {
+                    continue;
+                }
                 long lastModified =
                     app.redeployResources.get(resources[i]).longValue();
                 if (lastModified == 0L) {