jfarcand    2003/05/28 08:08:33

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Log:
  Fix for bug 20217: restartContext doesn't work when a context configuration file 
maps a path to two levels.
  
  Revision  Changes    Path
  1.62      +25 -6     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- StandardContext.java      26 May 2003 22:03:59 -0000      1.61
  +++ StandardContext.java      28 May 2003 15:08:33 -0000      1.62
  @@ -258,6 +258,11 @@
   
   
       /**
  +     * The default context name used for config file
  +     */
  +    private String defaultConfigFile = "context.xml";
  +
  +    /**
        * The display name of this web application.
        */
       private String displayName = null;
  @@ -3873,11 +3878,25 @@
               if (name.equals("")) {
                   name = "ROOT";
               }
  -            File file = new File(appBase);
  -            file = new File(file, name + ".xml");
  -            if( log.isDebugEnabled() )
  -                log.debug( "Set config file " + file);
  -            setConfigFile(file.getPath());
  +            File fileBase = new File(appBase);
  +            File file = new File(fileBase, name + ".xml");
  +            
  +            /*
  +             * Try to save the context information using a default file name.
  +             */ 
  +            if (!file.exists()){
  +                file = new File(fileBase, getDocBase() + File.separator + 
defaultConfigFile);
  +            }
  +
  +            // Make sure the file exist before setting it.
  +            if (file.exists()){
  +                setConfigFile(file.getPath());
  +                if( log.isDebugEnabled() )
  +                    log.debug( "Set config file " + file);
  +            } else {
  +                if( log.isDebugEnabled() )
  +                    log.debug( "Config file doesn't exists: " + file);
  +            }
           }
   
           // Add missing components as necessary
  
  
  

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

Reply via email to