1
0

* Fix minor syntax error in previous checkin (oops).

* Improve error message when custom LogFactory class cannot be instantiated due
to class cast issues.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@381886 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Kitching
2006-03-01 03:11:41 +00:00
parent 497c9ae5f1
commit d6dfbd01eb

View File

@@ -465,7 +465,7 @@ public abstract class LogFactory {
+ "]. Trying alternative implementations...");
}
; // ignore
} catch(Exception e) {
} catch(RuntimeException e) {
// This is not consistent with the behaviour when a bad LogFactory class is
// specified in a services file.
//
@@ -1096,15 +1096,23 @@ public abstract class LogFactory {
// ignore exception, continue
} catch(ClassCastException e) {
if (classLoader == thisClassLoader) {
// This cast exception is not due to classloader issues;
// the specified class *really* doesn't extend the
// required LogFactory base class.
// There's no point in falling through to the code below that
// tries again with thisClassLoader, because we've just tried
// loading with that loader (not the TCCL). Just throw an
// appropriate exception here.
String msg =
"Class '" + factoryClass + "' cannot be converted to '"
+ LogFactory.class.getName() + "'."
+ " Perhaps you have multiple copies of LogFactory in "
+ " the classpath?";
if (isDiagnosticsEnabled()) {
logDiagnostic(
"Class '" + factoryClass + "' really does not extend '"
+ LogFactory.class.getName() + "'");
logDiagnostic(msg);
}
throw e;
ClassCastException ex = new ClassCastException(msg);
throw ex;
}
// Ignore exception, continue. Presumably the classloader was the