ICEfaces
  1. ICEfaces
  2. ICE-7805

DynamicResourceDispatcherAdapter opens resource input stream twice, but never closes

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0
    • Fix Version/s: None
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Any

      Description

      It seems that org.icefaces.impl.push.DynamicResourceDispatcherAdapter is a resource pig.

      The respond method calls resource.open() twice.
      The first time it is used to check, whether it is null.
      If not, the resource is opened again a second time.
      The inputStream of the previous open is never closed.

      [code]
        261: InputStream inputStream = resource.open();
        262: if (inputStream == null) {
        263: throw new IOException("Resource of type " + resource.getClass().getName() + "[digest: " +
        264: resource.calculateDigest() + "; mime-type: " + options.mimeType +
        265: (options.attachement ? "; attachment: " + options.fileName : "") +
        266: "] returned a null input stream.");
        267: } else {
        268: InputStream in = resource.open();
        269: OutputStream out = externalContext.getResponseOutputStream();
       [code}


      It would be very easy to reuse the previous inputStream in line 268, to avoid the second open, and to ensure the closing through the following operations.

      In my special context, this "bug" is quite painful, because the generation of the resource is quite costly. I would like to generate it on the fly into the input stream. However, instead I have to cache it into a file, in order to have it available for the second call.

        Activity

        Hide
        Michael Breu added a comment -

        Sorry, minor correction:

        It is not org.icefaces.impl.push.DynamicResourceDispatcherAdapter, but rather org.icefaces.impl.push.DynamicResourceDispatcher

        Michael

        Show
        Michael Breu added a comment - Sorry, minor correction: It is not org.icefaces.impl.push.DynamicResourceDispatcherAdapter, but rather org.icefaces.impl.push.DynamicResourceDispatcher Michael
        Hide
        Michael Breu added a comment -

        Hello all,

        I have seen that this issue is resolved in ICE-Faces 3.2.0

        So I would like to close this ticket, unfortunately I do not have the permission to do this.

        Show
        Michael Breu added a comment - Hello all, I have seen that this issue is resolved in ICE-Faces 3.2.0 So I would like to close this ticket, unfortunately I do not have the permission to do this.

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Breu
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: