[ 
https://issues.apache.org/jira/browse/MYFACES-4282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16790557#comment-16790557
 ] 

Bill Lucy commented on MYFACES-4282:
------------------------------------

The problem here occurs when DeltaSpike's ViewHandler calls setViewRoot during 
its createView method - which leads to MyFaces clearing out the view map, since 
we believe a view scope has ended.  This is the stack of the clear() that 
destroys ViewScopeModel after it's first built, which leads to the second 
PostConstruct:

    _at 
org.apache.myfaces.view.ViewScopeProxyMap.clear(ViewScopeProxyMap.java:148)_
    _at 
org.apache.myfaces.context.servlet.FacesContextImplBase.setViewRoot(FacesContextImplBase.java:299)_
    _at 
javax.faces.context.FacesContextWrapper.setViewRoot(FacesContextWrapper.java:247)_
    _at 
org.apache.deltaspike.jsf.impl.security.SecurityAwareViewHandler.createView(SecurityAwareViewHandler.java:106)_
    _at 
org.apache.deltaspike.jsf.impl.view.DeltaSpikeViewHandler.createView(DeltaSpikeViewHandler.java:70)_
    _at 
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage$FaceletViewMetadata.createMetadataView(FaceletViewDeclarationLanguage.java:2750)_

A potential fix on our side is to skip calling clear() on the view scope map on 
this path - while we're building the view metadata.  I've done a PR at 
[https://github.com/apache/myfaces/pull/46].  [~j-be] I've tested this PR 
against your sample and the behavior appears correct; can you verify this?

> Incompatibility with DeltaSpike JSF Module 1.x
> ----------------------------------------------
>
>                 Key: MYFACES-4282
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4282
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.3.3
>         Environment: Tomcat 9.0.14
> OpenWebBeans 2.0.8
> DeltaSpike 1.x (tested 1.0.0, 1.8.2, 1.9.0)
>            Reporter: Juri Berlanda
>            Assignee: Eduardo Breijo
>            Priority: Major
>             Fix For: 3.0.0-SNAPSHOT, 2.3.4
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Some change in 2.3.3 causes and incompatibility with Apache DeltaSpike's JSF 
> Module. I am not sure yet what exactly causes it, but MyFaces 2.3.2 is NOT 
> affected.
> The issue arose on our side, as we noticed @PostConstruct of some of our 
> @ViewScope @Model is called twice.
> Mojarra 2.3.8 is NOT affected, which - together with the fact that MyFaces 
> 2.3.2 is not affected either - brings me to the conclusion this is a bug 
> introduced with MyFaces 2.3.3.
> I have a minimal project showing the issue, which I will link here shortly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to