Examples of DefaultExceptionPayload


Examples of org.mule.message.DefaultExceptionPayload

    @Test
    public void exception() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage("", muleContext);
        RuntimeException rte = new RuntimeException();
        message.setExceptionPayload(new DefaultExceptionPayload(rte));
        assertEquals(rte, evaluate("exception", message));
    }
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

    @Test
    public void assignException() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage("", muleContext);
        message.setExceptionPayload(new DefaultExceptionPayload(new RuntimeException()));
        assertImmutableVariable("exception='other'", message);
    }
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

    {
        MuleMessage message = new DefaultMuleMessage("", muleContext);
        MessagingException me = new MessagingException(CoreMessages.createStaticMessage(""),
            new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, getTestService()),
            new IllegalAccessException());
        message.setExceptionPayload(new DefaultExceptionPayload(me));
        assertTrue((Boolean) evaluate("exception.causedBy(java.lang.IllegalAccessException)", message));
    }
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

            //Throwable t = ExceptionHelper.getRootException(ex);

            logException(ex);
            doHandleException(ex, event);

            ExceptionPayload exceptionPayload = new DefaultExceptionPayload(ex);
            if (RequestContext.getEvent() != null)
            {
                RequestContext.setExceptionPayload(exceptionPayload);
            }
            event.getMessage().setPayload(NullPayload.getInstance());
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

            muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_START));
            FlowConstruct flowConstruct = event.getFlowConstruct();
            fireNotification(exception);
            logException(exception);
            processStatistics(event);
            event.getMessage().setExceptionPayload(new DefaultExceptionPayload(exception));
            event = beforeRouting(exception, event);
            event = route(event, exception);
            processOutboundRouterStatistics(flowConstruct);
            event = afterRouting(exception, event);
            markExceptionAsHandledIfRequired(exception);
            if (event != null && !VoidMuleEvent.getInstance().equals(event))
            {
                processReplyTo(event, exception);
                closeStream(event.getMessage());
                nullifyExceptionPayloadIfRequired(event);
            }
            return event;
        }
        catch (Exception e)
        {
            MessagingException messagingException;
            if (e instanceof MessagingException)
            {
                messagingException = (MessagingException) e;
            }
            else
            {
                messagingException = new MessagingException(event, e);
            }
            try
            {
                logger.error("Exception during exception strategy execution");
                logException(e);
                TransactionCoordination.getInstance().rollbackCurrentTransaction();
            }
            catch (Exception ex)
            {
                //Do nothing
            }
            event.getMessage().setExceptionPayload(new DefaultExceptionPayload(messagingException));
            return event;
        }
        finally
        {
            muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_END));
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

    {
        if (!getMessageProcessors().isEmpty())
        {
            try
            {
                event.getMessage().setExceptionPayload(new DefaultExceptionPayload(t));
                MuleEvent result = configuredMessageProcessors.process(event);               
                return result;
            }
            catch (Exception e)
            {
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

        {
            logger.debug("Committing transaction");
            commit();
        }

        ExceptionPayload exceptionPayload = new DefaultExceptionPayload(ex);
        if (RequestContext.getEvent() != null)
        {
            RequestContext.setExceptionPayload(exceptionPayload);
        }
       
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

    }

    @Override
    public MuleEvent handleException(Exception exception, MuleEvent event)
    {
        event.getMessage().setExceptionPayload(new DefaultExceptionPayload(exception));
        for (MessagingExceptionHandlerAcceptor exceptionListener : exceptionListeners)
        {
            if (exceptionListener.accept(event))
            {
                event.getMessage().setExceptionPayload(null);
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

        assertTrue(router.isMatch(message));

        // remote endpoint failed and set an exception payload on the returned
        // message
        MuleMessage exPayloadMessage = new DefaultMuleMessage("there was a failure", muleContext);
        exPayloadMessage.setExceptionPayload(new DefaultExceptionPayload(new RuntimeException()));
        MuleEvent exPayloadMessageEvent = new OutboundRoutingTestEvent(exPayloadMessage, null, muleContext);


        final MuleSession session = mock(MuleSession.class);
        // 1st failure
View Full Code Here

Examples of org.mule.message.DefaultExceptionPayload

    {
        ExceptionTypeFilter filter = new ExceptionTypeFilter();
        assertNull(filter.getExpectedType());
        MuleMessage m = new DefaultMuleMessage("test", muleContext);
        assertTrue(!filter.accept(m));
        m.setExceptionPayload(new DefaultExceptionPayload(new IllegalArgumentException("test")));
        assertTrue(filter.accept(m));

        filter = new ExceptionTypeFilter(IOException.class);
        assertTrue(!filter.accept(m));
        m.setExceptionPayload(new DefaultExceptionPayload(new IOException("test")));
        assertTrue(filter.accept(m));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.