[Bedework-commit] webapps r909 - trunk/webcommon/src/org/bedework/webcommon

svnadmin at bedework.org svnadmin at bedework.org
Wed Mar 4 21:00:15 EST 2009


Author: douglm
Date: 2009-03-04 21:00:13 -0500 (Wed, 04 Mar 2009)
New Revision: 909

Modified:
   trunk/webcommon/src/org/bedework/webcommon/BwSvciFilter.java
Log:
Improve handling of messages - try to ensure transactions are terminated correctly.

Modified: trunk/webcommon/src/org/bedework/webcommon/BwSvciFilter.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/BwSvciFilter.java	2009-03-04 22:31:30 UTC (rev 908)
+++ trunk/webcommon/src/org/bedework/webcommon/BwSvciFilter.java	2009-03-05 02:00:13 UTC (rev 909)
@@ -104,6 +104,8 @@
     HttpSession sess = hreq.getSession();
     BwCallback cb = null;
 
+    Throwable thr = null;
+
     try {
       cb = getCb(sess, "in");
 
@@ -121,7 +123,12 @@
        */
       req.setCharacterEncoding("UTF-8");
 
-      chain.doFilter(req, resp);
+      try {
+        chain.doFilter(req, resp);
+      } catch (Throwable dft) {
+        getLogger().error("Exception in filter: ", dft);
+        thr = dft;
+      }
 
       cb = getCb(sess, "out");
       if (cb != null) {
@@ -133,7 +140,7 @@
         cb.error(hreq, hresp, t);
       } catch (Throwable t1) {
         getLogger().error("Callback exception: ", t1);
-        throw new ServletException(t);
+        thr = t1;
       }
     } finally {
       try {
@@ -144,8 +151,15 @@
         }
       } catch (Throwable t) {
         getLogger().error("Callback exception: ", t);
-        throw new ServletException(t);
+        thr = t;
       }
+
+      if (thr != null) {
+        if (thr instanceof ServletException) {
+          throw (ServletException)thr;
+        }
+        throw new ServletException(thr);
+      }
     }
   }
 



More information about the Bedework-commit mailing list