leaningtech/cheerpj-meta

NIO Directory Streams not requesting data from the server.

objectconnexions opened this issue · 1 comments

While the following code works (a request gets made to the web server for the resource index.list), when it shows a list of all the files (as found in index.list).

	File[] list = dir.listFiles((d, name) -> name.endsWith(".jar") || name.endsWith(".cjar"));
	for (File file : list) {
		System.out.println("   - " + file.getName());
	}

Similar code that uses the NIO classes doesn't. No request is made to the web server for the content of the directory.

        Path path = Paths.get(pathName);
        //		System.out.println("    dir = " + path.toFile().isDirectory());
        //		System.out.println("    exists = " + path.toFile().exists());
        try (DirectoryStream<Path> jars = Files.newDirectoryStream(path)) {
	        jars.forEach(j -> System.out.println("    jar = " + j));
        }

If the two debug lines are uncommented then requests are made to the web server to determine if the path is a directory or it exists. (The DirectoryStream still does not work.)

Thank you for reporting this, the problem will be fixed in the upcoming CheerpJ 2.3 release