From c67cd35ccc6cad2f7d5a039c2abbe193a31bf494 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 11 Jun 2009 13:48:42 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@783766 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/startup/HostConfig.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/java/org/apache/catalina/startup/HostConfig.java b/java/org/apache/catalina/startup/HostConfig.java index 66cd96332..ec80600cf 100644 --- a/java/org/apache/catalina/startup/HostConfig.java +++ b/java/org/apache/catalina/startup/HostConfig.java @@ -835,8 +835,6 @@ public class HostConfig } } context.setConfigFile(xml.getAbsolutePath()); - deployedApp.redeployResources.put - (xml.getAbsolutePath(), new Long(xml.lastModified())); } else { context = (Context) Class.forName(contextClass).newInstance(); } @@ -845,6 +843,11 @@ public class HostConfig 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 @@ public class HostConfig 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 @@ public class HostConfig 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 @@ public class HostConfig } } context.setConfigFile(xmlCopy.getAbsolutePath()); - deployedApp.redeployResources.put - (xmlCopy.getAbsolutePath(), new Long(xmlCopy.lastModified())); } else { context = (Context) Class.forName(contextClass).newInstance(); } @@ -992,6 +994,10 @@ public class HostConfig 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); -- 2.11.0