You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2016/07/29 03:35:57 UTC
svn commit: r1754477 - in
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view:
ViewScopeContextImpl.java ViewScopeContextualStorage.java
Author: lu4242
Date: Fri Jul 29 03:35:56 2016
New Revision: 1754477
URL: http://svn.apache.org/viewvc?rev=1754477&view=rev
Log:
MYFACES-4057 Serializable ViewScopeContextualStorage references non-serializable BeanManager
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java?rev=1754477&r1=1754476&r2=1754477&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java Fri Jul 29 03:35:56 2016
@@ -233,7 +233,7 @@ public class ViewScopeContextImpl implem
{
if (!(entry.getKey() instanceof _ContextualKey))
{
- Contextual bean = storage.getBean(entry.getKey());
+ Contextual bean = storage.getBean(facesContext, entry.getKey());
ContextualInstanceInfo<?> contextualInstanceInfo = entry.getValue();
bean.destroy(contextualInstanceInfo.getContextualInstance(),
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java?rev=1754477&r1=1754476&r2=1754477&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java Fri Jul 29 03:35:56 2016
@@ -28,6 +28,8 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.faces.context.FacesContext;
+import org.apache.myfaces.cdi.util.CDIUtils;
import org.apache.myfaces.cdi.util.ContextualInstanceInfo;
/**
@@ -44,7 +46,7 @@ public class ViewScopeContextualStorage
private final Map<String, Object> nameBeanKeyMap;
- private final BeanManager beanManager;
+ private transient BeanManager beanManager;
private transient volatile boolean deactivated;
@@ -118,8 +120,12 @@ public class ViewScopeContextualStorage
* Restores the Bean from its beanKey.
* @see #getBeanKey(javax.enterprise.context.spi.Contextual)
*/
- public Contextual<?> getBean(Object beanKey)
+ public Contextual<?> getBean(FacesContext context, Object beanKey)
{
+ if (beanManager == null)
+ {
+ beanManager = CDIUtils.getBeanManager(context.getExternalContext());
+ }
return beanManager.getPassivationCapableBean((String) beanKey);
}