remm        2004/07/26 08:54:39

  Modified:    catalina/src/share/org/apache/catalina/startup
                        ContextConfig.java
  Log:
  - When using the antiLocking flag, attempt to remove as much of the temp files when 
stopping.
  - As it was the case before, remove the work dir when undeploying.
  
  Revision  Changes    Path
  1.50      +28 -3     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- ContextConfig.java        26 Jul 2004 10:56:54 -0000      1.49
  +++ ContextConfig.java        26 Jul 2004 15:54:38 -0000      1.50
  @@ -103,6 +103,12 @@
        */
       protected SAXParseException parseException = null;
   
  +    
  +    /**
  +     * Original docBase.
  +     */
  +    protected String originalDocBase = null;
  +    
   
       /**
        * The string resources for this package.
  @@ -753,6 +759,11 @@
               String docBase = context.getDocBase();
               if (docBase == null)
                   return;
  +            if (originalDocBase == null) {
  +                originalDocBase = docBase;
  +            } else {
  +                docBase = originalDocBase;
  +            }
               File docBaseFile = new File(docBase);
               if (!docBaseFile.isAbsolute()) {
                   docBaseFile = new File(appBase, docBase);
  @@ -773,7 +784,7 @@
               }
   
               File file = null;
  -            if (context.getDocBase().toLowerCase().endsWith(".war")) {
  +            if (docBase.toLowerCase().endsWith(".war")) {
                   file = new File(System.getProperty("java.io.tmpdir"),
                           deploymentCount++ + "-" + docBase + ".war");
               } else {
  @@ -1057,6 +1068,18 @@
               context.removeWrapperListener(wrapperListeners[i]);
           }
   
  +        // Remove (partially) folders and files created by antiLocking
  +        Host host = (Host) context.getParent();
  +        String appBase = host.getAppBase();
  +        String docBase = context.getDocBase();
  +        if ((docBase != null) && (originalDocBase != null)) {
  +            File docBaseFile = new File(docBase);
  +            if (!docBaseFile.isAbsolute()) {
  +                docBaseFile = new File(appBase, docBase);
  +            }
  +            ExpandWar.delete(docBaseFile);
  +        }
  +        
           ok = true;
   
       }
  @@ -1069,7 +1092,9 @@
           // Called from StandardContext.destroy()
           if (log.isDebugEnabled())
               log.debug(sm.getString("contextConfig.destroy"));
  -        
  +        String workDir = ((StandardContext) context).getWorkDir();
  +        if (workDir != null)
  +            ExpandWar.delete(new File(workDir));
       }
       
       
  
  
  

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

Reply via email to