1
0

Prevent potential null-pointer access warning.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432679 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart
2013-01-13 17:58:20 +00:00
parent cf973028d8
commit 3a6a6f49ad

View File

@@ -940,16 +940,11 @@ public class LogFactoryImpl extends LogFactory {
* and instantiate an instance of Log. * and instantiate an instance of Log.
* *
* @param logAdapterClassName classname of the Log implementation * @param logAdapterClassName classname of the Log implementation
* * @param logCategory argument to pass to the Log implementation's constructor
* @param logCategory argument to pass to the Log implementation's
* constructor
*
* @param affectState <code>true</code> if this object's state should * @param affectState <code>true</code> if this object's state should
* be affected by this method call, <code>false</code> otherwise. * be affected by this method call, <code>false</code> otherwise.
*
* @return an instance of the given class, or null if the logging * @return an instance of the given class, or null if the logging
* library associated with the specified adapter is not available. * library associated with the specified adapter is not available.
*
* @throws LogConfigurationException if there was a serious error with * @throws LogConfigurationException if there was a serious error with
* configuration and the handleFlawedDiscovery method decided this * configuration and the handleFlawedDiscovery method decided this
* problem was fatal. * problem was fatal.
@@ -1090,15 +1085,14 @@ public class LogFactoryImpl extends LogFactory {
currentCL = getParentClassLoader(currentCL); currentCL = getParentClassLoader(currentCL);
} }
if (logAdapter != null && affectState) { if (logAdapterClass != null && affectState) {
// We've succeeded, so set instance fields // We've succeeded, so set instance fields
this.logClassName = logAdapterClassName; this.logClassName = logAdapterClassName;
this.logConstructor = constructor; this.logConstructor = constructor;
// Identify the <code>setLogFactory</code> method (if there is one) // Identify the <code>setLogFactory</code> method (if there is one)
try { try {
this.logMethod = logAdapterClass.getMethod("setLogFactory", this.logMethod = logAdapterClass.getMethod("setLogFactory", logMethodSignature);
logMethodSignature);
logDiagnostic("Found method setLogFactory(LogFactory) in '" + logAdapterClassName + "'"); logDiagnostic("Found method setLogFactory(LogFactory) in '" + logAdapterClassName + "'");
} catch (Throwable t) { } catch (Throwable t) {
this.logMethod = null; this.logMethod = null;