ICEfaces
  1. ICEfaces
  2. ICE-5210

Improper handling of <?xml preamble

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha1
    • Fix Version/s: 2.0-Alpha2, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2
    • Workaround Exists:
      Yes
    • Workaround Description:
      Remove the preamble from the document if it's there.

      Description

      When NetBeans 6.8 creates a new Facelets page, the default looks like this:

      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html">
          <h:head>
              <title>Facelet Title</title>
          </h:head>
          <h:body>
              Hello from Facelets
          </h:body>
      </html>

      Stock JSF handles this fine but ICEfaces 2 has the following exception:

      Running with plain JSF works fine but running with glimmer causes:

      SEVERE: failed to append text[<?xml version='1.0' encoding='UTF-8' ?>
      ] into #document
      org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
              at com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(ParentNode.java:356)
              at com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(ParentNode.java:284)
              at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.java:389)
              at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java:235)
              at org.icefaces.context.DOMResponseWriter.appendToCursor(DOMResponseWriter.java:404)
              at org.icefaces.context.DOMResponseWriter.appendToCursor(DOMResponseWriter.java:396)
              at org.icefaces.context.DOMResponseWriter.write(DOMResponseWriter.java:113)
              at com.sun.faces.facelets.compiler.LiteralXMLInstruction.write(LiteralXMLInstruction.java:75)
              at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:75)
              at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:176)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
              at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
              at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
              at org.icefaces.push.BridgeSetup.renderView(BridgeSetup.java:85)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
              at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
              at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
              at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
              at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
              at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
              at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
              at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
              at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
              at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
              at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
              at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
              at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
              at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
              at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
              at java.lang.Thread.run(Thread.java:637)

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          We have some code for handling <!DOCTYPE info. Neither <?xml or <!DOCTYPE can be easily handled as DOM nodes. Instead, for <!DOCTYPE, we just write out the plain text to the underlying writer. This logic should also be applied <?xml.

          Show
          Deryk Sinotte added a comment - We have some code for handling <!DOCTYPE info. Neither <?xml or <!DOCTYPE can be easily handled as DOM nodes. Instead, for <!DOCTYPE, we just write out the plain text to the underlying writer. This logic should also be applied <?xml.
          Hide
          Deryk Sinotte added a comment -

          The <?xml preamble is now treated like the <!DOCTYPE line and written out as text rather than treated as a DOM node.

          Show
          Deryk Sinotte added a comment - The <?xml preamble is now treated like the <!DOCTYPE line and written out as text rather than treated as a DOM node.

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: