-
Bug
-
Resolution: Fixed
-
P2
-
9
-
b154
-
b163
-
x86
-
other
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8178233 | 10 | Claes Redestad | P2 | Resolved | Fixed | b04 |
FULL PRODUCT VERSION :
java 9-ea
Java(TM) SE Runtime Environment (build 9-ea+159)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+159, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Enterprise
A DESCRIPTION OF THE PROBLEM :
I call Class method (e.g. getDeclaredFields) from JNI -- no Java code on thread stack before Class.getDeclaredFields.
checkMemberAccess in this case always throws NPE:
java.lang.NullPointerException
at java.base/java.lang.Class.checkMemberAccess(Unknown Source)
at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
<My JNI code>
Problematic line of code (\java.base\java\lang\Class.java:2774) :
final ClassLoader ccl = caller.getClassLoader0();
caller is always null in my case.
Proposal:
final ClassLoader ccl = ClassLoader.getClassLoader(caller);
REGRESSION. Last worked in version 8u121
REPRODUCIBILITY :
This bug can be reproduced always.
java 9-ea
Java(TM) SE Runtime Environment (build 9-ea+159)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+159, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Enterprise
A DESCRIPTION OF THE PROBLEM :
I call Class method (e.g. getDeclaredFields) from JNI -- no Java code on thread stack before Class.getDeclaredFields.
checkMemberAccess in this case always throws NPE:
java.lang.NullPointerException
at java.base/java.lang.Class.checkMemberAccess(Unknown Source)
at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
<My JNI code>
Problematic line of code (\java.base\java\lang\Class.java:2774) :
final ClassLoader ccl = caller.getClassLoader0();
caller is always null in my case.
Proposal:
final ClassLoader ccl = ClassLoader.getClassLoader(caller);
REGRESSION. Last worked in version 8u121
REPRODUCIBILITY :
This bug can be reproduced always.
- backported by
-
JDK-8178233 Class.checkMemberAccess throws NPE when calling Class methods via JNI
- Resolved
- relates to
-
JDK-8177136 Caller sensitive method System::getLogger should specify what happens if there is no caller on the stack.
- Closed
-
JDK-8177325 Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, will throw NPE if there is no caller on the stack.
- Closed