myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch 3.0.x updated: MYFACES-4382: Add check if SessionScope is active.
Date Wed, 10 Mar 2021 13:19:08 GMT
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 <juri.berlanda@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 <juri.berlanda@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))
                 {


Mime
View raw message