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

(zipfs) Nested ZipFileSystems cause issues with URI parsing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • None
    • core-libs
    • None

    Description

      The following demonstrates the issue with Zip FS and using URIs


      Path zip1Path = Files.createTempFile("zip1", ".zip");
      try {
          Files.delete(zip1Path);
          try (FileSystem zip1 = FileSystems.newFileSystem(zip1Path, Map.of("create", true))) {
              Path zip2Path = zip1.getPath("zip2.zip");
              try (FileSystem zip2 = FileSystems.newFileSystem(zip2Path, Map.of("create", true))) {
                  Path nestedFilePath = zip2.getPath("test.txt");
                  Path newPath = Path.of(nestedFilePath.toUri());
                  assert nestedFilePath.equals(newPath);
              }
          }
      } finally {
          try (Stream<Path> walk = Files.walk(zip1Path)) {
              walk.sorted(Comparator.reverseOrder())
                      .forEach(path -> {
                          try {
                              Files.delete(path);
                          } catch (IOException e) {
                              throw new Error(e);
                          }
                      });
          }
      }

      Attachments

        Activity

          People

            lancea Lance Andersen
            lancea Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: