FileSystemProvider.getFileSystem() handling of IOException thrown by newFileSystem()?
Alan.Bateman at Sun.COM
Mon Aug 24 09:40:10 PDT 2009
Vince Bonfanti wrote:
> OK. I'm overriding the default provider and in this case it seems that
> my provider is expected to create the default file system
> automatically (without a call to newFileSystem), which makes sense.
Ah, I didn't realize you were replacing the default provider (are you
sure this is what you want?).
In that case, I see we have an inconsistency in the spec in that it does
say (in FileSystems.getDefault) that the provider's getFileSystem is
invoked to "create" the default file system. It does of course, just
invoke getFileSystem to get a reference to the default file system
(which is created automatically at a time of the provider's choosing).
I'll create a bug and get this fixed - sorry I missed this when we
exchanged mail yesterday as I thought you were creating a provider for a
pseudo file system.
As you are replacing the default provider then one thing I should point
is out that file I/O using java.io will not go through your provider,
not yet anyway. The reason is that we haven't pushed the changes for
this yet as there are a few subtle issues to figure out. I just mention
this in case this was your goal. Also, I mention it so that you are
aware of potential bootstrapping issues if your provider requires file
I/O during its initialization. If it does, then you'll need to delegate
to the system default provider during the initialization (your
provider's constructor will be called with a reference to this provider).
More information about the nio-discuss