User: user57  
  Date: 02/02/07 16:07:19

  Added:       src/main/org/jboss/util ThrowableTranslator.java
  Log:
   o Damn JMX exceptions piss me off!
  
  Revision  Changes    Path
  1.1                  jboss/src/main/org/jboss/util/ThrowableTranslator.java
  
  Index: ThrowableTranslator.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package org.jboss.util;
  
  import javax.management.MBeanException;
  import javax.management.RuntimeMBeanException;
  import javax.management.RuntimeOperationsException;
  
  /**
   * Translates exceptions which don't propertly show child exceptions in stack 
   * traces.
   *      
   * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
   * @version $Revision: 1.1 $
   */
  public class ThrowableTranslator
  {
     public static Exception translate(Exception e) {
        //
        // this is in no way complete... or even a good design, but damn
        // those JMX exceptions piss me off!
        //
        
        if (e instanceof MBeanException)
         return ((MBeanException)e).getTargetException();
  
        if (e instanceof RuntimeMBeanException)
         return ((RuntimeMBeanException)e).getTargetException();
  
        if (e instanceof RuntimeOperationsException)
         return ((RuntimeOperationsException)e).getTargetException();
  
        return e;
     }
  }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to