openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1681977 - /openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
Date Wed, 27 May 2015 11:15:42 GMT
Author: struberg
Date: Wed May 27 11:15:41 2015
New Revision: 1681977

URL: http://svn.apache.org/r1681977
Log:
OWB-989 avoid possible NPE

Modified:
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java?rev=1681977&r1=1681976&r2=1681977&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
(original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
Wed May 27 11:15:41 2015
@@ -113,9 +113,14 @@ public final class WebContainerLifecycle
             setJspELFactory((ServletContext) startupObject, resolver);
         }
 
-        // Add BeanManager to the 'javax.enterprise.inject.spi.BeanManager' servlet context
attribute
-        ServletContext servletContext = (ServletContext)(startupObject);
-        servletContext.setAttribute(BeanManager.class.getName(), getBeanManager());
+        ServletContext servletContext =  null;
+        if (startupObject instanceof ServletContext)
+        {
+            servletContext = (ServletContext)(startupObject);
+            
+            // Add BeanManager to the 'javax.enterprise.inject.spi.BeanManager' servlet context
attribute
+            servletContext.setAttribute(BeanManager.class.getName(), getBeanManager());
+        }
 
         // fire @Initialized(ApplicationScoped.class) if any observer for it exists
         if (webBeansContext.getBeanManagerImpl().getNotificationManager().



Mime
View raw message