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:19:08 UTC

[myfaces] branch 3.0.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 3.0.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/3.0.x by this push:
     new 49c7260  MYFACES-4382: Add check if SessionScope is active.
     new dbae255  Merge pull request #183 from j-be/PR_MYFACES-4382_3.0.x
49c7260 is described below

commit 49c726022a078772e78ea0896487e5eae52d9c15
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 e822005..12467a7 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))
                 {