You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/11/22 10:49:06 UTC

svn commit: r1412476 - /openejb/trunk/openejb/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java

Author: rmannibucau
Date: Thu Nov 22 09:49:05 2012
New Revision: 1412476

URL: http://svn.apache.org/viewvc?rev=1412476&view=rev
Log:
OPENEJB-1954 logging + rethrowing exception if cdi injection fails in arquillian test class

Modified:
    openejb/trunk/openejb/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java

Modified: openejb/trunk/openejb/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java?rev=1412476&r1=1412475&r2=1412476&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java (original)
+++ openejb/trunk/openejb/arquillian/arquillian-common/src/main/java/org/apache/openejb/arquillian/common/enrichment/OpenEJBEnricher.java Thu Nov 22 09:49:05 2012
@@ -20,11 +20,14 @@ import org.apache.openejb.AppContext;
 import org.apache.openejb.BeanContext;
 import org.apache.openejb.InjectionProcessor;
 import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.arquillian.common.mockito.MockitoEnricher;
 import org.apache.openejb.core.Operation;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ContainerSystem;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.inject.AbstractInjectable;
 import org.apache.webbeans.inject.OWBInjector;
@@ -65,7 +68,14 @@ public final class OpenEJBEnricher {
                     AbstractInjectable.instanceUnderInjection.remove();
                 }
             } catch (Throwable t) {
-                // ignored
+                Logger.getInstance(LogCategory.OPENEJB, OpenEJBEnricher.class).error("Can't inject in " + testInstance.getClass(), t);
+                if (t instanceof RuntimeException) {
+                    throw (RuntimeException) t;
+                }
+                if (t instanceof Exception) {
+                    throw new OpenEJBRuntimeException((Exception) t);
+                }
+                // ignoring other cases for the moment, let manage some OWB API change without making all tests failing
             }
         }