1
0

Add some JavaDocs.

Correct JavaDocs.
Replace tab-characters with spaces.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@399225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dennis Lundberg
2006-05-03 09:29:00 +00:00
parent 96854d71f6
commit 04305e4cc5

View File

@@ -139,7 +139,7 @@ public abstract class LogFactory {
* <strong>Note:</strong> <code>LogFactory</code> will print: * <strong>Note:</strong> <code>LogFactory</code> will print:
* <code><pre> * <code><pre>
* [ERROR] LogFactory: Load of custom hashtable failed</em> * [ERROR] LogFactory: Load of custom hashtable failed</em>
* </code></pre> * </pre></code>
* to system error and then continue using a standard Hashtable. * to system error and then continue using a standard Hashtable.
* </p> * </p>
* <p> * <p>
@@ -328,16 +328,16 @@ public abstract class LogFactory {
} catch (Throwable t) { } catch (Throwable t) {
// ignore // ignore
if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) { if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) {
// if the user's trying to set up a custom implementation, give a clue // if the user's trying to set up a custom implementation, give a clue
if (isDiagnosticsEnabled()) { if (isDiagnosticsEnabled()) {
// use internal logging to issue the warning // use internal logging to issue the warning
logDiagnostic("[ERROR] LogFactory: Load of custom hashtable failed"); logDiagnostic("[ERROR] LogFactory: Load of custom hashtable failed");
} else { } else {
// we *really* want this output, even if diagnostics weren't // we *really* want this output, even if diagnostics weren't
// explicitly enabled by the user. // explicitly enabled by the user.
System.err.println("[ERROR] LogFactory: Load of custom hashtable failed"); System.err.println("[ERROR] LogFactory: Load of custom hashtable failed");
} }
} }
} }
if (result == null) { if (result == null) {
result = new Hashtable(); result = new Hashtable();
@@ -571,7 +571,7 @@ public abstract class LogFactory {
} }
factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); factory = newFactory(factoryClass, baseClassLoader, contextClassLoader);
// what about handling an exception from newFactory?? // TODO: think about whether we need to handle exceptions from newFactory
} else { } else {
if (isDiagnosticsEnabled()) { if (isDiagnosticsEnabled()) {
logDiagnostic( logDiagnostic(
@@ -1127,7 +1127,7 @@ public abstract class LogFactory {
// to their native logging system. // to their native logging system.
// //
String msg = String msg =
"The application has specified that a custom LogFactory implementation should be used but " + "The application has specified that a custom LogFactory implementation should be used but " +
"Class '" + factoryClass + "' cannot be converted to '" "Class '" + factoryClass + "' cannot be converted to '"
+ LogFactory.class.getName() + "'. "; + LogFactory.class.getName() + "'. ";
if (implementsLogFactory) { if (implementsLogFactory) {
@@ -1169,7 +1169,7 @@ public abstract class LogFactory {
* classLoader was unable to load factoryClass. * classLoader was unable to load factoryClass.
* *
* In either case, we call Class.forName, which is equivalent * In either case, we call Class.forName, which is equivalent
* to LogFactory.class.getClassLoader.load(name), ie we ignore * to LogFactory.class.getClassLoader().load(name), ie we ignore
* the classloader parameter the caller passed, and fall back * the classloader parameter the caller passed, and fall back
* to trying the classloader associated with this class. See the * to trying the classloader associated with this class. See the
* javadoc for the newFactory method for more info on the * javadoc for the newFactory method for more info on the
@@ -1214,61 +1214,63 @@ public abstract class LogFactory {
* of incompatibility. The test used is whether the class is assignable from * of incompatibility. The test used is whether the class is assignable from
* the <code>LogFactory</code> class loaded by the class's classloader. * the <code>LogFactory</code> class loaded by the class's classloader.
* @param logFactoryClass <code>Class</code> which may implement <code>LogFactory</code> * @param logFactoryClass <code>Class</code> which may implement <code>LogFactory</code>
* @return true if the <code>Class</code> is assignable from the * @return true if the <code>logFactoryClass</code> does extend
* <code>LogFactory</code> when that class is loaded via the same
* classloader that loaded the <code>logFactoryClass</code>.
*/ */
private static boolean implementsLogFactory(Class logFactoryClass) { private static boolean implementsLogFactory(Class logFactoryClass) {
boolean implementsLogFactory = false; boolean implementsLogFactory = false;
if (logFactoryClass != null) { if (logFactoryClass != null) {
try { try {
ClassLoader logFactoryClassLoader = logFactoryClass.getClassLoader(); ClassLoader logFactoryClassLoader = logFactoryClass.getClassLoader();
if (logFactoryClassLoader == null) { if (logFactoryClassLoader == null) {
logDiagnostic("[CUSTOM LOG FACTORY] was loaded by the boot classloader"); logDiagnostic("[CUSTOM LOG FACTORY] was loaded by the boot classloader");
} else { } else {
logHierarchy("[CUSTOM LOG FACTORY] ", logFactoryClassLoader); logHierarchy("[CUSTOM LOG FACTORY] ", logFactoryClassLoader);
Class factoryFromCustomLoader Class factoryFromCustomLoader
= Class.forName("org.apache.commons.logging.LogFactory", false, logFactoryClassLoader); = Class.forName("org.apache.commons.logging.LogFactory", false, logFactoryClassLoader);
implementsLogFactory = factoryFromCustomLoader.isAssignableFrom(logFactoryClass); implementsLogFactory = factoryFromCustomLoader.isAssignableFrom(logFactoryClass);
if (implementsLogFactory) { if (implementsLogFactory) {
logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName() logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName()
+ " implements LogFactory but was loaded by an incompatible classloader."); + " implements LogFactory but was loaded by an incompatible classloader.");
} else { } else {
logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName() logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName()
+ " does not implement LogFactory."); + " does not implement LogFactory.");
} }
} }
} catch (SecurityException e) { } catch (SecurityException e) {
// //
// The application is running within a hostile security environment. // The application is running within a hostile security environment.
// This will make it very hard to diagnose issues with JCL. // This will make it very hard to diagnose issues with JCL.
// Consider running less securely whilst debugging this issue. // Consider running less securely whilst debugging this issue.
// //
logDiagnostic("[CUSTOM LOG FACTORY] SecurityException thrown whilst trying to determine whether " + logDiagnostic("[CUSTOM LOG FACTORY] SecurityException thrown whilst trying to determine whether " +
"the compatibility was caused by a classloader conflict: " "the compatibility was caused by a classloader conflict: "
+ e.getMessage()); + e.getMessage());
} catch (LinkageError e) { } catch (LinkageError e) {
// //
// This should be an unusual circumstance. // This should be an unusual circumstance.
// LinkageError's usually indicate that a dependent class has incompatibly changed. // LinkageError's usually indicate that a dependent class has incompatibly changed.
// Another possibility may be an exception thrown by an initializer. // Another possibility may be an exception thrown by an initializer.
// Time for a clean rebuild? // Time for a clean rebuild?
// //
logDiagnostic("[CUSTOM LOG FACTORY] LinkageError thrown whilst trying to determine whether " + logDiagnostic("[CUSTOM LOG FACTORY] LinkageError thrown whilst trying to determine whether " +
"the compatibility was caused by a classloader conflict: " "the compatibility was caused by a classloader conflict: "
+ e.getMessage()); + e.getMessage());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// //
// LogFactory cannot be loaded by the classloader which loaded the custom factory implementation. // LogFactory cannot be loaded by the classloader which loaded the custom factory implementation.
// The custom implementation is not viable until this is corrected. // The custom implementation is not viable until this is corrected.
// Ensure that the JCL jar and the custom class are available from the same classloader. // Ensure that the JCL jar and the custom class are available from the same classloader.
// Running with diagnostics on should give information about the classloaders used // Running with diagnostics on should give information about the classloaders used
// to load the custom factory. // to load the custom factory.
// //
logDiagnostic("[CUSTOM LOG FACTORY] LogFactory class cannot be loaded by classloader which loaded the " + logDiagnostic("[CUSTOM LOG FACTORY] LogFactory class cannot be loaded by classloader which loaded the " +
"custom LogFactory implementation. Is the custom factory in the right classloader?"); "custom LogFactory implementation. Is the custom factory in the right classloader?");
} }
} }
return implementsLogFactory; return implementsLogFactory;
} }
/** /**
* Applets may run in an environment where accessing resources of a loader is * Applets may run in an environment where accessing resources of a loader is
@@ -1474,7 +1476,7 @@ public abstract class LogFactory {
/** /**
* Determines whether the user wants internal diagnostic output. If so, * Determines whether the user wants internal diagnostic output. If so,
* returns an appropriate writer object. Users can enable diagnostic * returns an appropriate writer object. Users can enable diagnostic
* output by setting the system property named OUTPUT_PROPERTY to * output by setting the system property named DIAGNOSTICS_DEST_PROPERTY to
* a filename, or the special values STDOUT or STDERR. * a filename, or the special values STDOUT or STDERR.
*/ */
private static void initDiagnostics() { private static void initDiagnostics() {