[
https://issues.redhat.com/browse/LOGMGR-266?page=com.atlassian.jira.plugi...
]
James Perkins commented on LOGMGR-266:
--------------------------------------
Good catch. I wasn't aware the level could be {{null}}. I've created
https://github.com/jboss-logging/log4j2-jboss-logmanager/issues/3 for this as well.
I'll leave this open for now as a reminder.
log4j2-jboss-logmanager LevelTranslator NullPointer
---------------------------------------------------
Key: LOGMGR-266
URL:
https://issues.redhat.com/browse/LOGMGR-266
Project: JBoss Log Manager
Issue Type: Bug
Reporter: Boris Unckel
Priority: Critical
We found the following Nullpointer Exception
{code}
Caused by: java.lang.NullPointerException
at org.jboss.logmanager.log4j.LevelTranslator.translateLevel(LevelTranslator.java:95)
at org.jboss.logmanager.log4j.JBossLogger.getLevel(JBossLogger.java:156)
{code}
....
Reason seems that LevelTranslator is not defensive enough. Suggestion:
{code}
java.util.logging.Level translateLevel(final Level level) {
//level null is same as level not translated
if(level == null) {
return org.jboss.logmanager.Level.INFO;
}
final java.util.logging.Level result = log4jToJul.get(level.intLevel());
return result == null ? org.jboss.logmanager.Level.INFO : result;
}
Level translateLevel(final java.util.logging.Level level) {
//level null is same as level not translated
if(level == null) {
return Level.INFO;
}
final Level result = julToLog4j.get(level.intValue());
return result == null ? Level.INFO : result;
}
{code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)