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

Jakob Korherr commented on MYFACES-2561:
----------------------------------------

Thanks for all your ideas, Leonardo, but I already have a working solution for 
that as I ment in "I already have a solution for the #{cc} resolver problem.".

My solution is similar to your last suggestion. I use the Location object to 
check in which file the Value-/MethodExpression is generated (in 
TagAttributeImpl). To save it I introduced LocationValueExpression and 
LocationMethodExpression. These two classes pass through all EL methods but 
push the related composite component to the stack before invocation and remove 
it afterwards. Thus the implicit object resolver does not need to be changed. 

To find the related composite component I search the current component stack 
for the composite component with the same Location as stored in the 
Value-/MethodExpression. And to get the Location of the composite component I 
use the InterfaceHandler to store the Location from where the composite 
component is created in the composite component's attribute map.

However there are still some problems with MethodExpressions as they are not 
really resolved. That is why I did not already provide a patch for this issue, 
but I will do this now so that you can take a look at my solution.

The problem with the MethodExpressions is that they are originally created as 
ValueExpressions and then (later) changed to MethodExpressions in 
FaceletVDL.retargetMethodExpressions. The problem here is that only the 
expression string is taken into account. This works perfect on the outer 
composite component, but the inner composite component gets something like 
#{cc.attr.method} and thus wants to invoke the method "method" on 
CompositeComponentAttributesMapWrapper.

One possible solution would be to look for expression strings with cc.attr in 
FaceletVDL.retargetMethodExpressions and keep extracting them until the 
expression string does not contain cc.attr, but this is not really a good 
solution I think. I've been thinking a lot about this and still haven't found 
something much better. Suggestions are welcome!

> StackOverflowError if a composite component implementation uses another 
> composite component
> -------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2561
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2561
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>
> If you use another composite component in your composite component's 
> implementation you will get a StackOverflowError.
> javax.faces.FacesException: java.lang.StackOverflowError
>       at 
> org.apache.myfaces.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
>       at 
> org.apache.myfaces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:216)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>       at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>       at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>       at 
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>       at java.lang.Thread.run(Thread.java:637)
> Caused by: java.lang.StackOverflowError
>       at java.util.ArrayList.toArray(ArrayList.java:306)
>       at java.util.logging.Logger.getHandlers(Logger.java:1200)
>       at 
> java.util.logging.LogManager$RootLogger.getHandlers(LogManager.java:1019)
>       at java.util.logging.Logger.log(Logger.java:454)
>       at java.util.logging.Logger.doLog(Logger.java:480)
>       at java.util.logging.Logger.logp(Logger.java:680)
>       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:167)
>       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:135)
>       at org.apache.catalina.connector.Request.setAttribute(Request.java:1448)
>       at 
> org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:503)
>       at 
> org.apache.myfaces.context.servlet.RequestMap.setAttribute(RequestMap.java:53)
>       at 
> org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:113)
>       at 
> org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:1)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setScope(FacesCompositeELResolver.java:191)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:139)
>       at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:61)
>       at org.apache.el.parser.AstValue.getValue(AstValue.java:107)
>       at 
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
>       at 
> org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:84)
>       at 
> org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$CompositeComponentAttributesMapWrapper.get(CompositeComponentELResolver.java:245)
>       at javax.el.MapELResolver.getValue(MapELResolver.java:51)
>       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140)
>       at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
>       at 
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
>       at 
> org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:84)
>       at 
> org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$CompositeComponentAttributesMapWrapper.get(CompositeComponentELResolver.java:245)
>       at javax.el.MapELResolver.getValue(MapELResolver.java:51)
>       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140)
>       at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
>       at 
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
>       at 
> org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:84)
>       at 
> org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$CompositeComponentAttributesMapWrapper.get(CompositeComponentELResolver.java:245)
>       at javax.el.MapELResolver.getValue(MapELResolver.java:51)
>       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140)
>       at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
>       at 
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
>       at 
> org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:84)
>       at 
> org.apache.myfaces.el.unified.resolver.CompositeComponentELResolver$CompositeComponentAttributesMapWrapper.get(CompositeComponentELResolver.java:245)
>       at javax.el.MapELResolver.getValue(MapELResolver.java:51)
>       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
>       at 
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:140)
>       at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
> ......
> ......

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to