How to .resolve*() and .relativize() Paths which are not issued from the same FileSystem?
Francis Galiegue
fgaliegue at gmail.com
Sat Nov 29 17:01:42 UTC 2014
Hello,
I am writing a generic java.nio.file API to allow users to implement
FileSystem over various stuff (for instance, DropBox and Google Drive
come to mind) but I have trouble with the methods mentioned in the
subject.
Let us suppose DropBox. I link the provider to URI scheme "dropbox".
Now, I create two FileSystems out of the provider, on two different
accounts. If I have a path issued from one provider and another issued
from the second, at a first glance it does not make any sense to
resolve/relativize one against the other.
However, the javadoc of java.nio.file only covers the case of
different _providers_ for two different paths: "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."
And there is no such exception as FileSystemMismatchException defined;
so, how do I handle this case? Do I define this (unchecked) exception?
Should the documentation be updated to account for "incompatible"
FileSystems? Do I throw ProviderMismatchException anyway?
--
Francis Galiegue, fgaliegue at gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/parboiled1/grappa (redde
Caesaris: https://github.com/sirthias)
More information about the nio-dev
mailing list