portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/valve/impl VerySimpleLayoutValveImpl.java
Date Tue, 12 Aug 2003 20:28:49 GMT
weaver      2003/08/12 13:28:49

  Modified:    portal/src/java/org/apache/jetspeed/pipeline/valve/impl
                        VerySimpleLayoutValveImpl.java
  Log:
  added better error reporting
  
  Revision  Changes    Path
  1.2       +35 -2     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/VerySimpleLayoutValveImpl.java
  
  Index: VerySimpleLayoutValveImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/VerySimpleLayoutValveImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VerySimpleLayoutValveImpl.java	12 Aug 2003 18:29:03 -0000	1.1
  +++ VerySimpleLayoutValveImpl.java	12 Aug 2003 20:28:49 -0000	1.2
  @@ -53,9 +53,12 @@
    */
   package org.apache.jetspeed.pipeline.valve.impl;
   
  +import java.io.IOException;
  +import java.io.PrintWriter;
   import java.util.Stack;
   
   import javax.servlet.RequestDispatcher;
  +import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   
   import org.apache.commons.logging.Log;
  @@ -106,7 +109,28 @@
           }
           catch (Exception e)
           {
  -            log.error("VerySimpleLayout: Unable to include layout header.  Layout not processed",
e);
  +            try
  +            {
  +                log.error("VerySimpleLayout: Unable to include layout header.  Layout not
processed", e);
  +                PrintWriter pw = request.getResponse().getWriter();
  +                pw.write("VerySimpleLayoutFailed failed to include servlet resources. (details
below) <br/>");
  +                pw.write("Exception: " + e.getClass().getName() + " <br/>");
  +                pw.write("Message: " + e.getMessage() + " <br/>");
  +                writeStackTrace(e.getStackTrace(), pw);
  +
  +                if (e instanceof ServletException && ((ServletException) e).getRootCause()
!= null)
  +                {
  +                    Throwable rootCause = ((ServletException) e).getRootCause();
  +                    pw.write("Root Cause: " + rootCause.getClass().getName() + " <br/>");
  +                    pw.write("Message: " + rootCause.getMessage() + " <br/>");
  +                    writeStackTrace(rootCause.getStackTrace(), pw);
  +                }
  +            }
  +            catch (IOException e1)
  +            {
  +                // don't worry
  +            }
  +
           }
           finally
           {
  @@ -121,6 +145,15 @@
       public String toString()
       {
           return "VerySimpleLayoutValveImpl";
  +    }
  +
  +    protected static final void writeStackTrace(StackTraceElement[] traceArray, PrintWriter
pw)
  +    {
  +        pw.write("<p>Stack Trace: </p>");
  +        for (int i = 0; i < traceArray.length; i++)
  +        {
  +            pw.write("&nbsp;&nbsp;&nbsp;" + traceArray[i].toString() + "<br
/>");
  +        }
       }
   
   }
  
  
  

Mime
View raw message