Details
Description
A DESCRIPTION OF THE PROBLEM :
First argument of java.nio.file.Paths.get(String first, String... more) method allows null parameter and transforms it to "null" string.
Example code:
java.nio.file.Path path = java.nio.file.Paths.get(null, "a");
System.out.println(path);
System.out.println(path.toAbsolutePath());
Output:
null\a
c:\Program Files\Java\jdk-15\bin\null\a
Looks like a bug for me.
Also JavaDoc for java.nio.file package state "Unless otherwise noted, passing a null argument to a constructor or method of any class or interface in this package will cause a NullPointerException to be thrown.".
FREQUENCY : always
First argument of java.nio.file.Paths.get(String first, String... more) method allows null parameter and transforms it to "null" string.
Example code:
java.nio.file.Path path = java.nio.file.Paths.get(null, "a");
System.out.println(path);
System.out.println(path.toAbsolutePath());
Output:
null\a
c:\Program Files\Java\jdk-15\bin\null\a
Looks like a bug for me.
Also JavaDoc for java.nio.file package state "Unless otherwise noted, passing a null argument to a constructor or method of any class or interface in this package will cause a NullPointerException to be thrown.".
FREQUENCY : always
Attachments
Issue Links
- csr for
-
JDK-8255997 (fs) NullPointerException not thrown when first argument to Path.of or Paths.get is null
-
- Closed
-
- relates to
-
JDK-8255855 appcds/jigsaw/NewModuleFinderTest.java test failed due to unexpected NPE
-
- Closed
-