Coverage Report - org.mule.transport.soap.axis.AxisFaultExceptionReader
 
Classes in this File Line Coverage Branch Coverage Complexity
AxisFaultExceptionReader
0%
0/25
0%
0/4
0
 
 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.transport.soap.axis;
 8  
 
 9  
 import org.mule.api.config.ExceptionReader;
 10  
 
 11  
 import java.util.HashMap;
 12  
 import java.util.Map;
 13  
 
 14  
 import org.apache.axis.AxisFault;
 15  
 
 16  
 /**
 17  
  * Will format and display additional information stored with an Axis fault that is
 18  
  * usually hidden when logged.
 19  
  */
 20  0
 public class AxisFaultExceptionReader implements ExceptionReader
 21  
 {
 22  
 
 23  
     public String getMessage(Throwable t)
 24  
     {
 25  0
         AxisFault e = (AxisFault)t;
 26  0
         Map<?, ?> props = getInfo(e);
 27  0
         StringBuffer msg = new StringBuffer(64);
 28  0
         msg.append("(");
 29  0
         for (Map.Entry<?, ?> entry : props.entrySet())
 30  
         {
 31  0
             msg.append(entry.getKey()).append(": ").append(entry.getValue()).append(", ");
 32  
         }
 33  0
         msg.append(")");
 34  0
         return e.getMessage() + msg.toString();
 35  
     }
 36  
 
 37  
     public Throwable getCause(Throwable t)
 38  
     {
 39  0
         AxisFault e = (AxisFault)t;
 40  0
         Throwable cause = e.detail;
 41  0
         if (cause == null)
 42  
         {
 43  0
             cause = e.getCause();
 44  
         }
 45  0
         return cause;
 46  
     }
 47  
 
 48  
     public Class<?> getExceptionType()
 49  
     {
 50  0
         return AxisFault.class;
 51  
     }
 52  
 
 53  
     /**
 54  
      * Returns a map of the non-stanard information stored on the exception
 55  
      * 
 56  
      * @return a map of the non-stanard information stored on the exception
 57  
      */
 58  
     public Map<?, ?> getInfo(Throwable t)
 59  
     {
 60  0
         AxisFault e = (AxisFault)t;
 61  0
         Map<String, Object> info = new HashMap<String, Object>();
 62  0
         info.put("Fault", e.getFaultString());
 63  0
         info.put("Fault Code", e.getFaultCode().toString());
 64  0
         info.put("Fault Actor", e.getFaultActor());
 65  0
         info.put("Fault Node", e.getFaultNode());
 66  0
         info.put("Fault Reason", e.getFaultReason());
 67  0
         info.put("Fault Role", e.getFaultRole());
 68  0
         info.put("Fault Dump", e.dumpToString());
 69  
         // Todo Do we need to out put headers and elements or are these part of the
 70  
         // dumpToString??
 71  0
         return info;
 72  
     }
 73  
 }