Why doesn't FileSystemProvider#getFileAttributeView() throw an IOException?

Francis Galiegue fgaliegue at gmail.com
Fri Dec 12 14:42:50 UTC 2014


On Fri, Dec 12, 2014 at 3:35 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 12/12/2014 14:00, Francis Galiegue wrote:
>>
>> All other methods to read/write attributes (including the one in
>> Files) do. This one is the only exception.
>>
>> This is all the more strange that you are theoretically supposed to
>> follow symlinks if the relevant link option is passed and your fs
>> supports it, and .toRealPath() _does_ throw an IOException...
>>
>> Overlook?
>>
>> At this moment, it appears that on error there is no other choice than
>> to throw an unchecked exception... Ouch.
>
>
> This method doesn't read/write file attributes. Instead it is specified to
> return you an object of the given view type that you can use to access the
> attributes that the view defines.
>

Uh, doesn't that pretty much mean that implementations of such views
are essentially condemned to do "lazy loading", including the path?

> Most applications shouldn't need to work
> at this level of course (as Files defines methods to do most of the common
> operations).
>

Well yes, and these method _do_ throw IOExceptions, which is why I
find it really strange that this one does not.

While the explanation kind of makes sense, implementing it is, uh.

-- 
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