Author: pero
Date: Mon Jan 21 00:41:31 2008
New Revision: 613796

URL: http://svn.apache.org/viewvc?rev=613796&view=rev
Log:
WatchedResource doesn't work if app is outside host appbase webapps
Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=613796&r1=613795&r2=613796&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jan 21 00:41:31 2008
@@ -68,12 +68,6 @@
                      "FarmWarDeployer can only work if parent of "
       rjung - "is an engine!" -> " is an engine!" (space added)
               "work at Host" -> "work as Host"
-
-* Fix WatchedResource does not work if app is outside "webapps"
-  http://issues.apache.org/bugzilla/show_bug.cgi?id=38131
-  http://svn.apache.org/viewvc?rev=613558&view=rev
-  +1: pero, markt, rjung
-  -1:
   
 * Update JNDI docs to use server.xml less and <Context> more
   http://svn.apache.org/viewvc?rev=613689&view=rev

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=613796&r1=613795&r2=613796&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java Mon 
Jan 21 00:41:31 2008
@@ -636,11 +636,14 @@
                     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");
+            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,7 +655,8 @@
                 addWatchedResources(deployedApp, 
expandedDocBase.getAbsolutePath(), context);
             } else {
                 // Find an existing matching war and expanded folder
-                if (warDocBase.exists()) {
+               File warDocBase = new File(expandedDocBase.getAbsolutePath() + 
".war");
+               if (warDocBase.exists()) {
                     
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
                             new Long(warDocBase.lastModified()));
                 }
@@ -966,9 +970,14 @@
                 if (docBase != null) {
                     resource = new File(docBaseFile, watchedResources[i]);
                 } else {
-                    continue;
+                    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/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=613796&r1=613795&r2=613796&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Mon Jan 21 00:41:31 2008
@@ -100,6 +100,9 @@
   </subsection>
   <subsection name="Catalina">
     <changelog>
+      <fix><bug>38131</bug>: WatchedResource doesn't work if app is outside 
host appbase webapps. 
+        Patch provided by Gernot Pfingstl (pero)
+      </fix>
       <update>Add -Dorg.apache.catalina.tribes.dns_lookups=false as default. 
The ability to turn off reverse DNS lookups for membership.(fhanik)</update>
       <fix>
          Set correct StandardManager.sessionCounter after reload/restart. 
(pero)



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

Reply via email to