Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-2615

Unable to pick date with ace:dateTimeEntry on Pluto



      Steps to reproduce:

      1. Deploy and navigate to the Icefaces portlet on Pluto.
      2. Click in the "Date of Birth" field and try to select a date from the popup calendar

      If the bug is fixed then the date will be selected and appear in the textbox.

      Otherwise, if the bug still exists then there will be an error in the browser's console log:

      Uncaught TypeError: Cannot read property 'length' of undefined

      The root cause of this issue is that the Liferay Faces `ResponseWriter`s are added to the delegation chain twice (because the Liferay Faces `RenderKit`s are added to the delegation chain twice) which causes `target="body"` scripts, `FacesRequestContext` scripts, and other scripts encoded in `BodyRenderer.encodeEnd()` to never be encoded. Since the `BodyScriptEncodingResponseWriter` detects when `responseWriter.endElement("body")` is called in order to encode body scripts, it must be on the outside of the delegation chain because `ResponseWriterBridgeBodyImpl` suppresses the `<body>` element. However, in the situation described in this issue, one `BodyScriptEncodingResponseWriter` ends up inside a `ResponseWriterBridgeBodyImpl` which causes the issue.

      When this issue occurs, the delegation chain looks something like this:

      Other `ResponseWriter`s
      Mojarra's base `ResponseWriter`

      Here is an exact description of what occurs because of this delegation chain:

      1. The outer `BodyScriptEncodingResponseWriter` captures third party body scripts and attempts to render them before the closing `</body>`.
      2. The inner `BodyScriptEncodingResponseWriter` re-captures the body scripts encoded by the outer `BodyScriptEncodingResponseWriter`.
      3. The outer `BodyScriptEncodingResponseWriter` calls `responseWriter.endElement("body")`.
      4. The outer `ResponseWriterBridgeBodyImpl` calls `responseWriter.endElement("div")` in order to suppress the `<body>` element.

      So the inner `BodyScriptEncodingResponseWriter` never encodes the captured scripts because `"body".equals(name)` is *not* true in `responseWriter.endElement("div")`.

      The reason that this bug does *not* occur in Liferay is because `BodyScriptEncodingResponseWriter` ends up calling the `LiferayImpl` of `ScriptsEncoder.encodeBodyScripts()` which calls through to Liferay's API for adding scripts before the closing `</body>` tag. This avoids the problem of the scripts being recaptured by the inner `BodyScriptEncodingResponseWriter` since `ScriptsEncoderLiferayImpl.encodeBodyScripts()` never calls a `ResponseWriter`.

      This situation should only occur when external libraries declare a `RenderKitWrapper`, and may also affect Primefaces and Richfaces portlets.

      This issue causes [ICE-10968](http://jira.icesoft.org/browse/ICE-10968).{markdown}




            • Assignee:
              kyle.stiemann Kyle Stiemann (Inactive)
              kyle.stiemann Kyle Stiemann (Inactive)
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:


                Version Package