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