You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Andreas Osterburg (JIRA)" <de...@myfaces.apache.org> on 2016/09/15 11:09:20 UTC
[jira] [Updated] (MYFACES-4064) EL 3.0 Collection construction
broken
[ https://issues.apache.org/jira/browse/MYFACES-4064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Osterburg updated MYFACES-4064:
---------------------------------------
Status: Patch Available (was: Open)
> EL 3.0 Collection construction broken
> -------------------------------------
>
> Key: MYFACES-4064
> URL: https://issues.apache.org/jira/browse/MYFACES-4064
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 2.2.10
> Reporter: Andreas Osterburg
> Priority: Minor
>
> In EL3.0 your may construct literal sets and maps using curly braces,
> e.g. "#{ { 1, 2, 3 } }" for a set or "#{ { 'a':1, 'b':2 } }" for a map.
> Unfortunately myfaces cuts the EL expression on the first occurence
> of character '}', which is wrong in this case. It happens in ELText.java,
> caused by method "findVarLength". Here is patch that fixes this:
> --- impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java 2016-04-06 14:55:02.000000000 +0200
> +++ impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java 2016-09-15 12:48:50.163853337 +0200
> @@ -699,6 +699,7 @@
> int len = ca.length;
> char c = 0;
> int str = 0;
> + int nest = 0;
> while (i < len)
> {
> c = ca[i];
> @@ -717,7 +718,15 @@
> str = c;
> }
> }
> - else if (str == 0 && ('}' == c))
> + else if ('{' == c && str == 0)
> + {
> + ++nest;
> + }
> + else if ('}' == c && str == 0 && nest > 1)
> + {
> + --nest;
> + }
> + else if (str == 0 && ('}' == c && nest == 1))
> {
> return i - s + 1;
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)