myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Rossmueller (JIRA)" <myfaces-...@incubator.apache.org>
Subject [jira] Resolved: (MYFACES-440) Circular dependencies in managed properties lead to StackOverflowError in VariableResolverImpl
Date Sat, 10 Sep 2005 12:40:31 GMT
     [ http://issues.apache.org/jira/browse/MYFACES-440?page=all ]
     
Oliver Rossmueller resolved MYFACES-440:
----------------------------------------

    Fix Version: Nightly Build
     Resolution: Fixed

> Circular dependencies in managed properties lead to StackOverflowError in VariableResolverImpl
> ----------------------------------------------------------------------------------------------
>
>          Key: MYFACES-440
>          URL: http://issues.apache.org/jira/browse/MYFACES-440
>      Project: MyFaces
>         Type: Bug
>   Components: General
>     Versions: 1.0.10m10
>  Environment: N/A
>     Reporter: Erik-Berndt Scheper
>      Fix For: Nightly Build

>
> Circular dependencies in managed properties lead to java.lang.StackOverflowError in class
org.apache.myfaces.el.VariableResolverImpl. 
> This can be reproduced with a simple example:
> ... start snippet from faces-config ...
> <managed-bean>
>  <managed-bean-name>organisationListController</managed-bean-name>
>  <managed-bean-class>nl.ibgroep.demo.web.bean.controller.beheer.OrganisationListController</managed-bean-class>
>  <managed-bean-scope>session</managed-bean-scope>
>  <managed-property>
>   <property-name>organisationDetailsController</property-name>
>   <property-class>nl.ibgroep.demo.web.bean.controller.beheer.OrganisationDetailsController</property-class>
>   <value>#{organisationDetailsController}</value>
>  </managed-property>
> </managed-bean>
> <managed-bean>
>  <managed-bean-name>organisationDetailsController</managed-bean-name>
>  <managed-bean-class>nl.ibgroep.demo.web.bean.controller.beheer.OrganisationDetailsController</managed-bean-class>
>  <managed-bean-scope>session</managed-bean-scope>
>  <managed-property>
>   <property-name>organisationListController</property-name>
>   <property-class>nl.ibgroep.demo.web.bean.controller.beheer.OrganisationListController</property-class>
>   <value>#{organisationListController}</value>
>  </managed-property>
> </managed-bean>
> ... end snippet from faces-config ...
> If I open a page using either of these managed beans, a StackOverflowError error occurs
in VariableResolverImpl.
> The reason is that a new managed bean is put in scope after the complete managed bean
has been created, including all dependent managed properties. So what happens is that the
first managed bean (organisationListController) is created, Subsequently a new bean for its
managed property (organisationDetailsController) is created. Because the first bean (organisationListController)
was not put in scope, a new managed bean (organisationListController) is created, which leads
to the creation of another bean (organisationDetailsController), etc.
> In this simple example the cause is easy to find out, but this will be less so if the
circular dependency becomes less obvious.
> Solution: put the bean in scope in the ManagedBeanBuilder, before the recursive creation
of its managed properties.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message