JDK-8145302 : NullPointerException at java.util.logging.Logger.demandLogger
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 8u65
  • Priority: P4
  • Status: Closed
  • Resolution: Incomplete
  • OS: windows_7
  • Submitted: 2015-12-11
  • Updated: 2023-10-18
  • Resolved: 2016-12-20
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
1.8.0_65-b17

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
Mathworks library (www.mathworks.com) throws NullPointerException when trying to create a java.util.logging.Logger.  It appears that Logger.demandLogger doesn't guard against the caller argument being null.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
http://stackoverflow.com/questions/33996439/nullpointerexception-at-java-util-logging-logger-demandlogger

ACTUAL -
Stacktrace was generated.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
com.mathworks.toolbox.javabuilder.MWException: Java exception occurred: 
java.lang.NullPointerException
    at java.util.logging.Logger.demandLogger(Logger.java:451)
    at java.util.logging.Logger.getLogger(Logger.java:502)
    at com.mathworks.toolbox.javabuilder.internal.MWMCR.mclFeval(Native Method)
    at com.mathworks.toolbox.javabuilder.internal.MWMCR.access$600(MWMCR.java:23)
    at com.mathworks.toolbox.javabuilder.internal.MWMCR$6.mclFeval(MWMCR.java:833)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.mathworks.toolbox.javabuilder.internal.MWMCR$5.invoke(MWMCR.java:731)
    at com.sun.proxy.$Proxy2.mclFeval(Unknown Source)
    at com.mathworks.toolbox.javabuilder.internal.MWMCR.invoke(MWMCR.java:406)
    at mDataEngine.mDataEngineMIF.volatility(mDataEngineMIF.java:7212)

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
-Dsun.util.logging.disableCallerCheck=true


Comments
Does the bug also occur when running in interpreted mode only? ( -Xint )
14-12-2015

Would it be possible to get a small test case that reproduces the issue? It will be difficult to find the root cause without a reproducer.
14-12-2015

As per JDK-8014925 , sun.reflect.Reflection.getCallerClass was disabled , and with a switch it can be enabled. This is used in the getLogger method of the Logger class, causing the NPE.
14-12-2015