google/jimfs

provider methods on paths from a closed filesystem do not throw

Opened this issue · 2 comments

e.g. newByteChannel, delete, isHidden, getFileStore, checkAccess ...

FileSystem jimfs = Jimfs.newFileSystem(Configuration.unix());
Path path = jimfs.getPath( "/foo" );
FileSystemProvider provider = jimfs.provider();
jimfs.close();
provider.delete( path ); // should throw ClosedFileSystemException

see also: https://github.com/openCage/niotest/blob/master/src/test/java/org/opencage/lindwurm/niotest/JimFSTest.java

Thanks for reporting this. Handling closing a FileSystem better is something I've been meaning to do but haven't gotten around to yet, partly because there's generally not a lot of harm if the file system still works after it's closed. I suspect that behavior is mostly specified with file systems like ZipFileSystem (which must close its open file when it's closed) in mind. That said, I do want to follow the spec as closely as possible.

Fixed.