Author: boisvert
Date: Mon May  7 16:39:28 2007
New Revision: 536020

URL: http://svn.apache.org/viewvc?view=rev&rev=536020
Log:
Proper error handling for communication exceptions

Modified:
    
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java

Modified: 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java?view=diff&rev=536020&r1=536019&r2=536020
==============================================================================
--- 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
 (original)
+++ 
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
 Mon May  7 16:39:28 2007
@@ -142,7 +142,7 @@
                                         reply(mexId, operation, response, 
false);
                                     }
                                 } catch (Throwable t) {
-                                    String errmsg = "Error sending message to 
Axis2 for ODE mex " + odeMex;
+                                    String errmsg = "Error sending message 
(mex=" + odeMex + "): " + t.getMessage();
                                     __log.error(errmsg, t);
                                     replyWithFailure(mexId, 
MessageExchange.FailureType.COMMUNICATION_ERROR, errmsg, null);
                                 }
@@ -242,11 +242,10 @@
     private void replyWithFailure(final String odeMexId, final FailureType 
error, final String errmsg,
             final Element details) {
         // ODE MEX needs to be invoked in a TX.
-        final PartnerRoleMessageExchange odeMex =
-                (PartnerRoleMessageExchange)  
_server.getEngine().getMessageExchange(odeMexId);
         try {
             _sched.execIsolatedTransaction(new Callable<Void>() {
                 public Void call() throws Exception {
+                    PartnerRoleMessageExchange odeMex = 
(PartnerRoleMessageExchange)  _server.getEngine().getMessageExchange(odeMexId);
                     odeMex.replyWithFailure(error, errmsg, details);
                     return null;
                 }
@@ -299,11 +298,9 @@
                                 odeMex.replyWithFault(faultType, response);
                             } else {
                                 if (__log.isDebugEnabled()) {
-                                    __log
-                                            .debug("FAULT RESPONSE(unknown 
fault type): "
-                                                    + 
DOMUtils.domToString(odeMsgEl));
+                                    __log.debug("FAULT RESPONSE(unknown fault 
type): " + DOMUtils.domToString(odeMsgEl));
                                 }
-                                
odeMex.replyWithFailure(FailureType.FORMAT_ERROR, reply.getEnvelope().getBody()
+                                odeMex.replyWithFailure(FailureType.OTHER, 
reply.getEnvelope().getBody()
                                         .getFault().getText(), null);
                             }
                         } else {
@@ -316,7 +313,7 @@
                     } catch (Exception ex) {
                         String errmsg = "Unable to process response: " + 
ex.getMessage();
                         __log.error(errmsg, ex);
-                        odeMex.replyWithFailure(FailureType.FORMAT_ERROR, 
errmsg, null);
+                        odeMex.replyWithFailure(FailureType.OTHER, errmsg, 
null);
                     }
                     return null;
                 }


Reply via email to