tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/xml XmlMapper.java
Date Fri, 18 Feb 2000 18:14:53 GMT
costin      00/02/18 10:14:52

  Modified:    .        build.xml
               src/etc  server.xml test-tomcat.xml
               src/share/org/apache/tomcat/context WebXmlReader.java
               src/share/org/apache/tomcat/core Context.java
                        ContextManager.java HttpServletRequestFacade.java
                        ServletContextFacade.java
               src/share/org/apache/tomcat/service/http
                        HttpConnectionHandler.java
               src/share/org/apache/tomcat/servlets DefaultErrorPage.java
               src/share/org/apache/tomcat/startup Tomcat.java
               src/share/org/apache/tomcat/task GTest.java
               src/share/org/apache/tomcat/util/xml XmlMapper.java
  Log:
  Fixed the logger - we now use it in Context too, and set it up corectly.
  
  Changed logger names to small caps, no timestams.
  
  Logs from servlet ( via ServletContext.log ) are in a different logger than
  internal logs ( you'll no longer see "servet init" messages.
  
  Still a lot of stack traces - will go to a file and it's _important_
  to see them, it seems we had a lot of hidden problems.
  
  It seems most of tomcat tests fail because of GTest and the new error system.
  The error is reported sooner, and it seems a "Connection reset" is sent after
  that. I don't think it's a bug in tomcat, and I'm still looking for a fix in
  GTest.
  
  Revision  Changes    Path
  1.32      +1 -0      jakarta-tomcat/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/build.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build.xml	2000/02/13 01:16:16	1.31
  +++ build.xml	2000/02/18 18:14:49	1.32
  @@ -14,6 +14,7 @@
       <mkdir dir="${tomcat.build}/conf"/>
       <mkdir dir="${tomcat.build}/src"/>
       <mkdir dir="${tomcat.build}/lib"/>
  +    <mkdir dir="${tomcat.build}/logs"/>
       <mkdir dir="${tomcat.build}/bin"/>
       <mkdir dir="${tomcat.build}/doc"/>
       <mkdir dir="${tomcat.build}/webapps"/>
  
  
  
  1.9       +14 -4     jakarta-tomcat/src/etc/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/etc/server.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- server.xml	2000/02/16 05:44:31	1.8
  +++ server.xml	2000/02/18 18:14:49	1.9
  @@ -19,10 +19,20 @@
               DEBUG
            -->
   
  -    <Logger name="CTXMGR_LOG" 
  -	    verbosityLevel = "DEBUG" />
  +    <Logger name="log:cm" 
  +	    verbosityLevel = "DEBUG" 
  +	    timestamp = "no" />
  +
  +    <Logger name="log:context" 
  +	    verbosityLevel = "DEBUG" 
  +	    timestamp = "no"/>
  +
  +    <Logger name="log:servlet" 
  +            path="logs/servlet.log"
  +	    verbosityLevel = "DEBUG" 
  +	    timestamp = "no" />
   
  -    <Logger name="STARTUP_LOG"
  +    <Logger name="log:startup"
               verbosityLevel = "DEBUG"
   	    timestamp = "no" />
   
  @@ -38,7 +48,7 @@
           <ContextInterceptor className="org.apache.tomcat.context.WebXmlReader" />
           <ContextInterceptor className="org.apache.tomcat.context.LoadOnStartupInterceptor"
/>
           <!-- Request processing -->
  -        <RequestInterceptor className="org.apache.tomcat.request.SimpleMapper" />
  +        <RequestInterceptor className="org.apache.tomcat.request.SimpleMapper" debug="0"
/>
           <RequestInterceptor className="org.apache.tomcat.request.SessionInterceptor"
/>
           <RequestInterceptor className="org.apache.tomcat.request.SecurityCheck" />
           <RequestInterceptor className="org.apache.tomcat.request.FixHeaders" />
  
  
  
  1.7       +4 -0      jakarta-tomcat/src/etc/test-tomcat.xml
  
  Index: test-tomcat.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/etc/test-tomcat.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- test-tomcat.xml	2000/02/16 17:46:57	1.6
  +++ test-tomcat.xml	2000/02/18 18:14:49	1.7
  @@ -143,10 +143,12 @@
   
       <gtest request="GET /test/jsp/HelloWorld.jsp?????? HTTP/1.0"
              goldenFile="${gdir}/HelloWorld.txt"
  +           debug="0"
       />
   
       <gtest request="GET /test/jsp/HelloWorld.jsp?a=b&amp;c=d HTTP/1.0"
              goldenFile="${gdir}/HelloWorld.txt"
  +           debug="0"
       />
   
       <gtest request="GET /test/jsp/HelloWorld.jsp?&amp;&amp; HTTP/1.0"
  @@ -155,6 +157,7 @@
   
       <gtest request="GET /test/jsp/declaration/IntegerOverflow.jsp HTTP/1.0"
              returnCode="HTTP/1.0 500 Internal Server Error"
  +           debug="0"
       />
   
       <gtest request="GET /test/jsp/error/err.jsp HTTP/1.0"
  @@ -275,6 +278,7 @@
   
       <gtest request="GET /test/jsp/beanScopeSession.jsp HTTP/1.0"
              returnCode="HTTP/1.0 200 OK"
  +           debug="0"
       />
   
       <gtest request="GET /test/jsp/implicitOut.jsp HTTP/1.0"
  
  
  
  1.12      +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/context/WebXmlReader.java
  
  Index: WebXmlReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/WebXmlReader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebXmlReader.java	2000/02/16 17:13:21	1.11
  +++ WebXmlReader.java	2000/02/18 18:14:50	1.12
  @@ -49,7 +49,7 @@
   	    }
   	    if( ctx.getDebug() > 0 ) ctx.log("Reading " + file );
   	    XmlMapper xh=new XmlMapper();
  -	    if( ctx.getDebug() > 5 ) xh.setDebug( 2 );
  +	    //	    if( ctx.getDebug() > 5 ) xh.setDebug( 3 );
   
   	    xh.addRule("web-app/context-param", xh.methodSetter("addInitParameter", 2) );
   	    xh.addRule("web-app/context-param/param-name", xh.methodParam(0) ); 
  
  
  
  1.59      +38 -2     jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- Context.java	2000/02/16 17:46:57	1.58
  +++ Context.java	2000/02/18 18:14:50	1.59
  @@ -62,6 +62,7 @@
   
   import org.apache.tomcat.context.*;
   import org.apache.tomcat.util.*;
  +import org.apache.tomcat.logging.*;
   import java.io.*;
   import java.net.*;
   import java.util.*;
  @@ -141,6 +142,7 @@
       
       public Context() {
   	//	System.out.println("New Context ");
  +	// XXX  customize it per context
       }
   	
       ServletContextFacade getFacade() {
  @@ -559,8 +561,42 @@
   	return debug;
       }
   
  -    public void log( String msg ) {
  -	System.out.println("Context(" + path  + "): " + msg );
  +    boolean firstLog = true;
  +    Logger cLog = null;
  +    Logger csLog = null;
  +
  +    /** Internla log method
  +     */
  +    public final void log(String msg) {
  +	if (firstLog == true) {
  +	    cLog = Logger.getLogger("log:context");
  +	    csLog = Logger.getLogger("log:servlet");
  +	    firstLog = false;
  +	}
  +	if (cLog != null)
  +	    cLog.log("Context(" + path  + "): " + msg, Logger.DEBUG);
  +    }
  +
  +    /** User-level log method ( called from a servlet)
  +     */
  +    public void logServlet( String msg ) {
  +	if (firstLog == true) {
  +	    cLog = Logger.getLogger("log:context");
  +	    csLog = Logger.getLogger("log:servlet");
  +	    firstLog = false;
  +	}
  +	if (csLog != null)
  +	    csLog.log("Context(" + path  + "): " + msg, Logger.DEBUG);
  +    }
  +
  +    public void logServlet( String msg , Throwable t ) {
  +	if (firstLog == true) {
  +	    cLog = Logger.getLogger("log:context");
  +	    csLog = Logger.getLogger("log:servlet");
  +	    firstLog = false;
  +	}
  +	if (csLog != null)
  +	    csLog.log("Context(" + path  + "): " + msg, t, Logger.DEBUG);
       }
       
       public String toString() {
  
  
  
  1.50      +15 -14    jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- ContextManager.java	2000/02/18 00:17:48	1.49
  +++ ContextManager.java	2000/02/18 18:14:50	1.50
  @@ -146,12 +146,12 @@
        */
       public void setDefaults() {
   	if(connectors.size()==0) {
  -	    log("Setting default adapter");
  +	    if(debug>5) log("Setting default adapter");
   	    addServerConnector(  new org.apache.tomcat.service.http.HttpAdapter() );
   	}
   	
   	if( contextInterceptors.size()==0) {
  -	    log("Setting default context interceptors");
  +	    if(debug>5) log("Setting default context interceptors");
   	    addContextInterceptor(new LogEvents());
   	    addContextInterceptor(new AutoSetup());
   	    addContextInterceptor(new DefaultCMSetter());
  @@ -161,7 +161,7 @@
   	}
   	
   	if( requestInterceptors.size()==0) {
  -	    log("Setting default request interceptors");
  +	    if(debug>5) log("Setting default request interceptors");
   	    SimpleMapper smap=new SimpleMapper();
   	    smap.setContextManager( this );
   	    addRequestInterceptor(smap);
  @@ -240,7 +240,7 @@
       }
   
       public void stop() throws Exception {//TomcatException {
  -	log("Stopping context manager ");
  +	if(debug>0) log("Stopping context manager ");
   	Enumeration connE=getConnectors();
   	while( connE.hasMoreElements() ) {
   	    ((ServerConnector)connE.nextElement()).stop();
  @@ -275,7 +275,7 @@
   	// it will replace existing context - it's better than  IllegalStateException.
   	String path=ctx.getPath();
   	if( getContext( path ) != null ) {
  -	    log("Warning: replacing context for " + path, Logger.WARNING);
  +	    if(debug>0) log("Warning: replacing context for " + path, Logger.WARNING);
   	    removeContext(path);
   	}
   
  @@ -348,7 +348,7 @@
       }
       
       public void addRequestInterceptor( RequestInterceptor ri ) {
  -	log(" adding request intereptor " + ri.getClass().getName(), Logger.INFORMATION);
  +	if(debug>0) log(" adding request intereptor " + ri.getClass().getName(), Logger.INFORMATION);
   	requestInterceptors.addElement( ri );
   	if( ri instanceof ContextInterceptor )
   	    contextInterceptors.addElement( ri );
  @@ -400,6 +400,7 @@
       public void addLogger(Logger logger) {
   	// Will use this later once I feel more sure what I want to do here.
   	// -akv
  +	cmLog=logger;
       }
   
   
  @@ -464,7 +465,7 @@
        * WorkDir property - where all temporary files will be created
        */ 
       public void setWorkDir( String wd ) {
  -	log("set work dir " + wd, Logger.INFORMATION);
  +	if(debug>0) log("set work dir " + wd, Logger.INFORMATION);
   	this.workDir=wd;
       }
   
  @@ -512,7 +513,7 @@
   	    rrequest.recycle();
   	    rresponse.recycle();
   	} catch( Throwable ex ) {
  -	    log( "Error closing request " + ex);
  +	    if(debug>0) log( "Error closing request " + ex);
   	}
   	//	log( "Done with request " + rrequest );
   	return;
  @@ -524,7 +525,7 @@
        */
       int processRequest( Request req ) {
   	req.setContextManager( this );
  -	log("ProcessRequest: "+req.toString(), Logger.DEBUG);
  +	if(debug>0) log("ProcessRequest: "+req.toString(), Logger.DEBUG);
   
   	for( int i=0; i< requestInterceptors.size(); i++ ) {
   	    ((RequestInterceptor)requestInterceptors.elementAt(i)).contextMap( req );
  @@ -534,7 +535,7 @@
   	    ((RequestInterceptor)requestInterceptors.elementAt(i)).requestMap( req );
   	}
   
  -	log("After processing: "+req.toString(), Logger.DEBUG);
  +	if(debug>0) log("After processing: "+req.toString(), Logger.DEBUG);
   
   	return 0;
       }
  @@ -565,10 +566,9 @@
       void handleError( Request req, Response res , Throwable t, int code ) {
   	Context ctx = req.getContext();
   	if(ctx==null) {
  -	    /// *DEBUG*/ try {throw new Exception(); } catch(Exception ex) {ex.printStackTrace();}
   	    ctx=getContext("");
   	}
  -	if(ctx.getDebug() > 0 ) ctx.log("In error handler " + code + " " + t +  " / " + req
);
  +	if(ctx.getDebug() > 4 ) ctx.log("In error handler " + code + " " + t +  " / " + req
);
   	//	/*DEBUG*/ try {throw new Exception(); } catch(Exception ex) {ex.printStackTrace();}
   	String path=null;
   	ServletWrapper errorServlet=null;
  @@ -637,6 +637,7 @@
   		    rd.forward(req.getFacade(), res.getFacade());
   		return ;
   	    } catch( Throwable t1 ) {
  +		ctx.log(" Error in custom error handler " + t1 );
   		// nothing - we'll call DefaultErrorPage
   	    }
   	}
  @@ -704,7 +705,7 @@
       
       public final void log(String msg) {
   	if (firstLog == true) {
  -	    cmLog = Logger.getLogger("CTXMGR_LOG");
  +	    cmLog = Logger.getLogger("log:cm");
   	    firstLog = false;
   	}
   
  @@ -714,7 +715,7 @@
   
       public final void log(String msg, int level) {
   	if (firstLog == true) {
  -	    cmLog = Logger.getLogger("CTXMGR_LOG");
  +	    cmLog = Logger.getLogger("log:cm");
   	    firstLog = false;
   	}
   
  
  
  
  1.7       +3 -4      jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java
  
  Index: HttpServletRequestFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HttpServletRequestFacade.java	2000/02/01 22:53:30	1.6
  +++ HttpServletRequestFacade.java	2000/02/18 18:14:50	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java,v
1.6 2000/02/01 22:53:30 costin Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/02/01 22:53:30 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/HttpServletRequestFacade.java,v
1.7 2000/02/18 18:14:50 costin Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/02/18 18:14:50 $
    *
    * ====================================================================
    *
  @@ -175,7 +175,6 @@
       {
   	String value=request.getHeader( name );
   	if( value==null) return -1;
  -
   	int valueInt=Integer.parseInt(value);
   	return valueInt;
       }
  
  
  
  1.16      +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/core/ServletContextFacade.java
  
  Index: ServletContextFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletContextFacade.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ServletContextFacade.java	2000/01/12 19:54:02	1.15
  +++ ServletContextFacade.java	2000/02/18 18:14:50	1.16
  @@ -162,7 +162,7 @@
       }
   
       public void log(String msg) {
  -	context.log( msg );
  +	context.logServlet( msg );
       }
   
       public String getInitParameter(String name) {
  @@ -174,7 +174,7 @@
       }
   
       public void log(String msg, Throwable t) {
  -	context.log(msg, t);
  +	context.logServlet(msg, t);
       }
   
       /**
  
  
  
  1.14      +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java
  
  Index: HttpConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HttpConnectionHandler.java	2000/02/17 23:37:51	1.13
  +++ HttpConnectionHandler.java	2000/02/18 18:14:51	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
1.13 2000/02/17 23:37:51 costin Exp $
  - * $Revision: 1.13 $
  - * $Date: 2000/02/17 23:37:51 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
1.14 2000/02/18 18:14:51 costin Exp $
  + * $Revision: 1.14 $
  + * $Date: 2000/02/18 18:14:51 $
    *
    * ====================================================================
    *
  @@ -160,7 +160,7 @@
   	       // do nothing - same
   	   }
   	} catch (Exception e) {
  -	    e.printStackTrace();
  +	    contextM.log( "Error reading request " + e.getMessage());
   	} finally {
   	    // recycle kernel sockets ASAP
   	    try { socket.close (); }
  
  
  
  1.6       +3 -39     jakarta-tomcat/src/share/org/apache/tomcat/servlets/DefaultErrorPage.java
  
  Index: DefaultErrorPage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/servlets/DefaultErrorPage.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultErrorPage.java	2000/02/17 21:19:02	1.5
  +++ DefaultErrorPage.java	2000/02/18 18:14:51	1.6
  @@ -95,59 +95,23 @@
   	Throwable e= (Throwable)request.getAttribute("tomcat.servlet.error.throwable");
   	if( e!=null ) {
   	    e.printStackTrace();
  -	    sendError(request, response, 500, exceptionString( e ));
  +	    sendPrivateError(request, response, 500, exceptionString( e ));
   	    return;
   	}
   
   	if( status==HttpServletResponse.SC_MOVED_TEMPORARILY) {
   	    redirect( request, response, msg);
   	} else {
  -	    sendError( request, response, status, msg);
  +	    sendPrivateError( request, response, status, msg);
   
   	}
       }
   
  -    // -------------------- Redirect to error page if any --------------------
  -    public void sendError(Request request, Response response, int sc, String msg) throws
IOException {
  -	response.setStatus(sc);
  -	Context context = request.getContext();
  -
  -	if (context == null) {
  -	    sendPrivateError(request, response, sc, msg);
  -	    return;
  -	}
  -
  -	String path = context.getErrorPage(String.valueOf(sc));
  -	//System.out.println("X " + path + " " + request + " " + response + " " + (path==null));
  -	if (path == null) {
  -	    sendPrivateError(request, response, sc, msg);
  -	    return;
  -	}
  -	
  -	RequestDispatcher rd = context.getRequestDispatcher(path);
  -	if( rd==null) {
  -	    //  System.out.println("No error page for " + path);
  -	    sendPrivateError( request, response, sc, msg);
  -	    return;
  -	}
  -	
  -	try {
  -	    if( response.isStarted() )
  -		rd.forward(request.getFacade(), response.getFacade());
  -	    else
  -		rd.include(request.getFacade(), response.getFacade());
  -	} catch (ServletException se) {
  -	    sendPrivateError(request, response, sc, msg);
  -	}
  -
  -	// XXX
  -	// we only should set this if we are the head, not in an include
  -    }
  -
       // -------------------- Default error page --------------------
       private void sendPrivateError(Request request, Response response, int sc, String msg)
throws IOException {
   	response.setContentType("text/html");
   
  +	response.setStatus( sc );
   	StringBuffer buf = new StringBuffer();
   	if( response.isIncluded() ) {
   	    buf.append("<h1>Included servlet error: " );
  
  
  
  1.10      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java
  
  Index: Tomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Tomcat.java	2000/02/13 20:49:43	1.9
  +++ Tomcat.java	2000/02/18 18:14:51	1.10
  @@ -66,10 +66,10 @@
   	xh.addRule( "ContextManager/Connector", xh.addChild( "addServerConnector", "org.apache.tomcat.core.ServerConnector")
);
   
   	
  -	xh.addRule("ContextManager/Logger",
  +	xh.addRule("Server/Logger",
   		   xh.objectCreate("org.apache.tomcat.logging.TomcatLogger"));
  -	xh.addRule("ContextManager/Logger", xh.setProperties());
  -	xh.addRule("ContextManager/Logger", 
  +	xh.addRule("Server/Logger", xh.setProperties());
  +	xh.addRule("Server/Logger", 
   		   xh.addChild("addLogger", "org.apache.tomcat.logging.Logger") );
   
   	xh.addRule( "ContextManager/Connector/Parameter", xh.methodSetter("setProperty",2) );
  
  
  
  1.4       +66 -44    jakarta-tomcat/src/share/org/apache/tomcat/task/GTest.java
  
  Index: GTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/task/GTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GTest.java	2000/01/27 04:45:31	1.3
  +++ GTest.java	2000/02/18 18:14:52	1.4
  @@ -118,7 +118,9 @@
       public void execute() throws Exception {
   	
   	try {
  -	    boolean result=runTest();
  +	    dispatch(request, null);
  +
  +	    boolean result=checkResponse( magnitude );
   	    if(result) {
   		if(  "No description".equals( description )) {
   		    System.out.println("OK " + request );
  @@ -126,25 +128,20 @@
   		else
   		    System.out.println("OK " + description + " (" + request + ")");
   	    } else {
  -		System.out.println("==================== FAIL ====================");
  -		System.out.println("(" + description + ")" + request );
  +		if(  "No description".equals( description )) {
  +		    System.out.println("FAIL " + request );
  +		} else
  +		    System.out.println("FAIL " + description + " (" + request + ")" );
   	    }
   	} catch(Exception ex ) {
  -	    System.out.println("==================== FAIL ====================");
  -	    System.out.println("(" + description + ")" + request );
  +	    if(  "No description".equals( description )) {
  +		System.out.println("FAIL " + request );
  +	    } else
  +		System.out.println("FAIL " + description + " (" + request + ")" );
   	    ex.printStackTrace();
   	}
       }
   
  -    // XXX move to exec, get rid of TestResult
  -    public boolean runTest()
  -	throws Exception
  -    {
  -	dispatch(request, null);
  -	
  -	return checkResponse( magnitude );
  -    }
  -
       private boolean checkResponse(boolean testCondition)
   	throws Exception
       {
  @@ -234,22 +231,27 @@
   	// Write the request
   	OutputStreamWriter out=new OutputStreamWriter(s.getOutputStream());
   	PrintWriter pw = new PrintWriter(out);
  -	pw.println(request);
   
  -	if( content != null) {
  -	    pw.println("Content-Length: " + content.length());
  -	}
  -	
  -	if( request.indexOf( "HTTP/1." ) > -1) 
  -	    pw.println("");
  -
  -	if( content != null) {
  -	    pw.println(content);
  -	    // XXX no /n at the end -see HTTP specs!
  +	try {
  +	    pw.println(request);
  +	    
  +	    if( content != null) {
  +		pw.println("Content-Length: " + content.length());
  +	    }
  +	    
  +	    if( request.indexOf( "HTTP/1." ) > -1) 
  +		pw.println("");
  +	    
  +	    if( content != null) {
  +		pw.println(content);
  +		// XXX no /n at the end -see HTTP specs!
  +	    }
  +	    
  +	    pw.flush();
  +	} catch (Exception ex1 ) {
  +	    System.out.println("Error writing request " + ex1);
   	}
   	
  -	pw.flush();
  -	
   	try {
   	    // http 0.9
   	    if( request.indexOf( "HTTP/1." ) > -1) {
  @@ -261,8 +263,16 @@
   	    StringBuffer result =  readBody( is );
   	    if(result!=null)
   		responseBody=result.toString();
  -    
  +
  +	    if( debug>0) {
  +		System.out.println("DEBUG Response: " );
  +		System.out.println(responseLine );
  +		System.out.println(responseBody );
  +		System.out.println("DEBUG END " );
  +	    }
   	} catch( SocketException ex ) {
  +	    System.out.println("Socket Exception: " + ex);
  +	    ex.printStackTrace();
   	    s.close();
   	    return;
   	}
  @@ -333,19 +343,22 @@
   
       // XXX return byte [], fix the reading !!!!!
       StringBuffer readBody( InputStream input )
  -	throws Exception
       {
   	StringBuffer sb = new StringBuffer();
   	while (true) {
  -	    int ch = input.read();
  -	    if (ch < 0) {
  -		if (sb.length() == 0) {
  -		    return (null);
  -		} else {
  -		    break;
  +	    try {
  +		int ch = input.read();
  +		if (ch < 0) {
  +		    if (sb.length() == 0) {
  +			return (null);
  +		    } else {
  +			break;
  +		    }
   		}
  +		sb.append((char) ch);
  +	    } catch(IOException ex ) {
  +		return sb;
   	    }
  -	    sb.append((char) ch);
   	}
           return sb;
       }
  @@ -401,17 +414,26 @@
   	// Read the next line from the input stream
   	StringBuffer sb = new StringBuffer();
   	while (true) {
  -	    int ch = input.read();
  -	    if (ch < 0) {
  -		if (sb.length() == 0) {
  -		    return (null);
  -		} else {
  +	    try {
  +		int ch = input.read();
  +		if (ch < 0) {
  +		    if (sb.length() == 0) {
  +			if(debug>0) System.out.println("Error reading line " + ch + " " + sb.toString() );
  +			return "";
  +		    } else {
  +			break;
  +		    }
  +		} else if (ch == '\n') {
   		    break;
   		}
  -	    } else if (ch == '\n') {
  -		break;
  +		sb.append((char) ch);
  +	    } catch( IOException ex ) {
  +		System.out.println("Error reading : " + ex );
  +		debug=1;
  +		if(debug>0) System.out.println("Partial read: " + sb.toString());
  +		//ex.printStackTrace();
  +		//break;
   	    }
  -	    sb.append((char) ch);
   	}
   
   	// Strip any trailing carriage return
  
  
  
  1.8       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java
  
  Index: XmlMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XmlMapper.java	2000/02/14 18:26:06	1.7
  +++ XmlMapper.java	2000/02/18 18:14:52	1.8
  @@ -610,7 +610,7 @@
   	st.push( obj ); // put it back
   
   	String parentC=parent.getClass().getName();
  -	ctx.log("Calling " + parentC + "." + parentM  +" " + obj  );
  +	if( ctx.getDebug() >0) ctx.log("Calling " + parentC + "." + parentM  +" " + obj  );
   
   	Class params[]=new Class[1];
   	if( paramT==null) {
  
  
  

Mime
View raw message