[jboss-jira] [JBoss JIRA] (AS7-6186) Mojarra 2.1.16 upgrade breaks Seam2.3.0 conversations

Marek Schmidt (JIRA) jira-events at lists.jboss.org
Sun Dec 16 12:19:08 EST 2012


    [ https://issues.jboss.org/browse/AS7-6186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741732#comment-12741732 ] 

Marek Schmidt commented on AS7-6186:
------------------------------------

At least one of the problems with the Mojarra 2.1.16 upgrade seems to be the change of behaviour in the case FacesContext.getCurrentInstance().getViewRoot().getViewMap() is called before the view map is created by JSF. While an empty map is returned in such case in both the current version and the previous version, it seems that in 2.1.16 the map will not be updated with the actual view map data... so the view map data from the previous request is lost if one calls getViewMap() too soon. This is a problem for Seam, as it calls getViewMap the first time a page-scoped component is accessed, which may be, e.g. the Seam EntityIdentifierStore, which is a page-scoped component used by the EntityConverter seam component, which is a faces converter.

The following example shows where the behaviour differs, with no Seam in it:

To reproduce the problem, click "set foo" button, and then click the "Click" button. Notice that with Mojarra 2.1.16 the "bar" from "ViewMap value: bar" disappears after clicking "click", which means it is lost from the viewmap. 

(the converter doesn't do anything, it is just so we can call getViewMap() in the converter constructor, which happens before the view map gets filled with the actual view map to demonstrate the problem, which seems to also happen in Seam 2.3.0)

{code}
@FacesConverter("org.jboss.seam.test.MyConverter")
public class MyConverter implements Converter 
{
	public MyConverter() {
		// This is the problematic line:
		FacesContext.getCurrentInstance().getViewRoot().getViewMap();
	}

   @Override
   public Object getAsObject(FacesContext context, UIComponent component, String value)
   {
      return null;
   }

   @Override
   public String getAsString(FacesContext context, UIComponent component, Object value)
   {
	   return (String)value;
   }
}
{code}


{code}
@Model
public class Action
{   
   public String getFoo() {
	   return (String)FacesContext.getCurrentInstance().getViewRoot().getViewMap().get("foo");
   }
   
   public void setFoo() {
      UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
      Map<String, Object> viewMap = root.getViewMap();
      viewMap.put("foo", "bar");
   }
}
{code}

{code}
<h:form>
      	<div>
      		ViewMap value:
      		<h:outputText value="#{action.getFoo()}" />
      	</div>
     
     	<div>
     		Converter:
     		<h:outputText value="#{'converter'}">
               <f:converter converterId="org.jboss.seam.test.MyConverter"/>
            </h:outputText>
     	</div> 	
      
      	<div>
         	<h:commandButton value="set foo" action="#{action.setFoo()}" /> 
         	<h:commandButton value="Click"/>
         </div> 
      </h:form>
{code}
                
> Mojarra 2.1.16 upgrade breaks Seam2.3.0 conversations
> -----------------------------------------------------
>
>                 Key: AS7-6186
>                 URL: https://issues.jboss.org/browse/AS7-6186
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: JSF
>    Affects Versions: 7.1.4.Final (EAP)
>         Environment: Current 7.1.4.Final-SNAPSHOT (2012-12-15), Mojarra 2.1.16, Seam2.3.0.Final
>            Reporter: Marek Schmidt
>            Assignee: Stan Silvert
>            Priority: Critical
>         Attachments: seam-booking.ear
>
>
> Recent Mojarra upgrade seems to break Seam 2.3.0 conversations. 
> Not exactly sure yet what has changed and whether it is a Mojarra bug or Seam depending on something it shouldn't.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list