Attributes.readAttributes() throw AIOOBE

Alan Bateman Alan.Bateman at Sun.COM
Wed Mar 11 06:33:11 PDT 2009


Rajendra Gutupalli wrote:
> Hi Alan,
>
> Could you please clarify me following issues that I noticed while 
> trying NIO file system APIs.
>
> 1) As Paths.get() method throws InvalidPathException(IPE) for invalid 
> paths, I was expecting Paths.get("\\\\                   \\            
> "); to throw IPE as this path does not contain valid server and share 
> names. Could  you please tell me why doesn't this method throw IPE for 
> this UNC path.
The server component of the UNC could be a NetBIOS name and so may 
contain spaces. Also the share component may contain spaces. While 
clearly the input is garbage here it's not possible to reject it without 
a clear specification of the allowed characters and rules.

>
> 2) I observed Attributes.readAttributes(path, ",,," ); throws 
> ArrayIndexOutOfBoundsException, I think as per the spec it should 
> return empty Map.
A corner case - thanks!

-Alan.



More information about the nio-dev mailing list