tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject tomee git commit: Resloves #TOMEE-1897 for 7.0.3
Date Fri, 10 Feb 2017 00:23:44 GMT
Repository: tomee
Updated Branches:
  refs/heads/master f90e7da91 -> 56bea6caa


Resloves #TOMEE-1897 for 7.0.3


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/56bea6ca
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/56bea6ca
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/56bea6ca

Branch: refs/heads/master
Commit: 56bea6caaaa1475cc62d01b6619de7c5e54d1b16
Parents: f90e7da
Author: AndyGee <andy.is@gmx.de>
Authored: Fri Feb 10 01:22:47 2017 +0100
Committer: AndyGee <andy.is@gmx.de>
Committed: Fri Feb 10 01:22:47 2017 +0100

----------------------------------------------------------------------
 .../server/cxf/rs/CdiResourceProvider.java      | 21 ++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/56bea6ca/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
index 1ba5f0e..bf5b28a 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
@@ -23,6 +23,8 @@ import org.apache.cxf.message.Message;
 import org.apache.openejb.Injection;
 import org.apache.openejb.InjectionProcessor;
 import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
 import org.apache.webbeans.component.InjectionTargetBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
@@ -254,7 +256,7 @@ public abstract class CdiResourceProvider implements ResourceProvider
{
         }
     }
 
-    protected static interface BeanCreator {
+    protected interface BeanCreator {
         Object create();
 
         void release();
@@ -284,18 +286,25 @@ public abstract class CdiResourceProvider implements ResourceProvider
{
         @Override
         public Object create() {
             try {
-                toClean = bm.createCreationalContext(bean);
-                return bm.getReference(bean, bean.getBeanClass(), toClean);
+                if (null != bean) {
+                    toClean = bm.createCreationalContext(bean);
+                    return bm.getReference(bean, bean.getBeanClass(), toClean);
+                } else {
+                    throw new InjectionException("Bean is null for: " + clazz.getName());
+                }
             } catch (final InjectionException ie) {
-                final String msg = bean + " can not be instantiated";
+                final String msg = "Failed to instantiate: " + bean;
+                Logger.getInstance(LogCategory.OPENEJB_CDI, this.getClass()).error(msg, ie);
                 throw new WebApplicationException(Response.serverError().entity(msg).build());
             }
         }
 
         @Override
         public void release() {
-            toClean.release();
-            toClean = null;
+            if (null != toClean) {
+                toClean.release();
+                toClean = null;
+            }
         }
     }
 


Mime
View raw message