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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new f7f1197459 Fix NPE and sync the stat
f7f1197459 is described below

commit f7f1197459577db0d4ced7a38370ca692561bf81
Author: remm <[email protected]>
AuthorDate: Thu Sep 14 10:27:58 2023 +0200

    Fix NPE and sync the stat
    
    Found by coverity.
---
 java/org/apache/catalina/startup/HostConfig.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/HostConfig.java 
b/java/org/apache/catalina/startup/HostConfig.java
index a9246908c2..3c9d7e481c 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -308,7 +308,7 @@ public class HostConfig implements LifecycleListener {
      * @return 0L if no application with that name is deployed, or the instant
      *  on which the application was deployed
      */
-    public long getDeploymentTime(String name) {
+    public synchronized long getDeploymentTime(String name) {
         DeployedApplication app = deployed.get(name);
         if (app == null) {
             return 0L;
@@ -1152,6 +1152,9 @@ public class HostConfig implements LifecycleListener {
 
         // Should not be null as we test above if this is a directory
         String[] migrationCandidates = legacyAppBase.list();
+        if (migrationCandidates == null) {
+            return;
+        }
         for (String migrationCandidate : migrationCandidates) {
             File source = new File(legacyAppBase, migrationCandidate);
             File destination = new File(appBase, migrationCandidate);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to