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,13 +419,11 @@ 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 (contextClassLoader == null && isDiagnosticsEnabled()) {
if (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
@@ -458,19 +456,17 @@ 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 ((useTCCLStr != null) && (Boolean.valueOf(useTCCLStr).booleanValue() == false)) {
if (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 // classpath of a container, it means webapps cannot deploy their
// classpath of a container, it means webapps cannot deploy their // own logging implementations. It also means that it is up to the
// own logging implementations. It also means that it is up to the // implementation whether to load library-specific config files
// implementation whether to load library-specific config files // from the TCCL or not.
// from the TCCL or not. baseClassLoader = thisClassLoader;
baseClassLoader = thisClassLoader;
}
} }
} }

View File

@@ -273,12 +273,10 @@ 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.startsWith(logicalLib) && filename.length() < shortestMatchLen) {
if (filename.length() < shortestMatchLen) { shortestMatch = u;
shortestMatch = u; shortestMatchLen = filename.length();
shortestMatchLen = filename.length();
}
} }
} }