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

(jrtfs) DirectoryStream entries have incorrect paths

XMLWordPrintable

      The Files.newDirectorStream and Files.list methods are specified to return an iterator of Path objects where "The Path objects are obtained as if by resolving the name of the directory entry against dir".

      In jigsaw/m2, then using invoking these methods with a relative path returns an iterator of Path objects that are absolute paths. For example, this fails:

              Path base = fs.getPath("java.base");
              try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
                  for (Path entry: stream) {
                      assertTrue( entry.getParent().equals(base) );
                  }
              }

      A related issue is that the String representation of entries that are directories have trailing slashes, a bug that may have transferred from the zipfs provider.

            sundar Sundararajan Athijegannathan
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: