Oversight in documentation about the behaviour of .resolve{Sibling}() and .relativize()?

Alan Bateman Alan.Bateman at oracle.com
Sat Mar 22 09:04:06 UTC 2014


On 22/03/2014 08:45, Francis Galiegue wrote:
> Hello,
>
> I am in the process of implementing a FileSystem over FTP, so I
> experimented with some not-that-much-used stuff and discovered that if
> you try and p1.resolve(p2), where p1 and p2 are Paths issued from
> different FileSystems, you get a ProviderMismatchException.
>
> I discovered it the hard way, since this is not documented! Can this
> be documented in future JDK releases?
The package description documents the general exceptions that are 
possible. It includes this:

"Unless otherwise noted, invoking a method of any class or interface in 
this package created by one provider with a parameter that is an object 
created by another provider, will throw ProviderMismatchException."

> :
>
> Also, since this is FTP, I don't have any "device" size information
> about the other end; the javadoc of FileStore doesn't tell what the
> .get*Space() methods return in this case.
>
Originally FileStore didn't define the getXXXSpace methods but there 
were complaints that this this made it harder to use because it required 
getting the appropriate FileStoreAttributeView. Potentially we could 
allow for these methods to return -1 when the size it unknown. 
Alternatively if you can't really implement FileStore then the 
FileSystemProvider's getFileStore could fail.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20140322/22d4982b/attachment.html>


More information about the nio-dev mailing list