-
Bug
-
Resolution: Fixed
-
P2
-
9
-
b121
-
Verified
Specification for "java.lang.module" states that
"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."
This is not always so for ModuleReader instances. Consider the following code sample:
=====================
import java.io.IOException;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReader;
public class InstalledNONPE {
public static void main(String[] args) {
ModuleFinder.ofSystem().findAll().stream().forEach(mref -> {
try {
mref.open().open((String) null);
mref.open().read((String) null);
System.out.println("No NPEs");
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}
=====================
No NPEs will be seen in the output.
The following JCK tests fail due to this problem
api/java_lang/module/ModuleReader/index.html#InstalledModules[open_NPE]
api/java_lang/module/ModuleReader/index.html#InstalledModules[read_NPE]
api/java_lang/module/ModuleReader/Generic/test.html[release_NPE]
"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."
This is not always so for ModuleReader instances. Consider the following code sample:
=====================
import java.io.IOException;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReader;
public class InstalledNONPE {
public static void main(String[] args) {
ModuleFinder.ofSystem().findAll().stream().forEach(mref -> {
try {
mref.open().open((String) null);
mref.open().read((String) null);
System.out.println("No NPEs");
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}
=====================
No NPEs will be seen in the output.
The following JCK tests fail due to this problem
api/java_lang/module/ModuleReader/index.html#InstalledModules[open_NPE]
api/java_lang/module/ModuleReader/index.html#InstalledModules[read_NPE]
api/java_lang/module/ModuleReader/Generic/test.html[release_NPE]