You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/09/25 13:14:44 UTC

svn commit: r449650 - /incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java

Author: gnodet
Date: Mon Sep 25 04:14:43 2006
New Revision: 449650

URL: http://svn.apache.org/viewvc?view=rev&rev=449650
Log:
SM-570: HTTP connector can blow up while trying to report a problem

Modified:
    incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java

Modified: incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java?view=diff&rev=449650&r1=449649&r2=449650
==============================================================================
--- incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java (original)
+++ incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/http/HttpBindingSupport.java Mon Sep 25 04:14:43 2006
@@ -24,6 +24,7 @@
 import javax.jbi.JBIException;
 import javax.jbi.messaging.NormalizedMessage;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.PrintWriter;
 
 /**
@@ -59,7 +60,13 @@
 
     protected void outputException(HttpServletResponse response, Exception e) throws IOException {
         response.setStatus(BAD_REQUEST_STATUS_CODE);
-        PrintWriter writer = response.getWriter();
+        PrintWriter writer = null;
+        try {
+            writer = response.getWriter();
+        } catch (IllegalStateException ise) {
+            OutputStream os = response.getOutputStream();
+            writer = new PrintWriter (os);
+        }
         writer.println("Request failed with error: " + e);
         e.printStackTrace(writer);
     }