[seam-commits] Seam SVN: r8908 - trunk/src/main/org/jboss/seam/util.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Sep 4 09:55:48 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-09-04 09:55:47 -0400 (Thu, 04 Sep 2008)
New Revision: 8908

Added:
   trunk/src/main/org/jboss/seam/util/Exceptions.java
Modified:
   trunk/src/main/org/jboss/seam/util/EJB.java
Log:
Move exception utils to own class

Modified: trunk/src/main/org/jboss/seam/util/EJB.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/EJB.java	2008-09-04 13:44:11 UTC (rev 8907)
+++ trunk/src/main/org/jboss/seam/util/EJB.java	2008-09-04 13:55:47 UTC (rev 8908)
@@ -5,7 +5,6 @@
 import javax.ejb.EJBContext;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
-import javax.servlet.ServletException;
 
 
 public class EJB
@@ -69,31 +68,6 @@
       return (String) Reflections.invokeAndWrap( Reflections.getMethod(annotation, "name"), annotation );
    }
 
-   public static Exception getCause(Exception exception)
-   {
-      Throwable cause = null;
-      try
-      {
-         if ( EJB_EXCEPTION.isInstance(exception) )
-         {
-            cause = (Throwable) Reflections.getGetterMethod(EJB_EXCEPTION, "causedByException").invoke(exception);
-         }
-         else if (exception instanceof ServletException)
-         {
-            cause = ( (ServletException) exception ).getRootCause();
-         }
-         else
-         {
-            cause = exception.getCause();
-         }
-      }
-      catch (Exception x)
-      {
-         return null;
-      }
-      return cause==exception || !(cause instanceof Exception) ? null : (Exception) cause;
-   }
-
    public static Class[] value(Annotation annotation)
    {
       return (Class[]) Reflections.invokeAndWrap( Reflections.getMethod(annotation, "value"), annotation );

Added: trunk/src/main/org/jboss/seam/util/Exceptions.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/Exceptions.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/util/Exceptions.java	2008-09-04 13:55:47 UTC (rev 8908)
@@ -0,0 +1,33 @@
+package org.jboss.seam.util;
+
+import javax.servlet.ServletException;
+
+public class Exceptions
+{
+
+   public static Exception getCause(Exception exception)
+   {
+      Throwable cause = null;
+      try
+      {
+         if ( EJB.EJB_EXCEPTION.isInstance(exception) )
+         {
+            cause = (Throwable) Reflections.getGetterMethod(EJB.EJB_EXCEPTION, "causedByException").invoke(exception);
+         }
+         else if (exception instanceof ServletException)
+         {
+            cause = ( (ServletException) exception ).getRootCause();
+         }
+         else
+         {
+            cause = exception.getCause();
+         }
+      }
+      catch (Exception x)
+      {
+         return null;
+      }
+      return cause==exception || !(cause instanceof Exception) ? null : (Exception) cause;
+   }
+
+}


Property changes on: trunk/src/main/org/jboss/seam/util/Exceptions.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the seam-commits mailing list