You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by be...@apache.org on 2013/12/13 22:38:15 UTC

svn commit: r1550838 - /openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java

Author: bergmark
Date: Fri Dec 13 21:38:15 2013
New Revision: 1550838

URL: http://svn.apache.org/r1550838
Log:
OWB-920 Prevent NPE in WebBeansConfigurationListener.ensureRequestScope() when null context returned from the ContextsService

Modified:
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java?rev=1550838&r1=1550837&r2=1550838&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java (original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java Fri Dec 13 21:38:15 2013
@@ -31,6 +31,7 @@ import org.apache.webbeans.web.util.Serv
 import javax.enterprise.context.ConversationScoped;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 import javax.servlet.ServletRequestEvent;
@@ -211,7 +212,9 @@ public class WebBeansConfigurationListen
 
     private boolean ensureRequestScope()
     {
-        if (!this.lifeCycle.getContextService().getCurrentContext(RequestScoped.class).isActive())
+        Context context = this.lifeCycle.getContextService().getCurrentContext(RequestScoped.class);
+        
+        if (context == null || !context.isActive())
         {
             requestInitialized(null);
             return true;