You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/01/24 09:42:45 UTC
[tomcat] branch master updated: Re-format,
no functional change in preparation for functional changes
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 0dacb91 Re-format, no functional change in preparation for functional changes
0dacb91 is described below
commit 0dacb9126de98843970dfff0e828eb42eefaeb69
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 22 19:14:15 2021 +0000
Re-format, no functional change in preparation for functional changes
---
java/org/apache/catalina/mbeans/MBeanFactory.java | 2 -
java/org/apache/catalina/startup/HostConfig.java | 241 +++++++++-------------
2 files changed, 93 insertions(+), 150 deletions(-)
diff --git a/java/org/apache/catalina/mbeans/MBeanFactory.java b/java/org/apache/catalina/mbeans/MBeanFactory.java
index 8ef53ce..2858615 100644
--- a/java/org/apache/catalina/mbeans/MBeanFactory.java
+++ b/java/org/apache/catalina/mbeans/MBeanFactory.java
@@ -440,7 +440,6 @@ public class MBeanFactory {
// Return the corresponding MBean name
return context.getObjectName().toString();
-
}
@@ -736,7 +735,6 @@ public class MBeanFactory {
}
}
-
}
diff --git a/java/org/apache/catalina/startup/HostConfig.java b/java/org/apache/catalina/startup/HostConfig.java
index fd81ad2..89d002a 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -417,7 +417,6 @@ public class HostConfig implements LifecycleListener {
* in our "application root" directory.
*/
protected void deployApps() {
-
File appBase = host.getAppBaseFile();
File configBase = host.getConfigBaseFile();
String[] filteredAppPaths = filterAppPaths(appBase.list());
@@ -427,7 +426,6 @@ public class HostConfig implements LifecycleListener {
deployWARs(appBase, filteredAppPaths);
// Deploy expanded folders
deployDirectories(appBase, filteredAppPaths);
-
}
@@ -495,8 +493,9 @@ public class HostConfig implements LifecycleListener {
}
// Deploy expanded folder
File dir = new File(appBase, baseName);
- if (dir.exists())
+ if (dir.exists()) {
deployDirectory(cn, dir);
+ }
}
@@ -507,8 +506,9 @@ public class HostConfig implements LifecycleListener {
*/
protected void deployDescriptors(File configBase, String[] files) {
- if (files == null)
+ if (files == null) {
return;
+ }
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
@@ -519,11 +519,11 @@ public class HostConfig implements LifecycleListener {
if (file.toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
ContextName cn = new ContextName(file, true);
- if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
+ if (isServiced(cn.getName()) || deploymentExists(cn.getName())) {
continue;
+ }
- results.add(
- es.submit(new DeployDescriptor(this, cn, contextXml)));
+ results.add(es.submit(new DeployDescriptor(this, cn, contextXml)));
}
}
@@ -531,8 +531,7 @@ public class HostConfig implements LifecycleListener {
try {
result.get();
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployDescriptor.threaded.error"), e);
+ log.error(sm.getString("hostConfig.deployDescriptor.threaded.error"), e);
}
}
}
@@ -546,15 +545,13 @@ public class HostConfig implements LifecycleListener {
@SuppressWarnings("null") // context is not null
protected void deployDescriptor(ContextName cn, File contextXml) {
- DeployedApplication deployedApp =
- new DeployedApplication(cn.getName(), true);
+ DeployedApplication deployedApp = new DeployedApplication(cn.getName(), true);
long startTime = 0;
// Assume this is a configuration descriptor and deploy it
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
startTime = System.currentTimeMillis();
- log.info(sm.getString("hostConfig.deployDescriptor",
- contextXml.getAbsolutePath()));
+ log.info(sm.getString("hostConfig.deployDescriptor", contextXml.getAbsolutePath()));
}
Context context = null;
@@ -567,9 +564,7 @@ public class HostConfig implements LifecycleListener {
try {
context = (Context) digester.parse(fis);
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployDescriptor.error",
- contextXml.getAbsolutePath()), e);
+ log.error(sm.getString("hostConfig.deployDescriptor.error", contextXml.getAbsolutePath()), e);
} finally {
digester.reset();
if (context == null) {
@@ -601,10 +596,9 @@ public class HostConfig implements LifecycleListener {
if (!docBase.getCanonicalFile().toPath().startsWith(host.getAppBaseFile().toPath())) {
isExternal = true;
deployedApp.redeployResources.put(
- contextXml.getAbsolutePath(),
- Long.valueOf(contextXml.lastModified()));
- deployedApp.redeployResources.put(docBase.getAbsolutePath(),
- Long.valueOf(docBase.lastModified()));
+ contextXml.getAbsolutePath(), Long.valueOf(contextXml.lastModified()));
+ deployedApp.redeployResources.put(
+ docBase.getAbsolutePath(), Long.valueOf(docBase.lastModified()));
if (docBase.getAbsolutePath().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
isExternalWar = true;
}
@@ -620,8 +614,7 @@ public class HostConfig implements LifecycleListener {
contextXml.getAbsolutePath(), dir.getAbsolutePath()));
}
} else {
- log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified",
- docBase));
+ log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified", docBase));
// Ignore specified docBase
context.setDocBase(null);
}
@@ -630,15 +623,13 @@ public class HostConfig implements LifecycleListener {
host.addChild(context);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error(sm.getString("hostConfig.deployDescriptor.error",
- contextXml.getAbsolutePath()), t);
+ log.error(sm.getString("hostConfig.deployDescriptor.error", contextXml.getAbsolutePath()), t);
} finally {
// Get paths for WAR and expanded WAR in appBase
// default to appBase dir + name
expandedDocBase = new File(host.getAppBaseFile(), cn.getBaseName());
- if (context.getDocBase() != null
- && !context.getDocBase().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
+ if (context.getDocBase() != null && !context.getDocBase().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
// first assume docBase is absolute
expandedDocBase = new File(context.getDocBase());
if (!expandedDocBase.isAbsolute()) {
@@ -656,8 +647,8 @@ public class HostConfig implements LifecycleListener {
// watched inside it
if (isExternalWar) {
if (unpackWAR) {
- deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
- Long.valueOf(expandedDocBase.lastModified()));
+ deployedApp.redeployResources.put(
+ expandedDocBase.getAbsolutePath(), Long.valueOf(expandedDocBase.lastModified()));
addWatchedResources(deployedApp, expandedDocBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
@@ -667,20 +658,17 @@ public class HostConfig implements LifecycleListener {
if (!isExternal) {
File warDocBase = new File(expandedDocBase.getAbsolutePath() + ".war");
if (warDocBase.exists()) {
- deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
- Long.valueOf(warDocBase.lastModified()));
+ deployedApp.redeployResources.put(
+ warDocBase.getAbsolutePath(), Long.valueOf(warDocBase.lastModified()));
} else {
// Trigger a redeploy if a WAR is added
- deployedApp.redeployResources.put(
- warDocBase.getAbsolutePath(),
- Long.valueOf(0));
+ deployedApp.redeployResources.put(warDocBase.getAbsolutePath(), Long.valueOf(0));
}
}
if (unpackWAR) {
- deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
- Long.valueOf(expandedDocBase.lastModified()));
- addWatchedResources(deployedApp,
- expandedDocBase.getAbsolutePath(), context);
+ deployedApp.redeployResources.put(
+ expandedDocBase.getAbsolutePath(), Long.valueOf(expandedDocBase.lastModified()));
+ addWatchedResources(deployedApp, expandedDocBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
@@ -688,8 +676,7 @@ public class HostConfig implements LifecycleListener {
// For external docBases, the context.xml will have been
// added above.
deployedApp.redeployResources.put(
- contextXml.getAbsolutePath(),
- Long.valueOf(contextXml.lastModified()));
+ contextXml.getAbsolutePath(), Long.valueOf(contextXml.lastModified()));
}
}
// Add the global redeploy resources (which are never deleted) at
@@ -703,7 +690,7 @@ public class HostConfig implements LifecycleListener {
if (log.isInfoEnabled()) {
log.info(sm.getString("hostConfig.deployDescriptor.finished",
- contextXml.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
+ contextXml.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
}
}
@@ -715,22 +702,23 @@ public class HostConfig implements LifecycleListener {
*/
protected void deployWARs(File appBase, String[] files) {
- if (files == null)
+ if (files == null) {
return;
+ }
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (String file : files) {
-
- if (file.equalsIgnoreCase("META-INF"))
+ if (file.equalsIgnoreCase("META-INF")) {
continue;
- if (file.equalsIgnoreCase("WEB-INF"))
+ }
+ if (file.equalsIgnoreCase("WEB-INF")) {
continue;
- File war = new File(appBase, file);
- if (file.toLowerCase(Locale.ENGLISH).endsWith(".war") &&
- war.isFile() && !invalidWars.contains(file)) {
+ }
+ File war = new File(appBase, file);
+ if (file.toLowerCase(Locale.ENGLISH).endsWith(".war") && war.isFile() && !invalidWars.contains(file)) {
ContextName cn = new ContextName(file, true);
if (isServiced(cn.getName())) {
@@ -748,10 +736,8 @@ public class HostConfig implements LifecycleListener {
File dir = new File(appBase, cn.getBaseName());
if (dir.exists()) {
if (!app.loggedDirWarning) {
- log.warn(sm.getString(
- "hostConfig.deployWar.hiddenDir",
- dir.getAbsoluteFile(),
- war.getAbsoluteFile()));
+ log.warn(sm.getString("hostConfig.deployWar.hiddenDir",
+ dir.getAbsoluteFile(), war.getAbsoluteFile()));
app.loggedDirWarning = true;
}
} else {
@@ -763,8 +749,7 @@ public class HostConfig implements LifecycleListener {
// Check for WARs with /../ /./ or similar sequences in the name
if (!validateContextPath(appBase, cn.getBaseName())) {
- log.error(sm.getString(
- "hostConfig.illegalWarName", file));
+ log.error(sm.getString("hostConfig.illegalWarName", file));
invalidWars.add(file);
continue;
}
@@ -777,8 +762,7 @@ public class HostConfig implements LifecycleListener {
try {
result.get();
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployWar.threaded.error"), e);
+ log.error(sm.getString("hostConfig.deployWar.threaded.error"), e);
}
}
}
@@ -795,16 +779,14 @@ public class HostConfig implements LifecycleListener {
String canonicalAppBase = appBase.getCanonicalPath();
docBase = new StringBuilder(canonicalAppBase);
if (canonicalAppBase.endsWith(File.separator)) {
- docBase.append(contextPath.substring(1).replace(
- '/', File.separatorChar));
+ docBase.append(contextPath.substring(1).replace('/', File.separatorChar));
} else {
docBase.append(contextPath.replace('/', File.separatorChar));
}
// At this point docBase should be canonical but will not end
// with File.separator
- canonicalDocBase =
- (new File(docBase.toString())).getCanonicalPath();
+ canonicalDocBase = (new File(docBase.toString())).getCanonicalPath();
// If the canonicalDocBase ends with File.separator, add one to
// docBase before they are compared
@@ -827,8 +809,7 @@ public class HostConfig implements LifecycleListener {
*/
protected void deployWAR(ContextName cn, File war) {
- File xml = new File(host.getAppBaseFile(),
- cn.getBaseName() + "/" + Constants.ApplicationContextXml);
+ File xml = new File(host.getAppBaseFile(), cn.getBaseName() + "/" + Constants.ApplicationContextXml);
File warTracker = new File(host.getAppBaseFile(), cn.getBaseName() + Constants.WarTracker);
@@ -848,8 +829,7 @@ public class HostConfig implements LifecycleListener {
boolean useXml = false;
// If the xml file exists then expandedDir must exists so no need to
// test that here
- if (xml.exists() && unpackWARs &&
- (!warTracker.exists() || warTracker.lastModified() == war.lastModified())) {
+ if (xml.exists() && unpackWARs && (!warTracker.exists() || warTracker.lastModified() == war.lastModified())) {
useXml = true;
}
@@ -862,9 +842,7 @@ public class HostConfig implements LifecycleListener {
try {
context = (Context) digester.parse(xml);
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployDescriptor.error",
- war.getAbsolutePath()), e);
+ log.error(sm.getString("hostConfig.deployDescriptor.error", war.getAbsolutePath()), e);
} finally {
digester.reset();
if (context == null) {
@@ -881,16 +859,13 @@ public class HostConfig implements LifecycleListener {
context = (Context) digester.parse(istream);
}
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployDescriptor.error",
- war.getAbsolutePath()), e);
+ log.error(sm.getString("hostConfig.deployDescriptor.error", war.getAbsolutePath()), e);
} finally {
digester.reset();
if (context == null) {
context = new FailedContext();
}
- context.setConfigFile(
- UriUtil.buildJarUrl(war, Constants.ApplicationContextXml));
+ context.setConfigFile(UriUtil.buildJarUrl(war, Constants.ApplicationContextXml));
}
}
} else if (!deployThisXML && xmlInWar) {
@@ -904,8 +879,7 @@ public class HostConfig implements LifecycleListener {
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error(sm.getString("hostConfig.deployWar.error",
- war.getAbsolutePath()), t);
+ log.error(sm.getString("hostConfig.deployWar.error", war.getAbsolutePath()), t);
} finally {
if (context == null) {
context = new FailedContext();
@@ -925,8 +899,7 @@ public class HostConfig implements LifecycleListener {
if (xmlInWar && copyThisXml) {
// Change location of XML file to config base
- xml = new File(host.getConfigBaseFile(),
- cn.getBaseName() + ".xml");
+ xml = new File(host.getConfigBaseFile(), cn.getBaseName() + ".xml");
try (JarFile jar = new JarFile(war)) {
JarEntry entry = jar.getJarEntry(Constants.ApplicationContextXml);
try (InputStream istream = jar.getInputStream(entry);
@@ -939,30 +912,26 @@ public class HostConfig implements LifecycleListener {
}
}
- DeployedApplication deployedApp = new DeployedApplication(cn.getName(),
- xml.exists() && deployThisXML && copyThisXml);
+ DeployedApplication deployedApp = new DeployedApplication(
+ cn.getName(), xml.exists() && deployThisXML && copyThisXml);
long startTime = 0;
// Deploy the application in this WAR file
if(log.isInfoEnabled()) {
startTime = System.currentTimeMillis();
- log.info(sm.getString("hostConfig.deployWar",
- war.getAbsolutePath()));
+ log.info(sm.getString("hostConfig.deployWar", war.getAbsolutePath()));
}
try {
// Populate redeploy resources with the WAR file
- deployedApp.redeployResources.put
- (war.getAbsolutePath(), Long.valueOf(war.lastModified()));
+ deployedApp.redeployResources.put(war.getAbsolutePath(), Long.valueOf(war.lastModified()));
if (deployThisXML && xml.exists() && copyThisXml) {
- deployedApp.redeployResources.put(xml.getAbsolutePath(),
- Long.valueOf(xml.lastModified()));
+ deployedApp.redeployResources.put(xml.getAbsolutePath(), Long.valueOf(xml.lastModified()));
} else {
// In case an XML file is added to the config base later
deployedApp.redeployResources.put(
- (new File(host.getConfigBaseFile(),
- cn.getBaseName() + ".xml")).getAbsolutePath(),
+ (new File(host.getConfigBaseFile(), cn.getBaseName() + ".xml")).getAbsolutePath(),
Long.valueOf(0));
}
@@ -977,8 +946,7 @@ public class HostConfig implements LifecycleListener {
host.addChild(context);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error(sm.getString("hostConfig.deployWar.error",
- war.getAbsolutePath()), t);
+ log.error(sm.getString("hostConfig.deployWar.error", war.getAbsolutePath()), t);
} finally {
// If we're unpacking WARs, the docBase will be mutated after
// starting the context
@@ -988,13 +956,10 @@ public class HostConfig implements LifecycleListener {
}
if (unpackWAR && context.getDocBase() != null) {
File docBase = new File(host.getAppBaseFile(), cn.getBaseName());
- deployedApp.redeployResources.put(docBase.getAbsolutePath(),
- Long.valueOf(docBase.lastModified()));
- addWatchedResources(deployedApp, docBase.getAbsolutePath(),
- context);
+ deployedApp.redeployResources.put(docBase.getAbsolutePath(), Long.valueOf(docBase.lastModified()));
+ addWatchedResources(deployedApp, docBase.getAbsolutePath(), context);
if (deployThisXML && !copyThisXml && (xmlInWar || xml.exists())) {
- deployedApp.redeployResources.put(xml.getAbsolutePath(),
- Long.valueOf(xml.lastModified()));
+ deployedApp.redeployResources.put(xml.getAbsolutePath(), Long.valueOf(xml.lastModified()));
}
} else {
// Passing null for docBase means that no resources will be
@@ -1010,7 +975,7 @@ public class HostConfig implements LifecycleListener {
if (log.isInfoEnabled()) {
log.info(sm.getString("hostConfig.deployWar.finished",
- war.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
+ war.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
}
}
@@ -1022,24 +987,28 @@ public class HostConfig implements LifecycleListener {
*/
protected void deployDirectories(File appBase, String[] files) {
- if (files == null)
+ if (files == null) {
return;
+ }
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (String file : files) {
-
- if (file.equalsIgnoreCase("META-INF"))
+ if (file.equalsIgnoreCase("META-INF")) {
continue;
- if (file.equalsIgnoreCase("WEB-INF"))
+ }
+ if (file.equalsIgnoreCase("WEB-INF")) {
continue;
+ }
+
File dir = new File(appBase, file);
if (dir.isDirectory()) {
ContextName cn = new ContextName(file, false);
- if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
+ if (isServiced(cn.getName()) || deploymentExists(cn.getName())) {
continue;
+ }
results.add(es.submit(new DeployDirectory(this, cn, dir)));
}
@@ -1049,8 +1018,7 @@ public class HostConfig implements LifecycleListener {
try {
result.get();
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployDir.threaded.error"), e);
+ log.error(sm.getString("hostConfig.deployDir.threaded.error"), e);
}
}
}
@@ -1063,20 +1031,16 @@ public class HostConfig implements LifecycleListener {
*/
protected void deployDirectory(ContextName cn, File dir) {
-
long startTime = 0;
// Deploy the application in this directory
if( log.isInfoEnabled() ) {
startTime = System.currentTimeMillis();
- log.info(sm.getString("hostConfig.deployDir",
- dir.getAbsolutePath()));
+ log.info(sm.getString("hostConfig.deployDir", dir.getAbsolutePath()));
}
Context context = null;
File xml = new File(dir, Constants.ApplicationContextXml);
- File xmlCopy =
- new File(host.getConfigBaseFile(), cn.getBaseName() + ".xml");
-
+ File xmlCopy = new File(host.getConfigBaseFile(), cn.getBaseName() + ".xml");
DeployedApplication deployedApp;
boolean copyThisXml = isCopyXML();
@@ -1088,9 +1052,7 @@ public class HostConfig implements LifecycleListener {
try {
context = (Context) digester.parse(xml);
} catch (Exception e) {
- log.error(sm.getString(
- "hostConfig.deployDescriptor.error",
- xml), e);
+ log.error(sm.getString("hostConfig.deployDescriptor.error", xml), e);
context = new FailedContext();
} finally {
digester.reset();
@@ -1114,8 +1076,7 @@ public class HostConfig implements LifecycleListener {
} else if (!deployThisXML && xml.exists()) {
// Block deployment as META-INF/context.xml may contain security
// configuration necessary for a secure deployment.
- log.error(sm.getString("hostConfig.deployDescriptor.blocked",
- cn.getPath(), xml, xmlCopy));
+ log.error(sm.getString("hostConfig.deployDescriptor.blocked", cn.getPath(), xml, xmlCopy));
context = new FailedContext();
} else {
context = (Context) Class.forName(contextClass).getConstructor().newInstance();
@@ -1132,43 +1093,29 @@ public class HostConfig implements LifecycleListener {
host.addChild(context);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error(sm.getString("hostConfig.deployDir.error",
- dir.getAbsolutePath()), t);
+ log.error(sm.getString("hostConfig.deployDir.error", dir.getAbsolutePath()), t);
} finally {
- deployedApp = new DeployedApplication(cn.getName(),
- xml.exists() && deployThisXML && copyThisXml);
+ deployedApp = new DeployedApplication(cn.getName(), xml.exists() && deployThisXML && copyThisXml);
// Fake re-deploy resource to detect if a WAR is added at a later
// point
- deployedApp.redeployResources.put(dir.getAbsolutePath() + ".war",
- Long.valueOf(0));
- deployedApp.redeployResources.put(dir.getAbsolutePath(),
- Long.valueOf(dir.lastModified()));
+ deployedApp.redeployResources.put(dir.getAbsolutePath() + ".war", Long.valueOf(0));
+ deployedApp.redeployResources.put(dir.getAbsolutePath(), Long.valueOf(dir.lastModified()));
if (deployThisXML && xml.exists()) {
if (copyThisXml) {
- deployedApp.redeployResources.put(
- xmlCopy.getAbsolutePath(),
- Long.valueOf(xmlCopy.lastModified()));
+ deployedApp.redeployResources.put(xmlCopy.getAbsolutePath(), Long.valueOf(xmlCopy.lastModified()));
} else {
- deployedApp.redeployResources.put(
- xml.getAbsolutePath(),
- Long.valueOf(xml.lastModified()));
+ deployedApp.redeployResources.put(xml.getAbsolutePath(), Long.valueOf(xml.lastModified()));
// Fake re-deploy resource to detect if a context.xml file is
// added at a later point
- deployedApp.redeployResources.put(
- xmlCopy.getAbsolutePath(),
- Long.valueOf(0));
+ deployedApp.redeployResources.put(xmlCopy.getAbsolutePath(), Long.valueOf(0));
}
} else {
// Fake re-deploy resource to detect if a context.xml file is
// added at a later point
- deployedApp.redeployResources.put(
- xmlCopy.getAbsolutePath(),
- Long.valueOf(0));
+ deployedApp.redeployResources.put(xmlCopy.getAbsolutePath(), Long.valueOf(0));
if (!xml.exists()) {
- deployedApp.redeployResources.put(
- xml.getAbsolutePath(),
- Long.valueOf(0));
+ deployedApp.redeployResources.put(xml.getAbsolutePath(), Long.valueOf(0));
}
}
addWatchedResources(deployedApp, dir.getAbsolutePath(), context);
@@ -1193,8 +1140,7 @@ public class HostConfig implements LifecycleListener {
* @return <code>true</code> if the specified deployment exists
*/
protected boolean deploymentExists(String contextName) {
- return (deployed.containsKey(contextName) ||
- (host.findChild(contextName) != null));
+ return deployed.containsKey(contextName) || (host.findChild(contextName) != null);
}
@@ -1204,8 +1150,7 @@ public class HostConfig implements LifecycleListener {
* @param docBase web app docBase
* @param context web application context
*/
- protected void addWatchedResources(DeployedApplication app, String docBase,
- Context context) {
+ protected void addWatchedResources(DeployedApplication app, String docBase, Context context) {
// FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*,
// WEB-INF/*.xml), where we would only check if at least one
// resource is newer than app.timestamp
@@ -1571,9 +1516,9 @@ public class HostConfig implements LifecycleListener {
host.setAutoDeploy(false);
}
- if (host.getDeployOnStartup())
+ if (host.getDeployOnStartup()) {
deployApps();
-
+ }
}
@@ -1582,8 +1527,9 @@ public class HostConfig implements LifecycleListener {
*/
public void stop() {
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug(sm.getString("hostConfig.stop"));
+ }
if (oname != null) {
try {
@@ -1603,11 +1549,11 @@ public class HostConfig implements LifecycleListener {
if (host.getAutoDeploy()) {
// Check for resources modification to trigger redeployment
- DeployedApplication[] apps =
- deployed.values().toArray(new DeployedApplication[0]);
+ DeployedApplication[] apps = deployed.values().toArray(new DeployedApplication[0]);
for (DeployedApplication app : apps) {
- if (!isServiced(app.name))
+ if (!isServiced(app.name)) {
checkResources(app, false);
+ }
}
// Check for old versions of applications that can now be undeployed
@@ -1677,8 +1623,7 @@ public class HostConfig implements LifecycleListener {
}
if (sessionCount == 0) {
if (log.isInfoEnabled()) {
- log.info(sm.getString(
- "hostConfig.undeployVersion", previous.getName()));
+ log.info(sm.getString("hostConfig.undeployVersion", previous.getName()));
}
DeployedApplication app = deployed.get(previous.getName());
String[] resources = app.redeployResources.keySet().toArray(new String[0]);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org