You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gr...@locus.apache.org on 2000/11/07 19:30:16 UTC

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

greenrd     00/11/07 10:30:15

  Modified:    src/org/apache/cocoon Utils.java Frontend.java
  Added:       lib      sax-bugfix.jar
  Log:
  better error reporting
  
  Revision  Changes    Path
  1.1                  xml-cocoon/lib/sax-bugfix.jar
  
  	<<Binary file>>
  
  
  1.18      +9 -5      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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Utils.java	2000/07/21 23:38:26	1.17
  +++ Utils.java	2000/11/07 18:30:13	1.18
  @@ -1,4 +1,4 @@
  -/*-- $Id: Utils.java,v 1.17 2000/07/21 23:38:26 stefano Exp $ --
  +/*-- $Id: Utils.java,v 1.18 2000/11/07 18:30:13 greenrd Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -57,11 +57,15 @@
   import javax.servlet.*;
   import javax.servlet.http.*;
   
  +// XXX: Most of the methods in XSPUtil are not specific to XSP
  +// and should be moved somewhere else.
  +import org.apache.cocoon.processor.xsp.XSPUtil;
  +
   /**
    * Utility methods for Cocoon and its classes.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.17 $ $Date: 2000/07/21 23:38:26 $
  + * @version $Revision: 1.18 $ $Date: 2000/11/07 18:30:13 $
    */
   
   public final class Utils {
  @@ -292,10 +296,10 @@
        * Returns the stack trace as a string
        */
       public static final String getStackTraceAsString(Throwable e) {
  -        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  -        PrintWriter writer = new PrintWriter(bytes, true);
  +        StringWriter sw = new StringWriter ();
  +        PrintWriter writer = new PrintWriter(sw);
           e.printStackTrace(writer);
  -        return bytes.toString();
  +        return XSPUtil.encodeMarkup (sw.toString());
       }
   
       /*
  
  
  
  1.9       +4 -6      xml-cocoon/src/org/apache/cocoon/Frontend.java
  
  Index: Frontend.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Frontend.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Frontend.java	2000/04/04 11:10:11	1.8
  +++ Frontend.java	2000/11/07 18:30:14	1.9
  @@ -1,4 +1,4 @@
  -/*-- $Id: Frontend.java,v 1.8 2000/04/04 11:10:11 stefano Exp $ -- 
  +/*-- $Id: Frontend.java,v 1.9 2000/11/07 18:30:14 greenrd Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -64,7 +64,7 @@
    * smart publishing behavior. (ECS may be used instead).
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.8 $ $Date: 2000/04/04 11:10:11 $
  + * @version $Revision: 1.9 $ $Date: 2000/11/07 18:30:14 $
    */
   
   public class Frontend implements Defaults {
  @@ -86,9 +86,7 @@
       }
   	
       public static void error(ServletResponse response, String message, Throwable t) throws IOException {
  -        StringWriter buffer = new StringWriter();
  -        if (t != null) t.printStackTrace(new PrintWriter(buffer));
  -    	print(response, message, buffer.toString());
  +    	print(response, message, Utils.getStackTraceAsString (t));
       }
   
       public static void print(ServletResponse response, String title, String message) throws IOException {
  @@ -198,4 +196,4 @@
           out.println("</table></td></tr></table></center></p>");
       }
   
  -}
  \ No newline at end of file
  +}