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:45:37 UTC

[tomcat] branch 8.5.x updated (d7a7c40 -> f12339c)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from d7a7c40  Comment out / make configurable the performance aspects of these tests
     new f084e20  Re-format, no functional change in preparation for functional changes
     new f12339c  Ensure Windows signing uses sha256 hash

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.xml                                         |   4 +
 java/org/apache/catalina/mbeans/MBeanFactory.java |   2 -
 java/org/apache/catalina/startup/HostConfig.java  | 241 +++++++++-------------
 3 files changed, 97 insertions(+), 150 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/02: Re-format, no functional change in preparation for functional changes

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit f084e20f56bbe6c918e12c1f6c7616c47af1b394
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 ee45cd0..70fee81 100644
--- a/java/org/apache/catalina/mbeans/MBeanFactory.java
+++ b/java/org/apache/catalina/mbeans/MBeanFactory.java
@@ -495,7 +495,6 @@ public class MBeanFactory {
 
         // Return the corresponding MBean name
         return context.getObjectName().toString();
-
     }
 
 
@@ -805,7 +804,6 @@ public class MBeanFactory {
            }
 
         }
-
     }
 
 
diff --git a/java/org/apache/catalina/startup/HostConfig.java b/java/org/apache/catalina/startup/HostConfig.java
index 6ee7847..ba41cd8 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -416,7 +416,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());
@@ -426,7 +425,6 @@ public class HostConfig implements LifecycleListener {
         deployWARs(appBase, filteredAppPaths);
         // Deploy expanded folders
         deployDirectories(appBase, filteredAppPaths);
-
     }
 
 
@@ -494,8 +492,9 @@ public class HostConfig implements LifecycleListener {
         }
         // Deploy expanded folder
         File dir = new File(appBase, baseName);
-        if (dir.exists())
+        if (dir.exists()) {
             deployDirectory(cn, dir);
+        }
     }
 
 
@@ -506,8 +505,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<>();
@@ -518,11 +518,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)));
             }
         }
 
@@ -530,8 +530,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);
             }
         }
     }
@@ -545,15 +544,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;
@@ -566,9 +563,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) {
@@ -595,16 +590,14 @@ 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;
                     }
                 } else {
-                    log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified",
-                             docBase));
+                    log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified", docBase));
                     // Ignore specified docBase
                     context.setDocBase(null);
                 }
@@ -613,15 +606,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()) {
@@ -639,8 +630,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);
@@ -650,20 +641,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);
                 }
@@ -671,8 +659,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
@@ -686,7 +673,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)));
         }
     }
 
@@ -698,22 +685,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())) {
@@ -731,10 +719,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 {
@@ -746,8 +732,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;
                 }
@@ -760,8 +745,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);
             }
         }
     }
@@ -778,16 +762,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
@@ -810,8 +792,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);
 
@@ -831,8 +812,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;
         }
 
@@ -845,9 +825,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) {
@@ -864,16 +842,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) {
@@ -887,8 +862,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();
@@ -908,8 +882,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);
@@ -931,30 +904,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));
             }
 
@@ -969,8 +938,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
@@ -980,13 +948,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
@@ -1002,7 +967,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)));
         }
     }
 
@@ -1014,24 +979,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)));
             }
@@ -1041,8 +1010,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);
             }
         }
     }
@@ -1055,20 +1023,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();
@@ -1080,9 +1044,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();
@@ -1106,8 +1068,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();
@@ -1124,43 +1085,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);
@@ -1185,8 +1132,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);
     }
 
 
@@ -1196,8 +1142,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
@@ -1563,9 +1508,9 @@ public class HostConfig implements LifecycleListener {
             host.setAutoDeploy(false);
         }
 
-        if (host.getDeployOnStartup())
+        if (host.getDeployOnStartup()) {
             deployApps();
-
+        }
     }
 
 
@@ -1574,8 +1519,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 {
@@ -1595,11 +1541,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
@@ -1669,8 +1615,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


[tomcat] 02/02: Ensure Windows signing uses sha256 hash

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit f12339c449319bcfb9cd748a53227d6b8a0bf860
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Sun Jan 24 09:42:06 2021 +0000

    Ensure Windows signing uses sha256 hash
---
 build.xml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/build.xml b/build.xml
index a604caf..4c8bd89 100644
--- a/build.xml
+++ b/build.xml
@@ -2250,6 +2250,8 @@ skip.installer property in build.properties" />
       <arg value="sign"/>
       <arg value="/sha1"/>
       <arg value="${codesigning.certificate.thumbprint}"/>
+      <arg value="/fd"/>
+      <arg value="sha256"/>
       <arg value="/tr"/>
       <arg value="http://timestamp.digicert.com"/>
       <arg value="${tomcat.dist}/Uninstall.exe"/>
@@ -2280,6 +2282,8 @@ skip.installer property in build.properties" />
       <arg value="sign"/>
       <arg value="/sha1"/>
       <arg value="${codesigning.certificate.thumbprint}"/>
+      <arg value="/fd"/>
+      <arg value="sha256"/>
       <arg value="/tr"/>
       <arg value="http://timestamp.digicert.com"/>
       <arg value="${tomcat.release}/v${version}/bin/${final.name}.exe"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org