NoSuchFileException thrown by FileTreeWalker
Andrew Scully
andrewscully at gmail.com
Tue Sep 8 08:43:14 UTC 2015
Hi,
The below exception was thrown on a CentOS 7.1 system running Oracle
JDK 8u51 64-bit during a walk of a file directory:
java.nio.file.NoSuchFileException:
/home/reims/vcs-v70/VCS-SCS/reims/config/definition-import/cdr/OI-UpdateODRApplStatusByTransNo-1-0-0.xml.processed
at
sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at
sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at
sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at
sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
at java.nio.file.Files.readAttributes(Files.java:1737)
at
java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
at java.nio.file.FileTreeWalker.next(FileTreeWalker.java:372)
at java.nio.file.Files.walkFileTree(Files.java:2706)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at
com.saaconsultants.osp.admin.svc.OspPersistenceServiceImpl$2.run(OspPersistenceServiceImpl.java:268)
The directory in question was probably being modified at the time, so
it's entirely possible that the file in question was deleted mid-walk.
The JavaDoc for the method
(https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#walkFileTree-java.nio.file.Path-java.nio.file.FileVisitor-)
states that an IOException is only thrown "if an I/O error is thrown
by a visitor method", but in this case it appears at least that the
exception is being thrown by the walker implementation itself.
The visitor in use is a java.nio.file.SimpleFileVisitor that overrides
the #visitFile() and #preVisitDirectory() methods only.
Any thoughts on how best to proceed (including a more appropriate
mailing list if this isn't the right one!) would be greatly
appreciated.
Kind Regards,
Andrew Scully.
More information about the nio-dev
mailing list