Note that there are some explanatory texts on larger screens.

plurals
  1. POnosuchfileexception while walking files tree inside a zip using java nio
    primarykey
    data
    text
    <p>I'm getting an exception while walking a file tree of a VFS (virtual file system) of a zip file using java nio, here is my code: </p> <pre><code>public static void list(String zipFilePath) throws IOException{ FileSystem fs = FileSystems.newFileSystem(Paths.get(zipFilePath), null); Path startPath = fs.getPath("/"); Files.walkFileTree(startPath, new SimpleFileVisitor&lt;Path&gt;() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("Dir : " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("\t-&gt;File : " + file); return FileVisitResult.CONTINUE; } }); } </code></pre> <p>the exception says that a file does not exists, but I've decompress the archive (zip), and the file is there... any idea why?</p> <p>here is the exception: </p> <pre><code>java.nio.file.NoSuchFileException: /Dir1/Dir2/Dir3/Dir4/ExcelFile.xlsm at com.sun.nio.zipfs.ZipPath.getAttributes(ZipPath.java:657) at com.sun.nio.zipfs.ZipFileSystemProvider.readAttributes(ZipFileSystemProvider.java:285) at java.nio.file.Files.readAttributes(Files.java:1669) at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:105) at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:199) at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69) at java.nio.file.Files.walkFileTree(Files.java:2585) at java.nio.file.Files.walkFileTree(Files.java:2618) </code></pre> <p><em>BTW:</em> The code DOES work, but it crash with certain files</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload