Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=39013
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 9 Feb 2009 19:39:40 +0000 (19:39 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 9 Feb 2009 19:39:40 +0000 (19:39 +0000)
When testing for invalid docBase, test for an exact match with the appBase dir

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

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

index 0b0644c..a2a7cd8 100644 (file)
@@ -1079,7 +1079,7 @@ public class HostConfig
                         try {
                             File current = new File(resources[j]);
                             current = current.getCanonicalFile();
-                            if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
+                            if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
                                     || (current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
                                 if (log.isDebugEnabled())
                                     log.debug("Delete " + current);
@@ -1120,7 +1120,7 @@ public class HostConfig
                     try {
                         File current = new File(resources[j]);
                         current = current.getCanonicalFile();
-                        if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
+                        if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
                             || (current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
                             if (log.isDebugEnabled())
                                 log.debug("Delete " + current);
@@ -1138,7 +1138,7 @@ public class HostConfig
                     try {
                         File current = new File(resources2[j]);
                         current = current.getCanonicalFile();
-                        if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
+                        if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
                             || ((current.getAbsolutePath().startsWith(configBase().getAbsolutePath())
                                  && (current.getAbsolutePath().endsWith(".xml"))))) {
                             if (log.isDebugEnabled())