Coverage Report - org.mule.api.service.ServiceException
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceException
0%
0/15
0%
0/2
1.4
 
 1  
 /*
 2  
  * $Id: ServiceException.java 10529 2008-01-25 05:58:36Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.service;
 12  
 
 13  
 import org.mule.api.MessagingException;
 14  
 import org.mule.api.MuleMessage;
 15  
 import org.mule.config.i18n.CoreMessages;
 16  
 import org.mule.config.i18n.Message;
 17  
 
 18  
 /**
 19  
  * <code>ServiceException</code> should be thrown when some action on a service
 20  
  * fails, such as starting or stopping
 21  
  */
 22  
 // @ThreadSafe
 23  
 public class ServiceException extends MessagingException
 24  
 {
 25  
     /**
 26  
      * Serial version
 27  
      */
 28  
     private static final long serialVersionUID = 56178344205041599L;
 29  
 
 30  
     private final transient Service service;
 31  
 
 32  
     /**
 33  
      * @param message the exception message
 34  
      */
 35  
     public ServiceException(Message message, MuleMessage umoMessage, Service service)
 36  
     {
 37  0
         super(generateMessage(message, service), umoMessage);
 38  0
         this.service = service;
 39  0
     }
 40  
 
 41  
     /**
 42  
      * @param message the exception message
 43  
      * @param cause the exception that cause this exception to be thrown
 44  
      */
 45  
     public ServiceException(Message message, MuleMessage umoMessage, Service service, Throwable cause)
 46  
     {
 47  0
         super(generateMessage(message, service), umoMessage, cause);
 48  0
         this.service = service;
 49  0
     }
 50  
 
 51  
     public ServiceException(MuleMessage umoMessage, Service service, Throwable cause)
 52  
     {
 53  0
         super(generateMessage(null, service), umoMessage, cause);
 54  0
         this.service = service;
 55  0
     }
 56  
 
 57  
     public Service getService()
 58  
     {
 59  0
         return service;
 60  
     }
 61  
 
 62  
     private static Message generateMessage(Message previousMessage, Service service)
 63  
     {
 64  0
         Message returnMessage = CoreMessages.componentCausedErrorIs(service);
 65  0
         if (previousMessage != null)
 66  
         {
 67  0
             previousMessage.setNextMessage(returnMessage);
 68  0
             return previousMessage;
 69  
         }
 70  
         else
 71  
         {
 72  0
             return returnMessage;
 73  
         }
 74  
     }
 75  
 }