remm        2004/04/10 07:56:31

  Modified:    catalina/src/share/org/apache/catalina/startup
                        HostConfig.java
  Log:
  - Bug 28262: Fix redeployment after removal of a war.
  - Submitted by Peter Rossbach.
  
  Revision  Changes    Path
  1.30      +39 -1     
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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HostConfig.java   27 Feb 2004 14:58:49 -0000      1.29
  +++ HostConfig.java   10 Apr 2004 14:56:31 -0000      1.30
  @@ -26,6 +26,8 @@
   import java.net.URL;
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.List;
   import java.util.jar.JarEntry;
   import java.util.jar.JarFile;
   
  @@ -572,6 +574,7 @@
                               }
                               istream = null;
                           }
  +                    } finally {
                           entry = null;
                           if (jar != null) {
                               try {
  @@ -1017,11 +1020,46 @@
   
   
       /**
  +     *  Check remove wars, dir and context xml's
  +     */
  +    protected void checkRemoveApps() {
  +        File appBase = appBase();
  +        File configBase = configBase();
  +        List currentDeployed = (List) deployed.clone();
  +        Iterator iter = currentDeployed.iterator();
  +        while (iter.hasNext()) {
  +            String filename = (String) iter.next();
  +            if (filename.toLowerCase().endsWith(".xml")) {
  +                File file = new File(configBase, filename);
  +                if (!file.exists()) {
  +                    log.debug(sm.getString("hostConfig.removeXML", filename));
  +                    deployed.remove(filename);
  +                }
  +                continue;
  +            }
  +            File file = new File(appBase, filename);
  +            if (!file.exists()) {
  +                if (log.isDebugEnabled() ) {
  +                    if (filename.toLowerCase().endsWith(".war"))
  +                        log.debug(sm.getString("hostConfig.removeDIR", 
  +                                               filename));
  +                    else
  +                        log.debug(sm.getString("hostConfig.removeWAR",
  +                                               filename));
  +                }
  +                deployed.remove(filename);
  +            }
  +        }
  +    }
  +
  +
  +    /**
        * Deploy webapps.
        */
       protected void check() {
   
           if (host.getAutoDeploy()) {
  +            checkRemoveApps();
               // Deploy apps if the Host allows auto deploying
               deployApps();
               // Check for web.xml modification
  
  
  

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

Reply via email to