myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3589) Regex for cc.attrs doesn't take into account start with left parenthesis
Date Mon, 30 Jul 2012 21:49:35 GMT

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

Leonardo Uribe commented on MYFACES-3589:
-----------------------------------------

I checked and I don't see any problem. There are two regex used to handle cc:

    /**
     * A regular expression used to determine if cc is used in an expression String.
     */
    public static final Pattern CC_EXPRESSION_REGEX = Pattern.compile(".*[^\\w\\.]cc[^\\w].*");
    
    /**
     * A regular expression used to determine if cc.attrs is used as a method expression
     * in an expression String. This means cc.attrs must occur, must stand before a '(',
     * because otherwise it would be a method parameter (EL 2.2), and there must be no '.'
after
     * cc.attrs unless there is a left parenthesis before it (e.g. #{cc.attrs.method(bean.parameter)}).
     * 
     * Explanation of the parts:
     * - [^\\(]* - There can be any character except a '(' before cc.attrs
     * - [^\\w\\.\\(] - There must be no word character, dot, or left parenthesis directly
before cc.attrs
     * - cc\\.attrs\\. - "cc.attrs." must occur
     * - [^\\.]* - There must be no dot after cc.attrs to indicate a method invocation on
cc.attrs
     * - (\\(.*)? - If there is a left paranthesis after cc.attrs, a dot is allowed again
     */
    public static final Pattern CC_ATTRS_METHOD_EXPRESSION_REGEX
            = Pattern.compile("[^\\(]*[^\\w\\.\\(]cc\\.attrs\\.[^\\.]*(\\(.*)?");

Both are correct. In the case presented, cc.attrs.test does not point to a MethodExpression,
so there is no need to do the indirection hack. Please note MYFACES-3383 was solved recently,
and the solution proposed is not in 2.1.8, so maybe this is related in some way.

There is no evidence about any problem here. If no objections, I'll close this issue as invalid.

                
> 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

        

Mime
View raw message