leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
459 stars 21 forks source link

NIO Directory Streams not requesting data from the server. #149

Closed objectconnexions closed 2 years ago

objectconnexions commented 2 years ago

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.)

alexp-sssup commented 2 years ago

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