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:25 UTC

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


The following commit(s) were added to refs/heads/2.3-next by this push:
     new db7c85f  MYFACES-4382: Add check if SessionScope is active.
     new 918607b  Merge pull request #184 from j-be/PR_MYFACES-4382_2.3-next
db7c85f is described below

commit db7c85fd45ce9ad9be266cf7c8237849350bf0f7
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/view/CDIViewScopeProviderImpl.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/impl/src/main/java/org/apache/myfaces/cdi/view/CDIViewScopeProviderImpl.java b/impl/src/main/java/org/apache/myfaces/cdi/view/CDIViewScopeProviderImpl.java
index af222a4..c39a113 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/view/CDIViewScopeProviderImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/view/CDIViewScopeProviderImpl.java
@@ -100,7 +100,8 @@ public class CDIViewScopeProviderImpl extends ViewScopeProvider
     
     private boolean isViewScopeBeanHolderCreated(FacesContext facesContext)
     {
-        if (facesContext.getExternalContext().getSession(false) == null)
+        if (facesContext.getExternalContext().getSession(false) == null ||
+                !CDIUtils.isSessionScopeActive(beanManager))
         {
             return false;
         }