You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2011/03/15 10:29:39 UTC

svn commit: r1081693 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/AbstractOwbBean.java util/ClassUtil.java

Author: struberg
Date: Tue Mar 15 09:29:39 2011
New Revision: 1081693

URL: http://svn.apache.org/viewvc?rev=1081693&view=rev
Log:
OWB-461 move getRootCause to OwbBean

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java?rev=1081693&r1=1081692&r2=1081693&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java Tue Mar 15 09:29:39 2011
@@ -38,7 +38,6 @@ import org.apache.webbeans.container.Bea
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.logger.WebBeansLogger;
-import org.apache.webbeans.util.ClassUtil;
 
 /**
  * Abstract implementation of the {@link OwbBean} contract. 
@@ -186,7 +185,7 @@ public abstract class AbstractOwbBean<T>
         }
         catch (Exception re)
         {
-            Throwable throwable = ClassUtil.getRootException(re);
+            Throwable throwable = getRootException(re);
             
             if(!(throwable instanceof RuntimeException))
             {
@@ -198,6 +197,18 @@ public abstract class AbstractOwbBean<T>
         return instance;
     }
 
+    private Throwable getRootException(Throwable throwable)
+    {
+        if(throwable.getCause() == null || throwable.getCause() == throwable)
+        {
+            return throwable;
+        }
+        else
+        {
+            return getRootException(throwable.getCause());
+        }
+    }
+
     /**
      * Creates the instance of the bean that has a specific implementation
      * type. Each subclass must define its own create mechanism.

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1081693&r1=1081692&r2=1081693&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Tue Mar 15 09:29:39 2011
@@ -1780,18 +1780,7 @@ public final class ClassUtil
         
     }
  
-    public static Throwable getRootException(Throwable throwable)
-    {
-        if(throwable.getCause() == null)
-        {
-            return throwable;
-        }
-        else
-        {
-            return getRootException(throwable.getCause());
-        }
-    }
-    
+
     /**
      * Returns injection point raw type.
      *