Couple of issues in Path class
Alan Bateman
Alan.Bateman at Sun.COM
Thu Mar 5 04:51:34 PST 2009
Rajendra Gutupalli wrote:
> Correct Alan, resolve(Path) is working as you mentioned. But the other
> overloaded resolve(String) is not allowing me to pass null.
> The following code snippet is throwing NPE when tried in Solaris and
> Windows.
>
> <code>
> Path path = Paths.get("c:/");
> out.println(path.resolve((String)null));
> </code>
>
> Could you please me know what should be the output in the above case?.
> I am getting NPE instead of printing path "c:".
>
Yes, this is expected (in general, assume NPE unless stated otherwise;
the package description has wording for this). Remember p.resolve(s) is
just a convienence method for p.resolve(p.getFileSystem().getPath(s)) so
null doesn't make sense.
-Alan.
More information about the nio-dev
mailing list