Skip to content

Commit

Permalink
PlatformLoggingMXBean.setLoggerLevel() should allow null level
Browse files Browse the repository at this point in the history
A null level is allowed according to the spec. The implementation is
calling a parse helper which doesn't accept null values.

Problem discovered via OpenJDK test
java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java

Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
  • Loading branch information
pshipton committed Dec 18, 2020
1 parent 37218de commit 7b5e371
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,19 @@ public void setLoggerLevel(String loggerName, String levelName) {
// a valid level name.
/*[IF Sidecar19-SE]*/
try {
Object newLevel = level_parse.invoke(null, levelName);
Object newLevel = null;
if (levelName != null) {
newLevel = level_parse.invoke(null, levelName);
}
logger_setLevel.invoke(logger, newLevel);
} catch (Exception e) {
throw handleError(e);
}
/*[ELSE]*/
Level newLevel = Level.parse(levelName);
Level newLevel = null;
if (levelName != null) {
newLevel = Level.parse(levelName);
}
logger.setLevel(newLevel);
/*[ENDIF]*/
} else {
Expand Down

0 comments on commit 7b5e371

Please sign in to comment.