[
https://issues.jboss.org/browse/LOGMGR-187?page=com.atlassian.jira.plugin...
]
James Perkins updated LOGMGR-187:
---------------------------------
Description:
The {{ClassLoaderLogContextSelector}} check for the registered {{LogContext}} returns
{{defaultSelector.getLogContext()}} in the {{check()}} method and should return {{null}}.
{code:title=Previous Version}
private final PrivilegedAction<LogContext> logContextAction = new
PrivilegedAction<LogContext>() {
public LogContext run() {
for (Class<?> caller : GATEWAY.getClassContext()) {
final ClassLoader classLoader = caller.getClassLoader();
final LogContext result = check(classLoader);
if (result != null) {
return result;
}
}
return defaultSelector.getLogContext();
}
private LogContext check(final ClassLoader classLoader) {
if (classLoader != null && !logApiClassLoaders.contains(classLoader)) {
final LogContext context = contextMap.get(classLoader);
if (context != null) {
return context;
}
if (checkParentClassLoaders) {
return check(classLoader.getParent());
}
}
return null;
}
};
{code}
{code:title=Current Version}
private final PrivilegedAction<LogContext> logContextAction = new
PrivilegedAction<LogContext>() {
public LogContext run() {
final Class<?> callingClass =
JDKSpecific.findCallingClass(logApiClassLoaders);
return callingClass == null ? defaultSelector.getLogContext() :
check(callingClass.getClassLoader());
}
private LogContext check(final ClassLoader classLoader) {
final LogContext context = contextMap.get(classLoader);
if (context != null) {
return context;
}
final ClassLoader parent = classLoader.getParent();
if (parent != null && checkParentClassLoaders && !
logApiClassLoaders.contains(parent)) {
return check(parent);
}
return defaultSelector.getLogContext();
}
};
{code}
The new version only checks the first caller found, then returns the default. The older
version checks the callers until it finds a non-null value finally returning the default
if no callers were found with associated contexts.
was:The {{ClassLoaderLogContextSelector}} check for the registered {{LogContext}}
returns {{defaultSelector.getLogContext()}} in the {{check()}} method and should return
{{null}}.
The ClassLoaderLogContextSelector check for the log context should
return null
------------------------------------------------------------------------------
Key: LOGMGR-187
URL:
https://issues.jboss.org/browse/LOGMGR-187
Project: JBoss Log Manager
Issue Type: Bug
Reporter: James Perkins
Assignee: James Perkins
The {{ClassLoaderLogContextSelector}} check for the registered {{LogContext}} returns
{{defaultSelector.getLogContext()}} in the {{check()}} method and should return {{null}}.
{code:title=Previous Version}
private final PrivilegedAction<LogContext> logContextAction = new
PrivilegedAction<LogContext>() {
public LogContext run() {
for (Class<?> caller : GATEWAY.getClassContext()) {
final ClassLoader classLoader = caller.getClassLoader();
final LogContext result = check(classLoader);
if (result != null) {
return result;
}
}
return defaultSelector.getLogContext();
}
private LogContext check(final ClassLoader classLoader) {
if (classLoader != null && !logApiClassLoaders.contains(classLoader)) {
final LogContext context = contextMap.get(classLoader);
if (context != null) {
return context;
}
if (checkParentClassLoaders) {
return check(classLoader.getParent());
}
}
return null;
}
};
{code}
{code:title=Current Version}
private final PrivilegedAction<LogContext> logContextAction = new
PrivilegedAction<LogContext>() {
public LogContext run() {
final Class<?> callingClass =
JDKSpecific.findCallingClass(logApiClassLoaders);
return callingClass == null ? defaultSelector.getLogContext() :
check(callingClass.getClassLoader());
}
private LogContext check(final ClassLoader classLoader) {
final LogContext context = contextMap.get(classLoader);
if (context != null) {
return context;
}
final ClassLoader parent = classLoader.getParent();
if (parent != null && checkParentClassLoaders && !
logApiClassLoaders.contains(parent)) {
return check(parent);
}
return defaultSelector.getLogContext();
}
};
{code}
The new version only checks the first caller found, then returns the default. The older
version checks the callers until it finds a non-null value finally returning the default
if no callers were found with associated contexts.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)