deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-1282 DeltaSpikeFacesContextWrapper leaks on TomEE
Date Mon, 17 Jul 2017 14:53:39 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 42d156c4d -> a4998790a


DELTASPIKE-1282 DeltaSpikeFacesContextWrapper leaks on TomEE

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/a4998790
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/a4998790
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/a4998790

Branch: refs/heads/master
Commit: a4998790afe24bde62ae3aa37e6a0c5728c81004
Parents: 42d156c
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon Jul 17 16:53:33 2017 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon Jul 17 16:53:33 2017 +0200

----------------------------------------------------------------------
 .../request/DeltaSpikeFacesContextFactory.java     |  2 +-
 .../request/DeltaSpikeFacesContextWrapper.java     | 17 +++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a4998790/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
index dafe21a..eca63d4 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
@@ -62,7 +62,7 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory implement
         FacesContext facesContext =
                 this.wrappedFacesContextFactory.getFacesContext(context, request, response,
lifecycle);
 
-        if (facesContext == null || this.deactivated)
+        if (facesContext == null || this.deactivated || facesContext instanceof DeltaSpikeFacesContextWrapper)
         {
             return facesContext;
         }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a4998790/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
index 7e795ea..d1d3bfb 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
@@ -84,8 +84,6 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper
         {
             this.wrappedExternalContext = wrappedFacesContext.getExternalContext();
         }
-
-        setCurrentInstance(this);
     }
 
     /**
@@ -95,12 +93,19 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper
     @Override
     public void release()
     {
-        if (!this.wrappedFacesContext.getApplication().getResourceHandler().isResourceRequest(this.wrappedFacesContext))
+        // try/finally shouldn't be required...
+        try
+        {
+            if (!this.wrappedFacesContext.getApplication().getResourceHandler()
+                    .isResourceRequest(this.wrappedFacesContext))
+            {
+                broadcastDestroyedJsfRequestEvent();
+            }
+        }
+        finally
         {
-            broadcastDestroyedJsfRequestEvent();
+            super.release();
         }
-
-        wrappedFacesContext.release();
     }
     
     @Override


Mime
View raw message