remm        2003/07/25 06:57:30

  Modified:    catalina/src/share/org/apache/catalina/startup
                        HostConfig.java
  Log:
  - Fix problems when updating a WAR which had an associated context file.
  
  Revision  Changes    Path
  1.18      +33 -5     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- HostConfig.java   24 Jun 2003 23:42:34 -0000      1.17
  +++ HostConfig.java   25 Jul 2003 13:57:30 -0000      1.18
  @@ -775,10 +775,13 @@
                               contextPath = "";
                           if (dirLastModified > expanded.lastModified()) {
                               try {
  +                                // Undeploy current application
                                   deployed.remove(files[i]);
  +                                deployed.remove(expandedDir + ".xml");
                                   if (host.findChild(contextPath) != null) {
                                       ((Deployer) host).remove(contextPath, 
  -                                                             true);
  +                                                             false);
  +                                    deleteDir(expanded);
                                   }
                               } catch (Throwable t) {
                                   log.error(sm.getString
  @@ -832,6 +835,31 @@
           }
           
           return result;
  +    }
  +
  +
  +    /**
  +     * Delete the specified directory, including all of its contents and
  +     * subdirectories recursively.
  +     *
  +     * @param dir File object representing the directory to be deleted
  +     */
  +    protected void deleteDir(File dir) {
  +
  +        String files[] = dir.list();
  +        if (files == null) {
  +            files = new String[0];
  +        }
  +        for (int i = 0; i < files.length; i++) {
  +            File file = new File(dir, files[i]);
  +            if (file.isDirectory()) {
  +                deleteDir(file);
  +            } else {
  +                file.delete();
  +            }
  +        }
  +        dir.delete();
  +
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to