[prev in list] [next in list] [prev in thread] [next in thread] 

List:       synapse-dev
Subject:    svn commit: r579081 - in
From:       ruwan () apache ! org
Date:       2007-09-25 5:54:51
Message-ID: 20070925055456.6010B1A9832 () eris ! apache ! org
[Download RAW message or body]

Author: ruwan
Date: Mon Sep 24 22:54:51 2007
New Revision: 579081

URL: http://svn.apache.org/viewvc?rev=579081&view=rev
Log:
Fixing issue SYNAPSE-130

Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
  webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/POJOCommandMediator.java


Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
                
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main \
/java/org/apache/synapse/mediators/ext/ClassMediator.java?rev=579081&r1=579080&r2=579081&view=diff
 ==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java \
                (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java \
Mon Sep 24 22:54:51 2007 @@ -22,10 +22,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseConstants;
-import org.apache.synapse.ManagedLifecycle;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.MessageContext;
+import org.apache.synapse.*;
 import org.apache.synapse.core.SynapseEnvironment;
 import org.apache.synapse.mediators.AbstractMediator;
 
@@ -80,7 +77,11 @@
 						+ mediator.getClass());
 			}
 			return mediator.mediate(synCtx);
-		} finally {
+        } catch (Exception e) {
+            // throw Synapse Exception for any exception in class meditor
+            // so that the fault handler will be invoked
+            throw new SynapseException("Error occured in the mediation of the class \
mediator", e); +        } finally {
 			if (shouldTrace) {
 				trace.trace("End : Class mediator");
 			}

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/POJOCommandMediator.java
                
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main \
/java/org/apache/synapse/mediators/ext/POJOCommandMediator.java?rev=579081&r1=579080&r2=579081&view=diff
 ==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/POJOCommandMediator.java \
                (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/POJOCommandMediator.java \
Mon Sep 24 22:54:51 2007 @@ -77,42 +77,45 @@
         // instantiate the command object
         try {
             commandObject = command.newInstance();
-        } catch (InstantiationException e) {
-            handleException("Unable to instantiate the Command object", e);
-        } catch (IllegalAccessException e) {
-            handleException("Unable to instantiate the Command object", e);
-        }
 
-        // then set the properties
-        Iterator itr = properties.iterator();
-        while(itr.hasNext()) {
-            Object property = itr.next();
-            if(property instanceof OMElement) {
-                if(PropertyHelper.isStaticProperty((OMElement) property)) {
-                    PropertyHelper.setStaticProperty((OMElement) property, \
                commandObject);
-                } else {
-                    PropertyHelper.setDynamicProperty((OMElement) property, \
commandObject, synCtx); +            // then set the properties
+            Iterator itr = properties.iterator();
+            while (itr.hasNext()) {
+                Object property = itr.next();
+                if (property instanceof OMElement) {
+                    if (PropertyHelper.isStaticProperty((OMElement) property)) {
+                        PropertyHelper.setStaticProperty((OMElement) property, \
commandObject); +                    } else {
+                        PropertyHelper.setDynamicProperty((OMElement) property, \
commandObject, synCtx); +                    }
                 }
             }
-        }
 
-        // then call the execute method if the Command interface is implemented
-        if(commandObject instanceof Command) {
-            ((Command) commandObject).execute();
-        } else {
-            // use the reflection to find the execute method
-            try {
-                Method exeMethod = command.getMethod("execute", new Class[]{});
+            // then call the execute method if the Command interface is implemented
+            if (commandObject instanceof Command) {
+                ((Command) commandObject).execute();
+            } else {
+                // use the reflection to find the execute method
                 try {
-                    exeMethod.invoke(commandObject, new Object[]{});
-                } catch (IllegalAccessException e) {
-                    handleException("Unable to invoke the execute() method", e);
-                } catch (InvocationTargetException e) {
-                    handleException("Unable to invoke the execute() method", e);
+                    Method exeMethod = command.getMethod("execute", new Class[]{});
+                    try {
+                        exeMethod.invoke(commandObject, new Object[]{});
+                    } catch (IllegalAccessException e) {
+                        handleException("Unable to invoke the execute() method", e);
+                    } catch (InvocationTargetException e) {
+                        handleException("Unable to invoke the execute() method", e);
+                    }
+                } catch (NoSuchMethodException e) {
+                    // nothing to do in here (Command has no implementation)
                 }
-            } catch (NoSuchMethodException e) {
-                // nothing to do in here (Command has no implementation)
             }
+        } catch (InstantiationException e) {
+            handleException("Unable to instantiate the Command object", e);
+        } catch (IllegalAccessException e) {
+            handleException("Unable to instantiate the Command object", e);
+        } catch (Exception e) {
+            // convert any exception to SynException so that the fault handler will \
handle it +            handleException("Error occured in the mediation of the command \
mediator", e);  }
 
         // continue the mediator execution



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic