You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2008/01/17 04:59:01 UTC

svn commit: r612700 - /mina/trunk/core/src/main/java/org/apache/mina/common/DefaultIoFilterChain.java

Author: trustin
Date: Wed Jan 16 19:59:00 2008
New Revision: 612700

URL: http://svn.apache.org/viewvc?rev=612700&view=rev
Log:
Better exception notification when an exception is raised by a filter before ConnectFuture is set

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/common/DefaultIoFilterChain.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/DefaultIoFilterChain.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/DefaultIoFilterChain.java?rev=612700&r1=612699&r2=612700&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/DefaultIoFilterChain.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/DefaultIoFilterChain.java Wed Jan 16 19:59:00 2008
@@ -429,27 +429,27 @@
     }
 
     public void fireExceptionCaught(Throwable cause) {
+        Entry head = this.head;
+        callNextExceptionCaught(head, session, cause);
+    }
+
+    private void callNextExceptionCaught(Entry entry, IoSession session,
+            Throwable cause) {
         // Notify the related future.
         ConnectFuture future = (ConnectFuture) session.removeAttribute(SESSION_OPENED_FUTURE);
         if (future == null) {
-            Entry head = this.head;
-            callNextExceptionCaught(head, session, cause);
+            try {
+                entry.getFilter().exceptionCaught(entry.getNextFilter(), session,
+                        cause);
+            } catch (Throwable e) {
+                IoSessionLogger.getLogger(session, getClass()).warn(
+                        "Unexpected exception from exceptionCaught handler.", e);
+            }
         } else {
             // Please note that this place is not the only place that
             // calls ConnectFuture.setException().
             session.close();
             future.setException(cause);
-        }
-    }
-
-    private void callNextExceptionCaught(Entry entry, IoSession session,
-            Throwable cause) {
-        try {
-            entry.getFilter().exceptionCaught(entry.getNextFilter(), session,
-                    cause);
-        } catch (Throwable e) {
-            IoSessionLogger.getLogger(session, getClass()).warn(
-                    "Unexpected exception from exceptionCaught handler.", e);
         }
     }