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/commons/src/java/org/apache/jetspeed/dispatcher JetspeedRequestDispatcher.java
Date Tue, 07 Sep 2004 17:01:56 GMT
weaver      2004/09/07 10:01:56

  Modified:    commons/src/java/org/apache/jetspeed/dispatcher
                        JetspeedRequestDispatcher.java
  Log:
  Make sure that error reporting does not cause IllegalStateExceptions.
  
  Revision  Changes    Path
  1.6       +19 -2     jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/dispatcher/JetspeedRequestDispatcher.java
  
  Index: JetspeedRequestDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/dispatcher/JetspeedRequestDispatcher.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JetspeedRequestDispatcher.java	18 Aug 2004 01:13:27 -0000	1.5
  +++ JetspeedRequestDispatcher.java	7 Sep 2004 17:01:56 -0000	1.6
  @@ -15,9 +15,11 @@
    */
   package org.apache.jetspeed.dispatcher;
   
  +import java.io.IOException;
   import java.io.PrintWriter;
   
   import javax.servlet.RequestDispatcher;
  +import javax.servlet.ServletResponse;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.portlet.PortletRequestDispatcher;
  @@ -68,7 +70,7 @@
               PrintWriter pw = null;
               if (servletResponse != null)
               {
  -                pw = servletResponse.getWriter();
  +                pw = getPrintWriter(servletResponse);
                   pw.write("JetspeedRequestDispatcher failed to include servlet resources.
(details below) <br/>");
                   pw.write("Exception: " + e.getClass().getName() + " <br/>");
                   pw.write("Message: " + e.getMessage() + " <br/>");
  @@ -112,6 +114,21 @@
           {
               pw.write("&nbsp;&nbsp;&nbsp;" + traceArray[i].toString() + "<br
/>");
           }
  +    }
  +    
  +    private static final PrintWriter getPrintWriter(ServletResponse response) throws IOException
  +    {
  +        PrintWriter pw = null;
  +        try
  +        {
  +            pw = response.getWriter();
  +        }
  +        catch(IllegalStateException ise)
  +        {
  +            pw = new PrintWriter(response.getOutputStream());
  +        }
  +        
  +        return pw;
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message