[jboss-cvs] JBossAS SVN: r101387 - trunk/varia/src/main/java/org/jboss/invocation/http/servlet.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 24 07:04:36 EST 2010


Author: remy.maucherat at jboss.com
Date: 2010-02-24 07:04:36 -0500 (Wed, 24 Feb 2010)
New Revision: 101387

Modified:
   trunk/varia/src/main/java/org/jboss/invocation/http/servlet/InvokerServlet.java
Log:
JBAS-7767: Improve error reporting when response is committed.

Modified: trunk/varia/src/main/java/org/jboss/invocation/http/servlet/InvokerServlet.java
===================================================================
--- trunk/varia/src/main/java/org/jboss/invocation/http/servlet/InvokerServlet.java	2010-02-24 11:56:23 UTC (rev 101386)
+++ trunk/varia/src/main/java/org/jboss/invocation/http/servlet/InvokerServlet.java	2010-02-24 12:04:36 UTC (rev 101387)
@@ -186,19 +186,27 @@
             between application and transport exceptions
          */
          InvocationException appException = new InvocationException(t);
-         log.debug("Invoke threw exception", t);
          // Marshall the exception
          if( returnValueAsAttribute == null || returnValueAsAttribute.booleanValue() == false )
          {
-            response.resetBuffer();
-            MarshalledValue mv = new MarshalledValue(appException);
-            ServletOutputStream sos = response.getOutputStream();
-            ObjectOutputStream oos = new ObjectOutputStream(sos);
-            oos.writeObject(mv);
-            oos.close();
+            if (response.isCommitted())
+            {
+               // Cannot report back exception
+               log.error("Invoke threw exception, and response is already committed", t);
+            }
+            else
+            {
+               response.resetBuffer();
+               MarshalledValue mv = new MarshalledValue(appException);
+               ServletOutputStream sos = response.getOutputStream();
+               ObjectOutputStream oos = new ObjectOutputStream(sos);
+               oos.writeObject(mv);
+               oos.close();
+            }
          }
          else
          {
+            log.debug("Invoke threw exception", t);
             request.setAttribute("returnValue", appException);
          }
       }




More information about the jboss-cvs-commits mailing list