RFR JDK-8002390 problems moving files between zip file systems

Mark Sheppard mark.sheppard at oracle.com
Thu Feb 14 18:34:35 UTC 2013


Please oblige and review the webrev at


which addresses the issue raised in  JDK-8002390

Description:  While working with the new ZipFileSystem to modify the 
contents of a zip file, encountered some issues.
The issue occurs when a file within a zip file is moved to a different 
location within the same zip and a FileVisitor is invoked by 
Files.walkFileTree the original (no longer existing file) will attempted 
to be visited by ZipFileSystemProvider and throw a NoSuchFileException.

This is an issue with the ZipFileSystem demonstration code, which
provides a concrete example of the java.nio.file FileSystem and 
associated functionality.
The issue arises when the file system is created, closed, then re-opened 
followed by
a file move operation within the ZipFileSystem.

This arises from the fact that the internal data structures representing 
the ZipFileSystem,
when it is initially created are slightly different to those when the 
file system is re-opened after a close.
The ZipFileSystem.copyFile() processing flow, which is the end result of 
the Files.move(),
needed to be amended to allow for this subtle difference. This is 
represented in the changes in the update() and
removeFromTree() methods. Additionally, the logic for handling a rename, 
earlier in the processing
flow was amended, also.

relevant tests have been updated.


More information about the core-libs-dev mailing list