mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8281006: Module::getResourceAsStream should check if the resource is open unconditionally when caller is null
Reviewed-by: alanb, erikj, mchung
This commit is contained in:
parent
018017a917
commit
e8016f7443
8 changed files with 393 additions and 8 deletions
|
@ -1653,11 +1653,11 @@ public final class Module implements AnnotatedElement {
|
|||
if (caller != this && caller != Object.class.getModule()) {
|
||||
String pn = Resources.toPackageName(name);
|
||||
if (getPackages().contains(pn)) {
|
||||
if (caller == null && !isOpen(pn)) {
|
||||
// no caller, package not open
|
||||
return null;
|
||||
}
|
||||
if (!isOpen(pn, caller)) {
|
||||
if (caller == null) {
|
||||
if (!isOpen(pn)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!isOpen(pn, caller)) {
|
||||
// package not open to caller
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue