MyFaces Core
  1. MyFaces Core
  2. MYFACES-3414

MyFaces ResourceImpl$ValueExpressionFilterInputStream does not handle resolving long URLs

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.3, 2.1.4
    • Fix Version/s: 2.0.12, 2.1.6
    • Component/s: General
    • Labels:
      None

      Description

      We have logged an issue in our own JIRA tracker for this issue as well: http://jira.icefaces.org/browse/ICE-7518

      It was discovered running on Liferay but the issue turn out to be not specific to portlets - it's simply manifest more obviously there. Given a CSS file with an EL resource such as:

      url("#

      {resource['icefaces.ace:themes/sam/images/ui-default.png']}

      ")

      MyFaces will typically return something like:

      url("/my/javax.faces.resource/themes/sam/images/ui-default.png.jsf?ln=icefaces.ace")

      When running on Liferay, the returned URL will be much longer given the portlet namespacing and the various Liferay request parameters:

      url("http://localhost:8080/web/guest/acefile?_fileEntry_WAR_showcaseportlet_ln=icefaces.ace&_fileEntry_WAR_showcaseportlet_javax.faces.resource=themes%2Fsam%2Fimages%2Fui-default.png&p_p_col_count=1&p_p_col_id=column-1&p_p_id=fileEntry_WAR_showcaseportlet&p_p_lifecycle=2")

      However, the URL that is actually written into our CSS file looks like this:

      url("lhost:8080/web/guest/acefile?_fileEntry_WAR_showcaseportlet_ln=icefaces.ace&_fileEntry_WAR_showcaseportlet_javax.faces.resource=themes%2Fsam%2Fimages%2Fui-default.png&p_p_col_count=1&p_p_col_id=column-1&p_p_id=fileEntry_WAR_showcaseportlet&p_p_lifecycle=2")

      The URL is missing characters at the front

      lhost:8080/web

      instead of

      http://localhost:8080/web

      Almost all the resource URLs in our CSS file are mangled in a similar way. After a lot of head scratching, it turns out that the URLs are longer than ResourceImpl$ValueExpressionFilterInputStream is prepared to handle:

      private class ValueExpressionFilterInputStream extends InputStream
      {
      private PushbackInputStream delegate;

      public ValueExpressionFilterInputStream(InputStream in)

      { super(); delegate = new PushbackInputStream(in,255); }

      ...

      For us, setting the "unread" buffer to a higher number than 255 appears to solve the issue. Perhaps this could be done a different way to account for longer URLs or at least made configurable if someone needs to adjust it.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          11d 17h 34m 1 Leonardo Uribe 12/Dec/11 17:14
          Resolved Resolved Closed Closed
          56d 6h 7m 1 Leonardo Uribe 06/Feb/12 23:22
          Leonardo Uribe made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Leonardo Uribe made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Leonardo Uribe [ lu4242 ]
          Fix Version/s 2.0.12 [ 12319175 ]
          Fix Version/s 2.1.6 [ 12319173 ]
          Resolution Fixed [ 1 ]
          Leonardo Uribe made changes -
          Field Original Value New Value
          Link This issue is cloned as MYFACES-3417 [ MYFACES-3417 ]
          Deryk Sinotte created issue -

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development