remm        2004/01/13 08:31:35

  Modified:    catalina/src/share/org/apache/catalina/startup
                        HostConfig.java LocalStrings.properties
  Log:
  - Small cleanup of the class.
  - Add some i18n.
  - Use reload with a standard context (it might do stuff once again someday).
  - Init deployer on startup to avoid possible CL issues when embedded.
  
  Revision  Changes    Path
  1.26      +34 -28    
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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HostConfig.java   23 Sep 2003 06:35:52 -0000      1.25
  +++ HostConfig.java   13 Jan 2004 16:31:35 -0000      1.26
  @@ -88,6 +88,7 @@
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Logger;
  +import org.apache.catalina.core.StandardContext;
   import org.apache.catalina.core.StandardHost;
   import org.apache.catalina.util.StringManager;
   import org.apache.naming.resources.ResourceAttributes;
  @@ -459,6 +460,9 @@
           if (!(host instanceof Deployer))
               return;
   
  +        // Initialize the deployer
  +        ((Deployer) host).findDeployedApps();
  +
           File appBase = appBase();
           if (!appBase.exists() || !appBase.isDirectory())
               return;
  @@ -888,31 +892,33 @@
           boolean result = true;
           log.info("restartContext(" + context.getName() + ")");
   
  -        /*
  -        try {
  -            StandardContext sctx=(StandardContext)context;
  -            sctx.reload();
  -        } catch( Exception ex ) {
  -            log.warn("Erorr stopping context " + context.getName()  +  " " +
  -                    ex.toString());
  -        }
  -        */
  -        try {
  -            ((Lifecycle) context).stop();
  -        } catch( Exception ex ) {
  -            log.warn("Erorr stopping context " + context.getName()  +  " " +
  -                    ex.toString());
  -        }
  -        // if the context was not started ( for example an error in web.xml)
  -        // we'll still get to try to start
  -        try {
  -            ((Lifecycle) context).start();
  -        } catch (Exception e) {
  -            log.warn("Error restarting context " + context.getName() + " " +
  -                    e.toString());
  -            result = false;
  +        if (context instanceof StandardContext) {
  +            try {
  +                StandardContext sctx = (StandardContext)context;
  +                sctx.reload();
  +            } catch( Exception e ) {
  +                log.warn(sm.getString
  +                         ("hostConfig.context.restart", context.getName()), e);
  +                result = false;
  +            }
  +        } else {
  +            try {
  +                ((Lifecycle) context).stop();
  +            } catch( Exception ex ) {
  +                log.warn(sm.getString
  +                         ("hostConfig.context.restart", context.getName()), e);
  +            }
  +            // If the context was not started (for example an error 
  +            // in web.xml) we'll still get to try to start
  +            try {
  +                ((Lifecycle) context).start();
  +            } catch (Exception e) {
  +                log.warn(sm.getString
  +                         ("hostConfig.context.restart", context.getName()), e);
  +                result = false;
  +            }
           }
  -        
  +
           return result;
       }
   
  
  
  
  1.4       +1 -0      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalStrings.properties   16 Jan 2003 21:45:25 -0000      1.3
  +++ LocalStrings.properties   13 Jan 2004 16:31:35 -0000      1.4
  @@ -47,6 +47,7 @@
   hostConfig.expand=Expanding web application archive {0}
   hostConfig.expand.error=Exception while expanding web application archive {0}
   hostConfig.expanding=Expanding discovered web application archives
  +hostConfig.context.restart=Error during context {0} restart
   hostConfig.start=HostConfig: Processing START
   hostConfig.stop=HostConfig: Processing STOP
   hostConfig.undeploy=Undeploying web application at context path {0}
  
  
  

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

Reply via email to