openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1680649 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/BeansDeployer.java inject/AbstractInjectable.java util/ExceptionUtil.java
Date Wed, 20 May 2015 18:33:38 GMT
Author: struberg
Date: Wed May 20 18:33:38 2015
New Revision: 1680649

URL: http://svn.apache.org/r1680649
Log:
rework DescriptiveException and make it easier to use

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1680649&r1=1680648&r2=1680649&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Wed May 20 18:33:38 2015
@@ -46,7 +46,6 @@ import org.apache.webbeans.deployment.St
 import org.apache.webbeans.deployment.StereoTypeModel;
 import org.apache.webbeans.event.ObserverMethodImpl;
 import org.apache.webbeans.event.OwbObserverMethod;
-import org.apache.webbeans.exception.helper.DescriptiveException;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.WebBeansDeploymentException;
 import org.apache.webbeans.exception.WebBeansException;
@@ -638,7 +637,7 @@ public class BeansDeployer
     /**
      * Fires event after bean discovery.
      */
-    private final List<AnnotatedType<?>> fireAfterTypeDiscoveryEvent()
+    private List<AnnotatedType<?>> fireAfterTypeDiscoveryEvent()
     {
         final BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         final List<AnnotatedType<?>> newAt = new LinkedList<AnnotatedType<?>>();
@@ -811,11 +810,7 @@ public class BeansDeployer
                 }
                 catch (RuntimeException e)
                 {
-                    if (e instanceof DescriptiveException)
-                    {
-                        ((DescriptiveException) e).addInformation("Problem while validating
bean " + bean);
-                    }
-                    throw e;
+                    throw ExceptionUtil.addInformation(e, "Problem while validating bean
" + bean);
                 }
 
             }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1680649&r1=1680648&r2=1680649&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Wed May 20 18:33:38 2015
@@ -89,7 +89,7 @@ public abstract class AbstractInjectable
             {
                 if(injectedBean instanceof AbstractProducerBean)
                 {
-                    if((creationalContext.getBean() instanceof Bean) && beanManager.isPassivatingScope(((Bean<?>)
creationalContext.getBean()).getScope()))
+                    if(beanManager.isPassivatingScope(creationalContext.getBean().getScope()))
                     {
                         dependentProducer = true;   
                     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java?rev=1680649&r1=1680648&r2=1680649&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java
Wed May 20 18:33:38 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.webbeans.util;
 
+import org.apache.webbeans.exception.helper.DescriptiveException;
+
 public abstract class ExceptionUtil
 {
     private ExceptionUtil()
@@ -53,6 +55,16 @@ public abstract class ExceptionUtil
         return sb.toString();
     }
 
+    public static RuntimeException addInformation(RuntimeException e, String additionalinfo)
+    {
+        if (e instanceof DescriptiveException)
+        {
+            ((DescriptiveException) e).addInformation(additionalinfo);
+        }
+
+        return e;
+    }
+
     @SuppressWarnings({ "unchecked" })
     private static class ExceptionHelper<T extends Throwable>
     {



Mime
View raw message