Author: pero
Date: Sun Jan 20 06:01:52 2008
New Revision: 613558

URL: http://svn.apache.org/viewvc?rev=613558&view=rev
Log:
FIX: WatchedResource does not work if app is outside "webapps"

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=613558&r1=613557&r2=613558&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Sun Jan 20 
06:01:52 2008
@@ -636,11 +636,15 @@
                     name = path;
                 }
             }
-            File expandedDocBase = new File(name);
-            File warDocBase = new File(name + ".war");
-            if (!expandedDocBase.isAbsolute()) {
-                expandedDocBase = new File(appBase(), name);
-                warDocBase = new File(appBase(), name + ".war");
+            // default to appBase dir + name
+            File expandedDocBase = new File(appBase(), name);
+            if (context.getDocBase() != null) {
+                // first assume docBase is absolute
+                expandedDocBase = new File(context.getDocBase());
+                if (!expandedDocBase.isAbsolute()) {
+                    // if docBase specified and relative, it must be relative 
to appBase
+                    expandedDocBase = new File(appBase(), 
context.getDocBase());
+                }
             }
             // Add the eventual unpacked WAR and all the resources which will 
be
             // watched inside it
@@ -652,6 +656,7 @@
                 addWatchedResources(deployedApp, 
expandedDocBase.getAbsolutePath(), context);
             } else {
                 // Find an existing matching war and expanded folder
+                File warDocBase = new File(expandedDocBase.getAbsolutePath() + 
".war");
                 if (warDocBase.exists()) {
                     
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
                             new Long(warDocBase.lastModified()));
@@ -966,9 +971,13 @@
                 if (docBase != null) {
                     resource = new File(docBaseFile, watchedResources[i]);
                 } else {
+                    if(log.isDebugEnabled())
+                        log.debug("Ignoring non-existent WatchedResource '" + 
resource.getAbsolutePath() + "'");
                     continue;
                 }
             }
+            if(log.isDebugEnabled())
+                log.debug("Watching WatchedResource '" + 
resource.getAbsolutePath() + "'");
             app.reloadResources.put(resource.getAbsolutePath(), 
                     new Long(resource.lastModified()));
         }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=613558&r1=613557&r2=613558&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sun Jan 20 06:01:52 2008
@@ -46,6 +46,9 @@
   </subsection>
   <subsection name="Catalina">
     <changelog>
+      <fix><bug>38131</bug>: WatchedResource does not work if app is outside 
host appbase webapps. 
+        Patch provided by Gernot Pfingstl (pero)
+      </fix>
       <fix><bug>44261</bug>: Fix "Restricted listeners property file not 
found" message fix.  Patch provided by
         David Jencks. (pero)
       </fix>  



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to