View Javadoc

1   /*
2    * $Id: UMOExceptionReader.java 7963 2007-08-21 08:53:15Z 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.config;
12  
13  import org.mule.umo.UMOException;
14  
15  import java.util.Collections;
16  import java.util.Map;
17  
18  /**
19   * Grabs all information from the UMOException type
20   */
21  public final class UMOExceptionReader implements ExceptionReader
22  {
23  
24      public String getMessage(Throwable t)
25      {
26          return t.getMessage();
27      }
28  
29      public Throwable getCause(Throwable t)
30      {
31          return t.getCause();
32      }
33  
34      public Class getExceptionType()
35      {
36          return UMOException.class;
37      }
38  
39      /**
40       * Returns a map of the non-stanard information stored on the exception
41       * 
42       * @return a map of the non-stanard information stored on the exception
43       */
44      public Map getInfo(Throwable t)
45      {
46          return (t instanceof UMOException ? ((UMOException) t).getInfo() : Collections.EMPTY_MAP);
47      }
48  
49  }