Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4064

EL 3.0 Collection construction broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.10
    • 2.0.25, 2.1.19, 2.2.12
    • None
    • None

    Description

      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 ('
        Unknown macro: {' == c && str == 0)+ { + ++nest; + }+ else if ('}

        ' == c && str == 0 && nest > 1)
        +

        { + --nest; + }

        + else if (str == 0 && ('}' == c && nest == 1))

        { return i - s + 1; }

      Attachments

        1. patch-el30.patch
          0.8 kB
          Leonardo Uribe

        Activity

          People

            lu4242 Leonardo Uribe
            andreas.osterburg@digide.net Andreas Osterburg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: