Author: markt
Date: Thu Jun 11 13:48:42 2009
New Revision: 783766
URL: http://svn.apache.org/viewvc?rev=783766&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47343
Regression in https://issues.apache.org/bugzilla/show_bug.cgi?id=42747
context.xml can now be edited without resources being deleted
Modified:
tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
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=783766&r1=783765&r2=783766&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Thu Jun 11
13:48:42 2009
@@ -835,8 +835,6 @@
}
}
context.setConfigFile(xml.getAbsolutePath());
- deployedApp.redeployResources.put
- (xml.getAbsolutePath(), new Long(xml.lastModified()));
} else {
context = (Context) Class.forName(contextClass).newInstance();
}
@@ -845,6 +843,11 @@
deployedApp.redeployResources.put
(war.getAbsolutePath(), new Long(war.lastModified()));
+ if (deployXML && xml.exists()) {
+ deployedApp.redeployResources.put
+ (xml.getAbsolutePath(), new Long(xml.lastModified()));
+ }
+
if (context instanceof Lifecycle) {
Class<?> clazz = Class.forName(host.getConfigClass());
LifecycleListener listener =
@@ -938,6 +941,7 @@
try {
Context context = null;
File xml = new File(dir, Constants.ApplicationContextXml);
+ File xmlCopy = null;
if (deployXML && xml.exists()) {
// Will only do this on initial deployment. On subsequent
// deployments the copied xml file means we'll use
@@ -954,7 +958,7 @@
digester.reset();
}
}
- File xmlCopy = new File(configBase(), file + ".xml");
+ xmlCopy = new File(configBase(), file + ".xml");
InputStream is = null;
OutputStream os = null;
try {
@@ -975,8 +979,6 @@
}
}
context.setConfigFile(xmlCopy.getAbsolutePath());
- deployedApp.redeployResources.put
- (xmlCopy.getAbsolutePath(), new
Long(xmlCopy.lastModified()));
} else {
context = (Context) Class.forName(contextClass).newInstance();
}
@@ -992,6 +994,10 @@
host.addChild(context);
deployedApp.redeployResources.put(dir.getAbsolutePath(),
new Long(dir.lastModified()));
+ if (xmlCopy != null) {
+ deployedApp.redeployResources.put
+ (xmlCopy.getAbsolutePath(), new Long(xmlCopy.lastModified()));
+ }
addWatchedResources(deployedApp, dir.getAbsolutePath(), context);
} catch (Throwable t) {
log.error(sm.getString("hostConfig.deployDir.error", file), t);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]