Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6294

Missing trailing slash with Bundle.getResource() for directory entry

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • framework-5.6.12
    • framework-7.0.0
    • Framework
    • None

    Description

      I'm working on Pax Web 8 and I try to unify welcome file handling across Jetty/Tomcat/Undertow.
      When accessing directory entries from a bundle (org.osgi.framework.Bundle#getResource() I found different behavior between Felix and Equinox.

      Trying to pass /META-INF/ and /META-INF resource names to getResource() method, I'm getting different results for Felix:

      • bundle://19.0:1/META-INF/
      • bundle://19.0:1/META-INF

      and Equinox:

      • bundleresource://19.fwk1529115495/META-INF/
      • bundleresource://19.fwk1529115495/META-INF/

      Underneath, both implementations call java.util.zip.ZipFile#getEntry(java.lang.String), but only Equniox has special org.eclipse.osgi.storage.bundlefile.BundleFile#fixTrailingSlash() method that adjusts the returned URL according to passed name and actual ZIP entry (java.util.zip.ZipEntry#getName().

      This makes detection of a directory obtained from a bundle much harder with Felix. Also org.eclipse.jetty.util.resource.URLResource#isDirectory() is simply:

      public boolean isDirectory()
      {
          return exists() && _urlString.endsWith("/");
      }
      

      Attachments

        Issue Links

          Activity

            People

              karlpauls Karl Pauls
              ggrzybek Grzegorz Grzybek
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: