コード例 #1
0
 @Override
 public MuleEvent handleException(Exception ex, MuleEvent event) {
   doHandleException(ex, event);
   DefaultMuleMessage message = new DefaultMuleMessage(NullPayload.getInstance(), muleContext);
   message.setExceptionPayload(
       new DefaultExceptionPayload(
           new MessagingException(event, new RuntimeException("Bad news!"))));
   return new DefaultMuleEvent(message, event);
 }
コード例 #2
0
 public DefaultMuleMessage(Object message, MessageAdapter previous) {
   if (message instanceof MessageAdapter) {
     adapter = (MessageAdapter) message;
     ((ThreadSafeAccess) adapter).resetAccessControl();
   } else {
     adapter = new DefaultMessageAdapter(message, previous);
   }
   if (previous.getExceptionPayload() != null) {
     setExceptionPayload(previous.getExceptionPayload());
   }
   setEncoding(previous.getEncoding());
   if (previous.getAttachmentNames().size() > 0) {
     Set<String> attNames = adapter.getAttachmentNames();
     for (String s : attNames) {
       try {
         addAttachment(s, adapter.getAttachment(s));
       } catch (Exception e) {
         throw new MuleRuntimeException(CoreMessages.failedToReadAttachment(s), e);
       }
     }
   }
   resetAccessControl();
 }