Joe Bergmark created OWB-920:
--------------------------------

             Summary: NPE in 
org.apache.webbeans.servlet.WebBeansConfigurationListener.ensureRequestScope()
                 Key: OWB-920
                 URL: https://issues.apache.org/jira/browse/OWB-920
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Context and Scopes
    Affects Versions: 1.2.1
            Reporter: Joe Bergmark
            Assignee: Joe Bergmark
            Priority: Minor


It appears that WebBeansConfigurationListener.ensureRequestScope() is trying to 
make sure the requestScope is active on the thread.  Unfortunately, I believe 
in many cases when it isn't active, the line below with lead to a NPE:

if 
(!this.lifeCycle.getContextService().getCurrentContext(RequestScoped.class).isActive())

getCurrentContext can return null if this was called on a http request thread 
(for example a thread invalidating sessions), leading to an NPE when isActive() 
is called.

I believe a simple fix would be to ensure the context isn't null and if it 
isn't null ensure it is also active.

A sample stack trace below:

java.lang.NullPointerException
        at 
org.apache.webbeans.servlet.WebBeansConfigurationListener.ensureRequestScope(WebBeansConfigurationListener.java:214)
        at 
org.apache.webbeans.servlet.WebBeansConfigurationListener.sessionDestroyed(WebBeansConfigurationListener.java:201)




--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to