public Throwable getException() { if(message.getExceptionPayload()!=null) { return message.getExceptionPayload().getRootException(); } return null; }
/** * @param message message to check * @return true if there was an exception payload set */ protected boolean exceptionPayloadAvailable(MuleMessage message) { if (message == null) { return false; } final ExceptionPayload exceptionPayload = message.getExceptionPayload(); if (exceptionPayload != null) { logger.info("Failure returned, will try next endpoint. Exception payload is: " + exceptionPayload); return true; } else { return false; } }
/** * Determines if the routing should continue after receiving a given * response from an synchronous endpoint. * * @param event the last received response event * @return true if the message is not null and is not an exception message. * False otherwise. */ @Override protected boolean continueRoutingMessageAfter(MuleEvent event) { boolean result = true; MuleMessage muleMessage = event.getMessage(); if (muleMessage == null || muleMessage.getExceptionPayload() != null) { logger.warn("Sequence router will stop routing current message"); result = false; } return result; } }
private MessagingException getExceptionForCreatingFailureResponse(MessagingException messagingException, MuleEvent response) { MessagingException e = messagingException; if (response != null && response.getMessage().getExceptionPayload() != null && response.getMessage().getExceptionPayload().getException() instanceof MessagingException) { e = (MessagingException) response.getMessage().getExceptionPayload().getException(); } return e; }
private static ExceptionPayload getExceptionPayload(MuleEvent event) { if (event == null || VoidMuleEvent.getInstance().equals(event)) { return null; } final MuleMessage message = event.getMessage(); if (message == null) { return null; } return message.getExceptionPayload(); }
public static ExceptionPayload getExceptionPayload() { return getEvent().getMessage().getExceptionPayload(); }
public MuleEvent process(MuleEvent event) throws MuleException { if (event != null && !VoidMuleEvent.getInstance().equals(event)) { MuleMessage resultMessage = event.getMessage(); if (resultMessage != null) { if (resultMessage.getExceptionPayload() != null) { setExceptionDetails(resultMessage, connector, resultMessage.getExceptionPayload() .getException()); } } } return event; }
@Override public boolean evaluate(Object object) { if (VoidMuleEvent.getInstance().equals(object) || object == null) { return false; } MuleEvent event = (MuleEvent) object; ExceptionPayload ep = event.getMessage().getExceptionPayload(); return ep != null && ep.getException() != null; } };
/** * Returns a {@link NavigableMap} in which the key is a zero-based route index * and the value is an {@link Throwable} generated by it. Notice that this is a * collect operation. Each time this method is invoked the result will be * re-calculated * * @return a @{link {@link NavigableMap}. It could be empty but it will never be * <code>null</code> */ public NavigableMap<Integer, Throwable> collectRouteExceptions() { NavigableMap<Integer, Throwable> routes = new TreeMap<Integer, Throwable>(); for (int i = 0; i < this.events.size(); i++) { MuleEvent event = this.events.get(i); if (failedEventsPredicate.evaluate(event)) { routes.put(i, event.getMessage().getExceptionPayload().getException()); } } return routes; }
/** * Check a given message against this filter. * * @param message a non null message to filter. * @return <code>true</code> if the message matches the filter */ public boolean accept(MuleMessage message) { ExceptionPayload epl = message.getExceptionPayload(); if (getExpectedType() == null) { return epl != null; } else if (epl != null) { return getExpectedType().isAssignableFrom(epl.getException().getClass()); } else { return false; } }
/** * Always accept MessageRedeliveryException exceptions if this rollback exception strategy handles redelivery. */ @Override protected boolean acceptsEvent(MuleEvent event) { return event.getMessage().getExceptionPayload().getException() instanceof MessageRedeliveredException && this.hasMaxRedeliveryAttempts(); }
if (reply.getExceptionPayload() != null) throw findDeclaredMethodException(method, reply.getExceptionPayload().getException());
if (responseEvent != null && responseEvent.getMessage().getExceptionPayload() != null && responseEvent.getMessage().getExceptionPayload().getException() instanceof MessagingException) message = responseEvent.getMessage().getExceptionPayload().getException().getMessage(); if (responseEvent != null && responseEvent.getMessage().getExceptionPayload() == null)
@Override public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException { ExceptionPayload ep = message.getExceptionPayload(); Throwable e = ep.getException(); Throwable re = ep.getRootException(); String cid = message.getCorrelationId(); log.warn("CorrId: {}, Error: {}, {}", new Object[] {cid, e, re}); String errorText = e.getMessage(); if (re != null) { errorText += ", " + re.getMessage(); } LastUnsuccessfulSynchErrorType error = new LastUnsuccessfulSynchErrorType(); error.setCausingAgent(CausingAgentEnum.VIRTUALIZATION_PLATFORM); error.setCode(Integer.toString(ep.getCode())); error.setText(errorText); String logicalAddress = message.getInvocationProperty("logical-address"); message.setExceptionPayload(null); message.setPayload(new Object[] {logicalAddress, error}); return message; } }
if (response.getExceptionPayload() != null) throw new DispatchException(MessageFactory.createStaticMessage("Unable to send or route message"), event, ep, response.getExceptionPayload().getRootException());
if (response.getExceptionPayload() != null) throw new DispatchException(MessageFactory.createStaticMessage("Unable to send or route message"), event, ep, response.getExceptionPayload().getRootException());
setEncoding(previous.getEncoding()); if (previous.getExceptionPayload() != null) setExceptionPayload(previous.getExceptionPayload());
&& !VoidMuleEvent.getInstance().equals(resultEvent) && resultEvent.getMessage() != null && resultEvent.getMessage().getExceptionPayload() != null && resultEvent.getMessage().getExceptionPayload().getException() instanceof FilterUnacceptedException)
boolean inputEventHasExceptionPayload = event.getMessage().getExceptionPayload() != null; try
@Test public void testDefaultLoanBrokerRequest() throws Exception { MuleClient client = muleContext.getClient(); @SuppressWarnings("unchecked") Map<String, Object> props = new SingletonMap("http.method", HttpConstants.METHOD_GET); MuleMessage result = client.send("http://localhost:11081?name=Muley&amount=20000&term=48&ssn=1234", null, props); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertNull(result.getExceptionPayload()); assertTrue("Unexpected response string", result.getPayloadAsString().matches("Bank #\\d, rate: \\d\\.(\\d)*$")); }