Coverage Report - org.mule.message.DefaultExceptionPayload
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultExceptionPayload
59%
10/17
50%
1/2
1.167
 
 1  
 /*
 2  
  * $Id: DefaultExceptionPayload.java 10489 2008-01-23 17:53:38Z 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.message;
 12  
 
 13  
 import org.mule.api.MuleException;
 14  
 import org.mule.api.ExceptionPayload;
 15  
 import org.mule.config.ExceptionHelper;
 16  
 
 17  
 import java.util.Map;
 18  
 
 19  
 /**
 20  
  * <code>DefaultExceptionPayload</code> TODO
 21  
  */
 22  
 
 23  
 public class DefaultExceptionPayload implements ExceptionPayload
 24  
 {
 25  
     /**
 26  
      * Serial version
 27  
      */
 28  
     private static final long serialVersionUID = -7114836033686599024L;
 29  
 
 30  22
     private int code = 0;
 31  22
     private String message = null;
 32  22
     private Map info = null;
 33  
     private Throwable exception;
 34  
 
 35  
     public DefaultExceptionPayload(Throwable exception)
 36  22
     {
 37  22
         this.exception = exception;
 38  22
         MuleException muleRoot = ExceptionHelper.getRootMuleException(exception);
 39  22
         if (muleRoot != null)
 40  
         {
 41  0
             message = muleRoot.getMessage();
 42  0
             code = muleRoot.getExceptionCode();
 43  0
             info = muleRoot.getInfo();
 44  
         }
 45  
         else
 46  
         {
 47  22
             message = exception.getMessage();
 48  
         }
 49  22
     }
 50  
 
 51  
     public Throwable getRootException()
 52  
     {
 53  0
         return ExceptionHelper.getRootException(exception);
 54  
     }
 55  
 
 56  
     public int getCode()
 57  
     {
 58  0
         return code;
 59  
     }
 60  
 
 61  
     public String getMessage()
 62  
     {
 63  0
         return message;
 64  
     }
 65  
 
 66  
     public Map getInfo()
 67  
     {
 68  0
         return info;
 69  
     }
 70  
 
 71  
     public Throwable getException()
 72  
     {
 73  14
         return exception;
 74  
     }
 75  
 
 76  
 }