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

marco fago commented on MYFACES-3589:
-------------------------------------

Probably my description or understanding was wrong.
Here comes a test case to reproduce the bug I've found:

test1

<!-- INTERFACE -->
        <cc:interface>
                <cc:attribute name="value" type="java.lang.String" 
default="test"/>
        </cc:interface>
        
        <cc:implementation>
                <test:test2 value="#{cc.attrs.value}"/>
        </cc:implementation>

test2

<html xmlns="http://www.w3.org/1999/xhtml";
        xmlns:test="http://java.sun.com/jsf/composite/test";
        xmlns:fn="http://java.sun.com/jsp/jstl/functions";
        xmlns:cc="http://java.sun.com/jsf/composite";>

        <!-- INTERFACE -->
        <cc:interface>
                <cc:attribute name="value" type="java.lang.String" 
required="true" />
        </cc:interface>

        <!-- IMPLEMENTATION -->
        <cc:implementation>
                <test:test3 value="#{fn:contains(cc.attrs.value,'t') ? 
cc.attrs.value : 'nope'}"/>
        </cc:implementation>
</html>

test3

<html xmlns="http://www.w3.org/1999/xhtml";
         xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns:cc="http://java.sun.com/jsf/composite";>

        <cc:interface>
                <cc:attribute name="value" type="java.lang.String" 
required="true" />
        </cc:interface>

        <cc:implementation>
                #{cc.attrs.value}
        </cc:implementation>
</html>

Adding  <test:test1/> to your page you will get a java.lang.StackOverflowError.

The problem seems to be related to the 'fn:contains....' part in test2 
implementation (but not specifically to that function since I tried with a 
custom fn and  got the same error).
Replacing that with  

<test:test3 value="#{cc.attrs.value}"/> 

all works fine.
                
> Regex for cc.attrs doesn't take into account start with left parenthesis
> ------------------------------------------------------------------------
>
>                 Key: MYFACES-3589
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3589
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.8
>            Reporter: marco fago
>            Assignee: Jakob Korherr
>         Attachments: MYFACES-2561-2.patch, MYFACES-2561.patch, test.xhtml, 
> test1.xhtml, test2.xhtml
>
>
> See MYFACES-2651.
> In particular, there is still a case in which the proposed solution won't 
> work.
> Consider the component test 1  slightly modified:
> <cc:interface name="test1">
>     <cc:attribute name="test" required="true" />
> </cc:interface>
> <cc:implementation>
>     test1
>     <t2:test2 test="#{myLibrary:myFunction(...) or cc.attrs.test}" />
> </cc:implementation>
> In that case the regex expression looking for cc.attrs will exclude the 
> expression because cc.attrs is preceded by a left parenthesis (as stated in 
> CompositeComponentELUtils).
> Changing to
>  <t2:test2 test="#{cc.attrs.test or myLibrary:myFunction(...)}" />
> will work. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to