[jboss-cvs] JBoss Messaging SVN: r2584 - trunk/src/main/org/jboss/jms/client/delegate.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 18 10:02:35 EDT 2007


Author: timfox
Date: 2007-04-18 10:02:35 -0400 (Wed, 18 Apr 2007)
New Revision: 2584

Modified:
   trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
Log:
Improved exception catching due to remoting hiding real network exception



Modified: trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-04-17 20:55:32 UTC (rev 2583)
+++ trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-04-18 14:02:35 UTC (rev 2584)
@@ -219,11 +219,32 @@
          log.warn("Captured Exception:" + t, t);
          return new MessagingNetworkFailureException((Exception)t);
       }
-      else
+      else if (t instanceof RuntimeException)
       {
-         log.error("Failed", t);
-         return new MessagingJMSException("Failed to invoke", t);
+         RuntimeException re = (RuntimeException)t;
+         
+         Throwable initCause = re.getCause();
+         
+         if (initCause != null)
+         {
+            do
+            {
+               if ((t instanceof CannotConnectException) ||
+                        (t instanceof IOException) ||
+                        (t instanceof ConnectionFailedException))
+               {
+                  log.warn("Captured Exception:" + t, t);
+                  return new MessagingNetworkFailureException((Exception)t);
+               }
+               initCause = initCause.getCause();
+            }
+            while (initCause != null);
+         }
       }
+         
+      log.error("Failed", t);
+      return new MessagingJMSException("Failed to invoke", t);
+      
    }
    
    public Client getClient()




More information about the jboss-cvs-commits mailing list