javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-3135

Expression Language (EL) Regression { } (braces) not escaped correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.2, 2.2.3, 2.2.4, 2.2.5
    • Fix Version/s: 2.2.6
    • Component/s: expression language
    • Labels:
      None

      Description

      An EL regression was introduced in JSF 2.2.2 which does not appear in earlier releases, or in 2.1. This issue affects backwards compatibility of applications that could be migrated to JSF 2.2.5+

      The following code works on EE 6 GlassFish 3.1.2.2 and JSF 2.1, and JSF 2.2.0, and 2.2.1, but will not work with JSF 2.2.2+ on GlassFish 3.1.2.2, or GlassFish 4.0 2.2.2+

       #{'{0}'}
       <br/>
       #{'&#123;'}
       <br/>
       #{'&#125;'}
       <br/>
       #{'&#123;0&#125;'}
      

      If the same code is run on GlassFish 3.1.2.2 with JSF 2.2.2 the following exception is thrown.

      javax.el.ELException: EL Expression Unbalanced: ... #{'{0}'}
              
      	at com.sun.faces.facelets.el.ELText.findVarLength(ELText.java:435)
      	at com.sun.faces.facelets.el.ELText.parse(ELText.java:373)
      	at com.sun.faces.facelets.el.ELText.parse(ELText.java:325)
      	at com.sun.faces.facelets.compiler.TextUnit.flushTextBuffer(TextUnit.java:139)
      	at com.sun.faces.facelets.compiler.TextUnit.addInstruction(TextUnit.java:127)
      	at com.sun.faces.facelets.compiler.TextUnit.startTag(TextUnit.java:197)
      	at com.sun.faces.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:320)
      	at com.sun.faces.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:266)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
      	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:766)
      	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:355)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2778)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
      	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
      	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
      	at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
      	at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:448)
      	at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:424)
      	at com.sun.faces.facelets.compiler.Compiler.compile(Compiler.java:124)
      	at com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:473)
      	at com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(DefaultFaceletFactory.java:106)
      	at com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:199)
      	at com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:197)
      	at com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(DefaultFaceletCache.java:86)
      	at com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(DefaultFaceletCache.java:81)
      	at com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:99)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:114)
      	at com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:124)
      	at com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:63)
      	at com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:295)
      	at com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:239)
      	at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:974)
      	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
      	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
      	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
      	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
      	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
      	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
      	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
      	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      	at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      	at java.lang.Thread.run(Thread.java:744)
      

        Activity

        Hide
        jyeary added a comment - - edited

        I have a test case example project. The code can be downloaded from bitbucket here:
        jsf-el-delimiting

        Show
        jyeary added a comment - - edited I have a test case example project. The code can be downloaded from bitbucket here: jsf-el-delimiting
        Hide
        Manfred Riem added a comment -

        Setting priority to Major pending investigation (all issues start there, and might or might not get escalated).

        Show
        Manfred Riem added a comment - Setting priority to Major pending investigation (all issues start there, and might or might not get escalated).
        Hide
        Ed Burns added a comment -

        r=edburns.

        Show
        Ed Burns added a comment - r=edburns.
        Hide
        Manfred Riem added a comment -

        Applied to 2.2 branch,

        svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3135, r=edburns, make sure take curly braces into account inside of a string."
        Sending jsf-ri/src/main/java/com/sun/faces/facelets/el/ELText.java
        Adding test/servlet31/facelets/html/src/main/java
        Adding test/servlet31/facelets/html/src/main/java/com
        Adding test/servlet31/facelets/html/src/main/java/com/sun
        Adding test/servlet31/facelets/html/src/main/java/com/sun/faces
        Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test
        Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31
        Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31/facelets
        Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31/facelets/html
        Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31/facelets/html/Functions.java
        Adding test/servlet31/facelets/html/src/main/webapp/WEB-INF/test.taglib.xml
        Sending test/servlet31/facelets/html/src/main/webapp/WEB-INF/web.xml
        Adding test/servlet31/facelets/html/src/main/webapp/outputTextInline.xhtml
        Adding test/servlet31/facelets/html/src/test/java/com/sun/faces/test/servlet31/facelets/html/Issue3135IT.java
        Transmitting file data ......
        Committed revision 12773.

        Show
        Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3135 , r=edburns, make sure take curly braces into account inside of a string." Sending jsf-ri/src/main/java/com/sun/faces/facelets/el/ELText.java Adding test/servlet31/facelets/html/src/main/java Adding test/servlet31/facelets/html/src/main/java/com Adding test/servlet31/facelets/html/src/main/java/com/sun Adding test/servlet31/facelets/html/src/main/java/com/sun/faces Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31 Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31/facelets Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31/facelets/html Adding test/servlet31/facelets/html/src/main/java/com/sun/faces/test/servlet31/facelets/html/Functions.java Adding test/servlet31/facelets/html/src/main/webapp/WEB-INF/test.taglib.xml Sending test/servlet31/facelets/html/src/main/webapp/WEB-INF/web.xml Adding test/servlet31/facelets/html/src/main/webapp/outputTextInline.xhtml Adding test/servlet31/facelets/html/src/test/java/com/sun/faces/test/servlet31/facelets/html/Issue3135IT.java Transmitting file data ...... Committed revision 12773.

          People

          • Assignee:
            Manfred Riem
            Reporter:
            jyeary
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: