You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2021/03/10 13:18:40 UTC
[myfaces] branch 2.2.x updated: MYFACES-4382: Add check if
SessionScope is active.
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/2.2.x by this push:
new da44464 MYFACES-4382: Add check if SessionScope is active.
new 8840a00 Merge pull request #181 from j-be/PR_MYFACES-4382_2.2.x
da44464 is described below
commit da444644207b763fbd0f1658f26b0c7b6456cf8f
Author: Juri Berlanda <ju...@tuwien.ac.at>
AuthorDate: Wed Mar 10 13:39:48 2021 +0100
MYFACES-4382: Add check if SessionScope is active.
This avoids "@SessionScoped does not exist within current thread" when
trying to destroy ViewScoped and FlowScoped beans.
Signed-off-by: Juri Berlanda <ju...@tuwien.ac.at>
---
.../java/org/apache/myfaces/cdi/impl/CDIManagedBeanHandlerImpl.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/impl/CDIManagedBeanHandlerImpl.java b/impl/src/main/java/org/apache/myfaces/cdi/impl/CDIManagedBeanHandlerImpl.java
index 0944708..7bd6eec 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/impl/CDIManagedBeanHandlerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/impl/CDIManagedBeanHandlerImpl.java
@@ -106,7 +106,8 @@ public class CDIManagedBeanHandlerImpl extends ViewScopeProvider
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null)
{
- if (facesContext.getExternalContext().getSession(false) != null)
+ if (facesContext.getExternalContext().getSession(false) != null &&
+ CDIUtils.isSessionScopeActive(beanManager))
{
if (isViewScopeBeanHolderCreated(facesContext))
{