javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2282

Contents of CDATA blocks consumed in facelets-processing jspx/xml

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When <facelets-processing> mode is set to jspx/xml, the JSF implementation should strip the CDATA section wrappers (ie. "<![CDATA[" and "]]>"). These wrappers should not be represented in the corresponding UIComponent tree or be passed through in the rendered content.

      Currently, the CDATA section wrappers are removed, but this is implemented by removing the entire CDATA block, including any nested text content. This is not the desired behavior - ie. the text content itself should survive - only the CDATA wrapper constructs should be removed.

      See:

      http://java.net/projects/javaserverfaces-spec-public/lists/jsr344-experts/archive/2012-01/message/2

      For more details.

        Issue Links

          Activity

          Hide
          rogerk added a comment -

          Assign

          Show
          rogerk added a comment - Assign
          Hide
          Ed Burns added a comment -

          Need to be extra careful about Ajax with respect to CDATA.

          Show
          Ed Burns added a comment - Need to be extra careful about Ajax with respect to CDATA.
          Hide
          Ed Burns added a comment -

          Committed to trunk.

          Sending jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java
          Sending jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java
          Sending jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx
          Transmitting file data ...
          Committed revision 9632.

          Show
          Ed Burns added a comment - Committed to trunk. Sending jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java Sending jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java Sending jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx Transmitting file data ... Committed revision 9632.
          Hide
          Ed Burns added a comment -

          Committed to 2.1 branch.

          Sending jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java
          Sending jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java
          Sending jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx
          Transmitting file data ...
          Committed revision 9637.

          Show
          Ed Burns added a comment - Committed to 2.1 branch. Sending jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java Sending jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java Sending jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx Transmitting file data ... Committed revision 9637.
          Hide
          Ed Burns added a comment -

          At Manfred's request, verifying that this is done. I manually inspected the jspx source file and found this content related to the issue:

          <![CDATA[ <p>This is CDATA content</p> ]]>
          

          And there is this text in a JUnit testcase:

          
              private final static Pattern XmlDeclaration = Pattern.compile("(?s)^<\\?xml(\\s)*version=.*\\?>.*");
              private final static Pattern XmlDoctype = Pattern.compile("(?s).*<!DOCTYPE.*>.*");
              private final static Pattern XmlPI = Pattern.compile("(?s).*<\\?xml-stylesheet.*\\?>.*");
              private final static Pattern CDATASection = Pattern.compile("(?s).*<!\\[CDATA\\[ .*\\]\\]>.*");
              private final static Pattern Comment = Pattern.compile("(?s).*<!--.*-->.*");
              private final static Pattern EscapedText = Pattern.compile("(?s).*&amp;lt;context-param&amp;gt;.*");
              private final static Pattern NotEscapedText = Pattern.compile("(?s).*&lt;context-param&gt;.*");
          
          
              public void testProcessAsJspx() throws Exception {
          
                  String xml = getRawMarkup("/faces/jspxview.jspx");
                  assertFalse(XmlDoctype.matcher(xml).matches());
                  assertFalse(XmlDeclaration.matcher(xml).matches());
                  assertFalse(XmlPI.matcher(xml).matches());
                  assertFalse(CDATASection.matcher(xml).matches());
                  assertTrue(xml.matches("(?s).*<p>This\\s+is\\s+CDATA\\s+content</p>.*"));
                  assertTrue(NotEscapedText.matcher(xml).matches());
                  assertFalse(Comment.matcher(xml).matches());
              }
          

          Therefore, I assert that this code proves the correctness of this bug fix. It follows that I need to prove that this testcase is actually run, and actually passes.

          On the trunk, this test passed just yesterday.

          http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_TRUNK_DEPLOY/327/testReport/com.sun.faces.systest/ProcessAsJspxTestCase/

          On 2.1.x, this test passed just today.

          http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_2_1X_ROLLING_DEPLOY/232/testReport/com.sun.faces.systest/ProcessAsJspxTestCase/

          Therefore, I conclude that this is fixed.

          Show
          Ed Burns added a comment - At Manfred's request, verifying that this is done. I manually inspected the jspx source file and found this content related to the issue: <![CDATA[ <p>This is CDATA content</p> ]]> And there is this text in a JUnit testcase: private final static Pattern XmlDeclaration = Pattern.compile( "(?s)^<\\?xml(\\s)*version=.*\\?>.*" ); private final static Pattern XmlDoctype = Pattern.compile( "(?s).*<!DOCTYPE.*>.*" ); private final static Pattern XmlPI = Pattern.compile( "(?s).*<\\?xml-stylesheet.*\\?>.*" ); private final static Pattern CDATASection = Pattern.compile( "(?s).*<!\\[CDATA\\[ .*\\]\\]>.*" ); private final static Pattern Comment = Pattern.compile( "(?s).*<!--.*-->.*" ); private final static Pattern EscapedText = Pattern.compile( "(?s).*&amp;lt;context-param&amp;gt;.*" ); private final static Pattern NotEscapedText = Pattern.compile( "(?s).*&lt;context-param&gt;.*" ); public void testProcessAsJspx() throws Exception { String xml = getRawMarkup( "/faces/jspxview.jspx" ); assertFalse(XmlDoctype.matcher(xml).matches()); assertFalse(XmlDeclaration.matcher(xml).matches()); assertFalse(XmlPI.matcher(xml).matches()); assertFalse(CDATASection.matcher(xml).matches()); assertTrue(xml.matches( "(?s).*<p>This\\s+is\\s+CDATA\\s+content</p>.*" )); assertTrue(NotEscapedText.matcher(xml).matches()); assertFalse(Comment.matcher(xml).matches()); } Therefore, I assert that this code proves the correctness of this bug fix. It follows that I need to prove that this testcase is actually run, and actually passes. On the trunk, this test passed just yesterday. http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_TRUNK_DEPLOY/327/testReport/com.sun.faces.systest/ProcessAsJspxTestCase/ On 2.1.x, this test passed just today. http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_2_1X_ROLLING_DEPLOY/232/testReport/com.sun.faces.systest/ProcessAsJspxTestCase/ Therefore, I conclude that this is fixed.

            People

            • Assignee:
              Unassigned
              Reporter:
              aschwart
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: