Couple of issues in Path class
Alan.Bateman at Sun.COM
Thu Mar 5 03:11:22 PST 2009
Rajendra Gutupalli wrote:
> Hi Alan,
> I am just going through the specification and testing whenever
> required before working on Zip demo.
> I noticed the following issues.
> 1) Minor Typo @ "Interoperability" section in description of the class
> Path, where java.io.File is repeated at the end of the following
> "The File.toPath method may be used to obtain a Path from the abstract
> path name represented by a java.io.File java.io.File object."
There is a typo here - thanks! Looks like it crept it when a @link tag
was changed to a @code tag.
> 2) This issue looks like bug please let me know if it is.
> Spec for Path.resolve(String other) says "Converts a given path string
> to a Path and resolves it against this Path in exactly the manner
> specified by the Path.resolve(Path other) method. "
> and in Path.resolve(Path other) says " If other is null then this
> path is returned."
> Paht.resolve((Path)null) works as expected but,
> Path.resolve((String)null) throws NPE.
> I think as per spec it should not throw NPE.
The resolve(Path) method allowed to accept null - the rational is that
this method will commonly be used with the relativize method where the
relative path between two equal paths is null. If you look at the Copy
sample code you'll see this in action. If resolve didn't accept null
then the code would always have to special-case the top-level directory.
More information about the nio-dev