openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1466955 - /openwebbeans/trunk/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java
Date Thu, 11 Apr 2013 16:34:02 GMT
Author: gpetracek
Date: Thu Apr 11 16:34:01 2013
New Revision: 1466955

URL: http://svn.apache.org/r1466955
Log:
OWB-818 null check

Modified:
    openwebbeans/trunk/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java

Modified: openwebbeans/trunk/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java?rev=1466955&r1=1466954&r2=1466955&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java
(original)
+++ openwebbeans/trunk/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java
Thu Apr 11 16:34:01 2013
@@ -135,11 +135,16 @@ public class StandaloneResourceInjection
                             ResourceReference<Object, ?> resourceRef = new ResourceReference(field.getDeclaringClass(),
field.getName(), field.getType(), ann);
                             try
                             {
-                                if(!field.isAccessible())
+                                Object resourceToInject = getResourceReference(resourceRef);
+                                if (resourceToInject != null)
                                 {
-                                    webBeansContext.getSecurityService().doPrivilegedSetAccessible(field,
true);
+                                    if(!field.isAccessible())
+                                    {
+                                        webBeansContext.getSecurityService().doPrivilegedSetAccessible(field,
true);
+                                    }
+
+                                    field.set(managedBeanInstance, resourceToInject);
                                 }
-                                field.set(managedBeanInstance, getResourceReference(resourceRef));
 
                                 containsEeResource = Boolean.TRUE;
                             }
@@ -147,7 +152,6 @@ public class StandaloneResourceInjection
                             {
                                 logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0025,
e, field));
                                 throw new WebBeansException(MessageFormat.format(WebBeansLoggerFacade.getTokenString(OWBLogConst.ERROR_0025),
field), e);
-
                             }
                         }
                     }



Mime
View raw message