1
0

If an InvocationTargetException is thrown during the construction of a new

Log instance, unwrap it so that the message on the LogConfigurationException
identifies the actual cause of the problem.

PR:  Bugzilla #26598
Submitted By:  Brian Curnow <bcurnow AT gfs DOT com>


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@139021 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Craig R. McClanahan
2004-03-06 21:25:36 +00:00
parent 8cdc7ae4e4
commit b7a766054f
2 changed files with 16 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ package org.apache.commons.logging.impl;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -62,7 +63,7 @@ import org.apache.commons.logging.LogFactory;
* @author Rod Waldhoff
* @author Craig R. McClanahan
* @author Richard A. Sitze
* @version $Revision: 1.31 $ $Date: 2004/02/28 22:16:16 $
* @version $Revision: 1.32 $ $Date: 2004/03/06 21:25:36 $
*/
public class LogFactoryImpl extends LogFactory {
@@ -510,6 +511,13 @@ public class LogFactoryImpl extends LogFactory {
logMethod.invoke(instance, params);
}
return (instance);
} catch (InvocationTargetException e) {
Throwable c = e.getTargetException();
if (c != null) {
throw new LogConfigurationException(c);
} else {
throw new LogConfigurationException(e);
}
} catch (Throwable t) {
throw new LogConfigurationException(t);
}