You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Joe Bergmark (JIRA)" <ji...@apache.org> on 2013/12/13 22:40:06 UTC

[jira] [Resolved] (OWB-920) NPE in org.apache.webbeans.servlet.WebBeansConfigurationListener.ensureRequestScope()

     [ https://issues.apache.org/jira/browse/OWB-920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Bergmark resolved OWB-920.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.2

The null check appears to resolve the problem in my testing.

> 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
>             Fix For: 1.2.2
>
>
> 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)