You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2015/05/06 12:50:04 UTC

svn commit: r1677958 - /openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java

Author: struberg
Date: Wed May  6 10:50:03 2015
New Revision: 1677958

URL: http://svn.apache.org/r1677958
Log:
OWB-1050 ServletContext can be null in certain integration cases

Modified:
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java?rev=1677958&r1=1677957&r2=1677958&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java (original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java Wed May  6 10:50:03 2015
@@ -494,8 +494,10 @@ public class WebContextsService extends
         // Destroy context
         if (context != null && context.isActive())
         {
+            // we need to mark the conversation to get destroyed at the end of the request
+            ServletRequestContext requestContext = getRequestContext(true);
 
-            if (destroySessionImmediately)
+            if (destroySessionImmediately || requestContext == null)
             {
                 context.destroy();
                 webBeansContext.getBeanManagerImpl().fireEvent(session != null ? session : new Object(), DestroyedLiteral.INSTANCE_SESSION_SCOPED);
@@ -506,8 +508,6 @@ public class WebContextsService extends
             }
             else
             {
-                // we need to mark the conversation to get destroyed at the end of the request
-                ServletRequestContext requestContext = getRequestContext(true);
                 requestContext.setPropagatedSessionContext(context);
             }
         }