You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/06/28 09:10:07 UTC

cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade LoadOnStartupInterceptor.java WebXmlReader.java

costin      01/06/28 00:10:07

  Modified:    src/facade22/org/apache/tomcat/facade
                        LoadOnStartupInterceptor.java WebXmlReader.java
  Log:
  Small fix in loadOnStartup: Throwables shouldn't be able to stop the startup.
  ( it happens in strange situations )
  
  Also, check if we validated before.( small speedup )
  
  Revision  Changes    Path
  1.3       +3 -1      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/LoadOnStartupInterceptor.java
  
  Index: LoadOnStartupInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/LoadOnStartupInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoadOnStartupInterceptor.java	2001/02/20 03:34:11	1.2
  +++ LoadOnStartupInterceptor.java	2001/06/28 07:10:01	1.3
  @@ -135,7 +135,9 @@
   			} else {
   			    ((ServletHandler)result).init();
   			}
  -		    } catch (Exception ee) {
  +		    } catch (Throwable ee) {
  +			// it can be ClassNotFound or other - servlet errors
  +			// shouldn't stop initialization
   			String msg = sm.getString("context.loadServlet.e",
   						  servletName);
   			log(msg, ee);
  
  
  
  1.12      +16 -1     jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java
  
  Index: WebXmlReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/WebXmlReader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebXmlReader.java	2001/02/20 03:34:11	1.11
  +++ WebXmlReader.java	2001/06/28 07:10:02	1.12
  @@ -136,8 +136,13 @@
   	    }
   	    if( ctx.getDebug() > 0 ) ctx.log("Reading " + file );
   	    XmlMapper xh=new XmlMapper();
  +	    File v=new File( ctx.getWorkDir(), "webxmlval.txt" );
   	    if( validate ) {
  -		xh.setValidating(true);
  +		if( ! v.exists() || 
  +		    v.lastModified() < f.lastModified() ) {
  +		    ctx.log("Validating web.xml");
  +		    xh.setValidating(true);
  +		}
   		//	    if( ctx.getDebug() > 5 ) xh.setDebug( 3 );
   	    }
   
  @@ -226,6 +231,16 @@
   	    addSecurity( xh );
   
   	    Object ctx1=xh.readXml(f, ctx);
  +
  +	    if( validate ) {
  +		try {
  +		    FileOutputStream fos=new FileOutputStream( v );
  +		    fos.write( 1 );
  +		    fos.close();
  +		} catch(IOException ex ) {
  +		    ctx.log( "Error creating validation mark ", ex );
  +		}
  +	    }
   	} catch(Exception ex ) {
   	    log("ERROR reading " + file, ex);
   	    // XXX we should invalidate the context and un-load it !!!