No problem, patch is attached at this message.

Am 24.10.2016 um 23:32 schrieb Leonardo Uribe (JIRA):

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

Leonardo Uribe commented on MYFACES-4064:
-----------------------------------------

Could you please attach the proposed patch as a file in unified diff format? In 
that way it will be easier to apply it properly.

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)



--
Andreas Osterburg
IT Software GmbH & Data Security Elbe KG       Tel.: +49 (391) 509609-55
Lorenzweg 42 - Haus 3, D-39124 Magdeburg       Fax : +49 (391) 509609-56
Geschäftsführer: Jens Henning             Amtsgericht Stendal, HRA 22588
Zertifiziert nach ISO 9001:2008
--- 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;
             }

Reply via email to