NIO question: Path.toFile()
Alan Bateman
Alan.Bateman at oracle.com
Thu Nov 27 16:47:33 UTC 2014
On 27/11/2014 16:32, Jonathan Gibbons wrote:
>
> Alan,
>
> Thanks for the perspective on why it is UOE. Kevin's blog is
> interesting, but as I read it, it argues against UOE :-)
I think there's a discussion point there as Path is an interface and
there are different concrete types. In any case, we can't change this of
course.
> :
>
> I think this means that from the point of view of an API using
> java.nio.file.Path internally, UOE should not be propagated to clients
> of that API. Instead, it should be caught and rethrown as something
> more specific to that level of API.
The toFile() method is meant for interoperability with the legacy API
and so some care is required to avoid using it on Paths to objects in
arbitrary file system that could not be represented by java.io.File. I
think I'd need to see more context to know if you should be propagating
anything or whether the issue is just an incorrect assumption somewhere.
-Alan
More information about the core-libs-dev
mailing list