Wicket
  1. Wicket
  2. WICKET-4293

UrlResourceStream closes incorrect InputStream causing stacktraces on undeploy on GlassFish

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.5.4, 6.0.0-beta1
    • Component/s: wicket
    • Environment:

      Description

      The UrlResourceStream, used by PackageResources, uses URLConnection#getInputStream() to get file contents. This method is called in UrlResourceStream#getInputStream(), but also when closing the resource in UrlResourceStream#close(). At least on GlassFish v2 and v3, the second call to URLConnection#getInputStream() returns a new stream, so the one created to retrieve the file contents is never closed properly.
      This results in a warning of the container when the classes are garbage-collected, for example on undeploy.

      The problem is not triggered in all situations. It can be reproduced by using Wicket in a multi-module project consisting of an EAR, WAR and JAR. The JAR must contain a resource (CSS, image, ...) and a Behavior. Inside the Behavior, a static ResourceReference must be created for the resource file.
      When using this Behavior from inside the WAR project by loading a page the resource is loaded properly. On undeploy however, the described problem will show up.

      The problem does not exists in Wicket 1.4.x, because a reference to the InputStream is stored. A quickstart and patch for 1.5 is available, will try to attach it

      1. Wicket153-bug.zip
        22 kB
        Pepijn de Geus
      2. patch.txt
        2 kB
        Pepijn de Geus
      3. wicket-core-4293-2.patch
        6 kB
        Pepijn de Geus

        Issue Links

          Activity

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Pepijn de Geus
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development