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