[mule-scm] [mule] [15991] branches/mule-3.x: Recorded merge of revisions 15990 via svnmerge from

View: New views
1 Messages — Rating Filter:   Alert me  

[mule-scm] [mule] [15991] branches/mule-3.x: Recorded merge of revisions 15990 via svnmerge from

by tcarlson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
[mule] [15991] branches/mule-3.x: Recorded merge of revisions 15990 via svnmerge from

Diff

Property changes: branches/mule-3.x

Name: svnmerge-integrated
   - /branches/mule-3.x-messaging:1-15430 /branches/mule-2.2.x:1-14052,14055-14056,14058-14062,14064,14066-14073,14076-14084,14086-14088,14091-14095,14097-14098,14100-14101,14103-14104,14106-14109,14111-14115,14117-14121,14123-14132,14135-14140,14142-14149,14152-14154,14156-14162,14165-14171,14173-14180,14182,14184-14189,14191-14195,14197-14203,14205,14207-14208,14210-14211,14214-14215,14217-14227,14230,14232-14236,14239,14241,14244,14246-14248,14250,14252-14253,14255-14256,14258-14263,14266-14269,14271-14278,14281-14282,14284,14286-14288,14292-14295,14297-14299,14301-14303,14306-14308,14310-14311,14313-14319,14321-14325,14327-14329,14331,14333-14339,14341-14343,14345-14357,14364-14368,14370-14374,14376-14378,14380-14381,14383-14397,14399-14400,14402,14404-14405,14407-14408,14410-14411,14413-14418,14421-14434,14436,14438,14440-14444,14449-14457,14459,14461-14462,14464-14469,14471-14475,14478-14480,14482-14484,14486-14504,14508-14535,14537-14592,14594-14595,14597-14638,14640-1
 4644,14646-14647,14649-14761,14763-14838,14840-14869,14872-14881,14890,14897,14899,14904,14906-14908,14910-14911,14913,14916,14921,14943,14946-14948,14969,14991,15010,15012,15022,15027,15040,15044,15063,15066,15076,15088,15094,15098,15101,15107,15112,15126,15132,15143,15189,15192,15200,15204,15207,15215,15220,15229-15230,15241,15245,15271,15284,15291,15293-15294,15296,15298-15299,15302,15307,15311,15315,15317-15322,15324-15355,15357-15365,15367,15369-15372,15374,15377,15387,15418,15420-15430,15433,15440,15442-15443,15450,15452,15456-15462,15465,15467-15470,15489-15492,15513,15532,15554,15556-15561,15563-15586,15588-15589,15591-15596,15599-15665,15667-15688,15690-15721,15723-15745,15747-15753,15755-15756,15760-15765,15774-15777,15781-15794,15796-15800,15802-15804,15806-15828,15830-15833,15835-15858,15863,15865-15875,15881-15884,15889,15892-15902,15908-15910,15912-15913,15915-15921,15923,15935-15938,15944-15962,15975,15978,15983 /branches/mule-3.x-xmpp:1-15727
   + /branches/mule-2.2.x:1-14052,14055-14056,14058-14062,14064,14066-14073,14076-14084,14086-14088,14091-14095,14097-14098,14100-14101,14103-14104,14106-14109,14111-14115,14117-14121,14123-14132,14135-14140,14142-14149,14152-14154,14156-14162,14165-14171,14173-14180,14182,14184-14189,14191-14195,14197-14203,14205,14207-14208,14210-14211,14214-14215,14217-14227,14230,14232-14236,14239,14241,14244,14246-14248,14250,14252-14253,14255-14256,14258-14263,14266-14269,14271-14278,14281-14282,14284,14286-14288,14292-14295,14297-14299,14301-14303,14306-14308,14310-14311,14313-14319,14321-14325,14327-14329,14331,14333-14339,14341-14343,14345-14357,14364-14368,14370-14374,14376-14378,14380-14381,14383-14397,14399-14400,14402,14404-14405,14407-14408,14410-14411,14413-14418,14421-14434,14436,14438,14440-14444,14449-14457,14459,14461-14462,14464-14469,14471-14475,14478-14480,14482-14484,14486-14504,14508-14535,14537-14592,14594-14595,14597-14638,14640-14644,14646-14647,14649-14761,14763-14
 838,14840-14869,14872-14881,14890,14897,14899,14904,14906-14908,14910-14911,14913,14916,14921,14943,14946-14948,14969,14991,15010,15012,15022,15027,15040,15044,15063,15066,15076,15088,15094,15098,15101,15107,15112,15126,15132,15143,15189,15192,15200,15204,15207,15215,15220,15229-15230,15241,15245,15271,15284,15291,15293-15294,15296,15298-15299,15302,15307,15311,15315,15317-15322,15324-15355,15357-15365,15367,15369-15372,15374,15377,15387,15418,15420-15430,15433,15440,15442-15443,15450,15452,15456-15462,15465,15467-15470,15489-15492,15513,15532,15554,15556-15561,15563-15586,15588-15589,15591-15596,15599-15665,15667-15688,15690-15721,15723-15745,15747-15753,15755-15756,15760-15765,15774-15777,15781-15794,15796-15800,15802-15804,15806-15828,15830-15833,15835-15858,15863,15865-15875,15881-15884,15889,15892-15902,15908-15910,15912-15913,15915-15921,15923,15935-15938,15944-15962,15975,15978,15983,15990 /branches/mule-3.x-messaging:1-15430 /branches/mule-3.x-xmpp:1-15727

Modified: branches/mule-3.x/core/src/main/java/org/mule/AbstractExceptionListener.java (15990 => 15991)

--- branches/mule-3.x/core/src/main/java/org/mule/AbstractExceptionListener.java	2009-11-06 20:12:14 UTC (rev 15990)
+++ branches/mule-3.x/core/src/main/java/org/mule/AbstractExceptionListener.java	2009-11-07 00:59:26 UTC (rev 15991)
@@ -81,6 +81,11 @@
 
     protected boolean enableNotifications = true;
 
+    /**
+     * A message to be returned to the caller as a result of this exception handling.
+     */
+    private MuleMessage returnMessage = null;
+    
     public void setMuleContext(MuleContext context)
     {
         this.muleContext = context;
@@ -598,4 +603,24 @@
      */
     public abstract void handleStandardException(Throwable e);
 
+    public MuleMessage getReturnMessage()
+    {
+        return returnMessage;
+    }
+
+    /**
+     * Set a message to be returned to the caller as a result of this exception handling.
+     */
+    public void setReturnMessage(MuleMessage returnMessage)
+    {
+        this.returnMessage = returnMessage;
+    }
+
+    /**
+     * Set a message to be returned to the caller as a result of this exception handling.
+     */
+    public void setReturnMessage(Object returnMessage)
+    {
+        this.returnMessage = new DefaultMuleMessage(returnMessage, RequestContext.getEvent().getMessage(), muleContext);
+    }
 }

Modified: branches/mule-3.x/core/src/main/java/org/mule/model/seda/SedaService.java (15990 => 15991)

--- branches/mule-3.x/core/src/main/java/org/mule/model/seda/SedaService.java	2009-11-06 20:12:14 UTC (rev 15990)
+++ branches/mule-3.x/core/src/main/java/org/mule/model/seda/SedaService.java	2009-11-07 00:59:26 UTC (rev 15991)
@@ -10,6 +10,7 @@
 
 package org.mule.model.seda;
 
+import org.mule.AbstractExceptionListener;
 import org.mule.DefaultMuleEvent;
 import org.mule.DefaultMuleMessage;
 import org.mule.FailedToQueueEventException;
@@ -272,10 +273,16 @@
             }
             if (result == null)
             {
-                // important that we pull event from request context here as it may
-                // have been modified
-                // (necessary to avoid scribbling between threads)
-                result = new DefaultMuleMessage(NullPayload.getInstance(), RequestContext.getEvent().getMessage(), muleContext);
+                if (exceptionListener != null 
+                    && exceptionListener instanceof AbstractExceptionListener 
+                    && ((AbstractExceptionListener) exceptionListener).getReturnMessage() != null)
+                {
+                    result = ((AbstractExceptionListener) exceptionListener).getReturnMessage();
+                }
+                else
+                {
+                    result = new DefaultMuleMessage(NullPayload.getInstance(), RequestContext.getEvent().getMessage(), muleContext);
+                }
             }
             ExceptionPayload exceptionPayload = result.getExceptionPayload();
             if (exceptionPayload == null)

Copied: branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java (from rev 15990, branches/mule-2.2.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java) (0 => 15991)

--- branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java	                        (rev 0)
+++ branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java	2009-11-07 00:59:26 UTC (rev 15991)
@@ -0,0 +1,37 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.exceptions;
+
+import org.mule.api.MuleMessage;
+import org.mule.module.client.MuleClient;
+import org.mule.tck.FunctionalTestCase;
+
+public class ExceptionStrategyReturnMessageTestCase extends FunctionalTestCase
+{
+    @Override
+    protected String getConfigResources()
+    {
+        return "org/mule/test/integration/exceptions/exception-strategy-return-message.xml";
+    }
+
+    public void testExceptionMessage() throws Exception
+    {
+        MuleClient client = new MuleClient();
+        MuleMessage msg = client.send("vm://in", "Test Message", null);
+
+        assertNotNull(msg);
+        assertNotNull(msg.getExceptionPayload());
+        assertEquals("Functional Test Service Exception", msg.getExceptionPayload().getMessage());
+
+        assertNotNull(msg.getPayload());
+        assertEquals("Ka-boom!", msg.getPayload());
+    }
+}

Copied: branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java (from rev 15990, branches/mule-2.2.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java) (0 => 15991)

--- branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java	                        (rev 0)
+++ branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java	2009-11-07 00:59:26 UTC (rev 15991)
@@ -0,0 +1,28 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.exceptions;
+
+import org.mule.DefaultExceptionStrategy;
+import org.mule.RequestContext;
+import org.mule.message.DefaultExceptionPayload;
+
+public class TestExceptionStrategy extends DefaultExceptionStrategy
+{
+    @Override
+    protected void defaultHandler(Throwable t)
+    {
+        if (RequestContext.getEvent() != null)
+        {
+            RequestContext.setExceptionPayload(new DefaultExceptionPayload(t));
+            setReturnMessage("Ka-boom!");
+        }
+    }
+}

Copied: branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml (from rev 15990, branches/mule-2.2.x/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml) (0 => 15991)

--- branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml	                        (rev 0)
+++ branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml	2009-11-07 00:59:26 UTC (rev 15991)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xmlns:test="http://www.mulesource.org/schema/mule/test/2.2"
+      xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"	  
+      xsi:schemaLocation="
+            http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
+            http://www.mulesource.org/schema/mule/test/2.2 http://www.mulesource.org/schema/mule/test/2.2/mule-test.xsd
+			http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd">
+
+    <model>
+        <service name="InputService">
+            <inbound>
+                <vm:inbound-endpoint path="in" synchronous="true" />
+            </inbound>
+            <outbound>
+                <pass-through-router>
+                    <vm:outbound-endpoint path="badService" synchronous="true"/>
+                </pass-through-router>
+            </outbound>
+        </service>
+        
+        <service name="ExceptionService">
+            <inbound>
+		        <vm:inbound-endpoint path="badService" />
+            </inbound>
+            <test:component throwException="true" />
+            <custom-exception-strategy class="org.mule.test.integration.exceptions.TestExceptionStrategy" /> 
+        </service>
+    </model>
+</mule>


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email