1
0

Raise embedded if into parent if.

This commit is contained in:
Gary Gregory
2021-02-28 12:43:57 -05:00
parent a3661dd192
commit c2afed56ab
2 changed files with 20 additions and 26 deletions

View File

@@ -419,14 +419,12 @@ public abstract class LogFactory {
// Identify the class loader we will be using // Identify the class loader we will be using
final ClassLoader contextClassLoader = getContextClassLoaderInternal(); final ClassLoader contextClassLoader = getContextClassLoaderInternal();
if (contextClassLoader == null) {
// This is an odd enough situation to report about. This // This is an odd enough situation to report about. This
// output will be a nuisance on JDK1.1, as the system // output will be a nuisance on JDK1.1, as the system
// classloader is null in that environment. // classloader is null in that environment.
if (isDiagnosticsEnabled()) { if (contextClassLoader == null && isDiagnosticsEnabled()) {
logDiagnostic("Context classloader is null."); logDiagnostic("Context classloader is null.");
} }
}
// Return any previously registered factory for this class loader // Return any previously registered factory for this class loader
LogFactory factory = getCachedFactory(contextClassLoader); LogFactory factory = getCachedFactory(contextClassLoader);
@@ -458,10 +456,9 @@ public abstract class LogFactory {
ClassLoader baseClassLoader = contextClassLoader; ClassLoader baseClassLoader = contextClassLoader;
if (props != null) { if (props != null) {
final String useTCCLStr = props.getProperty(TCCL_KEY); final String useTCCLStr = props.getProperty(TCCL_KEY);
if (useTCCLStr != null) {
// The Boolean.valueOf(useTCCLStr).booleanValue() formulation // The Boolean.valueOf(useTCCLStr).booleanValue() formulation
// is required for Java 1.2 compatibility. // is required for Java 1.2 compatibility.
if (Boolean.valueOf(useTCCLStr).booleanValue() == false) { if ((useTCCLStr != null) && (Boolean.valueOf(useTCCLStr).booleanValue() == false)) {
// Don't use current context classloader when locating any // Don't use current context classloader when locating any
// LogFactory or Log classes, just use the class that loaded // LogFactory or Log classes, just use the class that loaded
// this abstract class. When this class is deployed in a shared // this abstract class. When this class is deployed in a shared
@@ -472,7 +469,6 @@ public abstract class LogFactory {
baseClassLoader = thisClassLoader; baseClassLoader = thisClassLoader;
} }
} }
}
// Determine which concrete LogFactory subclass to use. // Determine which concrete LogFactory subclass to use.
// First, try a global system property // First, try a global system property

View File

@@ -273,14 +273,12 @@ public class PathableClassLoader extends URLClassLoader {
filename = filename.substring(lastSlash+1); filename = filename.substring(lastSlash+1);
} }
if (filename.startsWith(logicalLib)) {
// ok, this is a candidate // ok, this is a candidate
if (filename.length() < shortestMatchLen) { if (filename.startsWith(logicalLib) && filename.length() < shortestMatchLen) {
shortestMatch = u; shortestMatch = u;
shortestMatchLen = filename.length(); shortestMatchLen = filename.length();
} }
} }
}
return shortestMatch; return shortestMatch;
} }