[
https://issues.apache.org/jira/browse/OWB-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14583982#comment-14583982
]
Adam Cornett commented on OWB-1083:
-----------------------------------
Any way to get TomEE 7.0-SNAPSHOT to use the 1.6.1 snapshot? I can test by
dropping in the latest owb jar, but its always nice to have things "just work"
> WebContextsService errors when servlet session invalidated during request
> lifecycle
> -----------------------------------------------------------------------------------
>
> Key: OWB-1083
> URL: https://issues.apache.org/jira/browse/OWB-1083
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Web
> Affects Versions: 1.6.0
> Reporter: Adam Cornett
> Assignee: Mark Struberg
> Fix For: 1.6.1
>
>
> If the session is invalidated during the processing of the request an
> exception is thrown when OpenWebBeans is cleaning up.
> The issue is in the WebContextsService.destroyRequestContext method, which
> tries to get the session from the request, however it calls the no-arg
> getSession(),
> which will, per the spec, try to create a new session if one does not
> exist. However since the response has been committed this is not allowed
> to create a new session and an exception is thrown.
> The solution is to call getSession(false),
> which will return null if the session does not exist. This seems to be the
> desired behavior anyway since the result of the call is null checked a few
> lines later.
> I have tested this change in our application and it produces the desired
> behavior.
> Current code:
> {code}
> Object payload = null;
> if (context.getServletRequest() != null)
> {
> payload = context.getServletRequest().getSession();
> }
> webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
> payload != null ? payload : new Object(),
> DestroyedLiteral.INSTANCE_SESSION_SCOPED);
> {code}
> Suggested fix:
> {code}
> Object payload = null;
> if (context.getServletRequest() != null)
> {
> payload = context.getServletRequest().getSession(false);
> }
> webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
> payload != null ? payload : new Object(),
> DestroyedLiteral.INSTANCE_SESSION_SCOPED);
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)