Coverage Report - org.mule.api.routing.RoutingException
 
Classes in this File Line Coverage Branch Coverage Complexity
RoutingException
0%
0/18
0%
0/2
1.333
 
 1  
 /*
 2  
  * $Id: RoutingException.java 19739 2010-09-27 14:28:40Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.api.routing;
 12  
 
 13  
 import org.mule.api.MessagingException;
 14  
 import org.mule.api.MuleEvent;
 15  
 import org.mule.api.processor.MessageProcessor;
 16  
 import org.mule.config.i18n.CoreMessages;
 17  
 import org.mule.config.i18n.Message;
 18  
 
 19  
 /**
 20  
  * <code>RoutingException</code> is a base class for all routing exceptions.
 21  
  * Routing exceptions are only thrown for DefaultInboundRouterCollection and
 22  
  * DefaultOutboundRouterCollection and deriving types. Mule itself does not throw routing
 23  
  * exceptions when routing internal events.
 24  
  */
 25  
 public class RoutingException extends MessagingException
 26  
 {
 27  
     /**
 28  
      * Serial version
 29  
      */
 30  
     private static final long serialVersionUID = 2478458847072048645L;
 31  
 
 32  
     protected final transient MessageProcessor route;
 33  
 
 34  
     public RoutingException(MuleEvent event, MessageProcessor route)
 35  
     {
 36  0
         super(generateMessage(null, route), event);
 37  0
         this.route = route;
 38  0
     }
 39  
 
 40  
     public RoutingException(MuleEvent event, MessageProcessor route, Throwable cause)
 41  
     {
 42  0
         super(generateMessage(null, route), event, cause);
 43  0
         this.route = route;
 44  0
     }
 45  
 
 46  
     public RoutingException(Message message, MuleEvent event, MessageProcessor route)
 47  
     {
 48  0
         super(generateMessage(message, route), event);
 49  0
         this.route = route;
 50  0
     }
 51  
 
 52  
     public RoutingException(Message message, MuleEvent event, MessageProcessor route, Throwable cause)
 53  
     {
 54  0
         super(generateMessage(message, route), event, cause);
 55  0
         this.route = route;
 56  0
     }
 57  
 
 58  
     public MessageProcessor getRoute()
 59  
     {
 60  0
         return route;
 61  
     }
 62  
 
 63  
     private static Message generateMessage(Message message, MessageProcessor target)
 64  
     {
 65  0
         Message m = CoreMessages.failedToRouterViaEndpoint(target);
 66  0
         if (message != null)
 67  
         {
 68  0
             message.setNextMessage(m);
 69  0
             return message;
 70  
         }
 71  
         else
 72  
         {
 73  0
             return m;
 74  
         }
 75  
     }
 76  
 }