diff --git a/src/java/org/apache/commons/logging/LogFactory.java b/src/java/org/apache/commons/logging/LogFactory.java index a1b8a8f..13f8ea3 100644 --- a/src/java/org/apache/commons/logging/LogFactory.java +++ b/src/java/org/apache/commons/logging/LogFactory.java @@ -380,6 +380,14 @@ public abstract class LogFactory { // --------------------------------------------------------- Static Methods + /** Utility method to safely trim a string. */ + private static String trim(String src) { + if (src == null) { + return null; + } + return src.trim(); + } + /** *
Construct (if necessary) and return a LogFactory
* instance, using the following ordered lookup procedure to determine
@@ -499,7 +507,7 @@ public abstract class LogFactory {
logDiagnostic(
"[LOOKUP] A security exception occurred while trying to create an"
+ " instance of the custom factory class"
- + ": [" + e.getMessage().trim()
+ + ": [" + trim(e.getMessage())
+ "]. Trying alternative implementations...");
}
; // ignore
@@ -513,7 +521,7 @@ public abstract class LogFactory {
logDiagnostic(
"[LOOKUP] An exception occurred while trying to create an"
+ " instance of the custom factory class"
- + ": [" + e.getMessage().trim()
+ + ": [" + trim(e.getMessage())
+ "] as specified by a system property.");
}
throw e;
@@ -576,7 +584,7 @@ public abstract class LogFactory {
logDiagnostic(
"[LOOKUP] A security exception occurred while trying to create an"
+ " instance of the custom factory class"
- + ": [" + ex.getMessage().trim()
+ + ": [" + trim(ex.getMessage())
+ "]. Trying alternative implementations...");
}
; // ignore