Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8237875

(zipfs) DirectoryStream entries changed behavior between JDK 11.0.5 and JDK 11.0.6

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "11.0.6" 2020-01-14

      A DESCRIPTION OF THE PROBLEM :
      The behavior of DirectoryStreams differs between JDK 11.0.5 and JDK 11.0.6 in
      that under JDK 11.0.5 entries contain a leading slash character "/" but under
      JDK 11.0.6 they do not when reading a JAR file. Uncertain whether this behavior
      change is intended.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Use provided source code changing "{path_to_jar_file}" to appropriate value
         associated with a JAR file.
         
      2. Execute source code under JDK 11.0.5 and observe that all file entries in JAR
         have a preceding "/".
         
      3. Execute source code under JDK 11.0.6 and observe that all file entries in JAR
         do not have a preceding "/".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected behavior to be the same between JDK 11.0.5 and JDK 11.0.6.
      ACTUAL -
      Behavior differs between JDK 11.0.5 and JDK 11.0.6.

      ---------- BEGIN SOURCE ----------
            String path = "META-INF";

              File file = new File("{path_to_jar_file}");
              FileSystem fileSystem = FileSystems.newFileSystem(file.toPath(), null);

              FileSystemProvider fileSystemProvider = fileSystem.provider();
              Path myPath = fileSystem.getPath(path);

              DirectoryStream<Path> directoryStream = fileSystemProvider.newDirectoryStream(myPath, null);
              for (Path entryPath : directoryStream) {
                  out.println(String.format("File: %s", entryPath.toString()));
              }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None.

        Attachments

          Activity

            People

            Assignee:
            clanger Christoph Langer
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: