You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ba...@locus.apache.org on 2000/01/27 05:03:22 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon Cocoon.java Utils.java

balld       00/01/26 20:03:22

  Modified:    src/org/apache/cocoon Cocoon.java Utils.java
  Log:
  Checked in extended error handling code based on a patch from Pascal Houde.
  Submitted by: Pascal Houde
  
  Revision  Changes    Path
  1.10      +5 -5      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Cocoon.java	2000/01/03 01:39:41	1.9
  +++ Cocoon.java	2000/01/27 04:03:21	1.10
  @@ -1,4 +1,4 @@
  -/*-- $Id: Cocoon.java,v 1.9 2000/01/03 01:39:41 stefano Exp $ -- 
  +/*-- $Id: Cocoon.java,v 1.10 2000/01/27 04:03:21 balld Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -64,7 +64,7 @@
    * separate different knowledge contexts in different processing layers.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.9 $ $Date: 2000/01/03 01:39:41 $
  + * @version $Revision: 1.10 $ $Date: 2000/01/27 04:03:21 $
    */
   
   public class Cocoon extends HttpServlet implements Defaults {
  @@ -147,13 +147,13 @@
                       if (errorsInternally) {
                           Frontend.error(response, "File not found.", e);
                       } else {
  -                        response.sendError(404);
  +                        response.sendError(404,Utils.getStackTraceAsString(e));
                       }
                   } catch (Throwable t) {
                       if (errorsInternally) {
                           Frontend.error(response, "Error found handling the request.", t);
                       } else {
  -                        response.sendError(500);
  +                        response.sendError(500,Utils.getStackTraceAsString(t));
                       }
                   }
               }
  @@ -253,4 +253,4 @@
           
           throw new Exception("The property file could not be found.");
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.7       +13 -2     xml-cocoon/src/org/apache/cocoon/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Utils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Utils.java	2000/01/24 21:36:42	1.6
  +++ Utils.java	2000/01/27 04:03:21	1.7
  @@ -1,4 +1,4 @@
  -/*-- $Id: Utils.java,v 1.6 2000/01/24 21:36:42 stefano Exp $ -- 
  +/*-- $Id: Utils.java,v 1.7 2000/01/27 04:03:21 balld Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -61,7 +61,7 @@
    * Utility methods for Cocoon and its classes.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.6 $ $Date: 2000/01/24 21:36:42 $
  + * @version $Revision: 1.7 $ $Date: 2000/01/27 04:03:21 $
    */
   
   public final class Utils {
  @@ -251,4 +251,15 @@
               return request.getPathTranslated().replace('\\','/');
           }
       }
  +
  +	/**
  +	 * Returns the stack trace as a string
  +	 */
  +	public static final String getStackTraceAsString(Throwable e) {
  +		CharArrayWriter chars = new CharArrayWriter();
  +		PrintWriter writer = new PrintWriter(chars,true);
  +		e.printStackTrace(writer);
  +		return chars.toString();
  +	}
  +
   }