RFR JDK-8028480: (zipfs) NoSuchFileException on creating a file in ZipFileSystem with CREATE and WRITE

Alan Bateman Alan.Bateman at oracle.com
Thu May 28 07:03:50 UTC 2015


On 27/05/2015 17:01, Xueming Shen wrote:
>
> I'm aware of converting the options to internal flags in unix fs, but 
> thought that is for the convenience...
> We are not saving the options for any future/internal use, simply 
> checking its value on the spot. Just wonder
> really need to make the defensive copy here? The invoker changes the 
> options during the invocation of this
> method?
Yes because otherwise the validation can be bypassed. 
ZipFileSystem.newFileChannel is a good example where it is copying the 
options (to add CREATE_NEW) after it validates when it should make the 
copy first to avoid the options changing under its feet. There may be a 
few places in the ZIP provider where this should be done.

-Alan.


More information about the nio-dev mailing list