[tomcat] branch master updated: Cleanup destination temp before migration

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[tomcat] branch master updated: Cleanup destination temp before migration

Rémy Maucherat
This is an automated email from the ASF dual-hosted git repository.

remm 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 ed63c95  Cleanup destination temp before migration
ed63c95 is described below

commit ed63c95e4ca5ca88855416561a1dcce05fd27081
Author: remm <[hidden email]>
AuthorDate: Fri Feb 19 15:46:07 2021 +0100

    Cleanup destination temp before migration
    createTempFile creates a file, so it is not compatible with a directory
    migration. The first thing I tried was a migration of the examples
    webapp and it didn't work since this is an exploded folder.
 java/org/apache/catalina/startup/HostConfig.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/java/org/apache/catalina/startup/HostConfig.java b/java/org/apache/catalina/startup/HostConfig.java
index 1aac2df..4cc8b5e 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -1281,6 +1281,8 @@ public class HostConfig implements LifecycleListener {
         try {
             tempNew = File.createTempFile("new", null, host.getLegacyAppBaseFile());
             tempOld = File.createTempFile("old", null, host.getLegacyAppBaseFile());
+            // createTempFile is not directly compatible with directories, so cleanup
+            ExpandWar.delete(tempNew);
             // The use of defaults is deliberate here to avoid having to
             // recreate every configuration option on the host. Better to change

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