diff --git a/src/java/org/apache/commons/logging/impl/AvalonLogger.java b/src/java/org/apache/commons/logging/impl/AvalonLogger.java index 00c3fe2..b9e7620 100644 --- a/src/java/org/apache/commons/logging/impl/AvalonLogger.java +++ b/src/java/org/apache/commons/logging/impl/AvalonLogger.java @@ -74,8 +74,9 @@ public class AvalonLogger implements Log { * @param name the name of the avalon logger implementation to delegate to */ public AvalonLogger(String name) { - if (defaultLogger == null) + if (defaultLogger == null) { throw new NullPointerException("default logger has to be specified if this constructor is used!"); + } this.logger = defaultLogger.getChildLogger(name); } @@ -106,7 +107,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#debug(Object, Throwable) */ public void debug(Object message, Throwable t) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message), t); + if (getLogger().isDebugEnabled()) { + getLogger().debug(String.valueOf(message), t); + } } /** @@ -116,7 +119,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#debug(Object) */ public void debug(Object message) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message)); + if (getLogger().isDebugEnabled()) { + getLogger().debug(String.valueOf(message)); + } } /** @@ -127,7 +132,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#error(Object, Throwable) */ public void error(Object message, Throwable t) { - if (getLogger().isErrorEnabled()) getLogger().error(String.valueOf(message), t); + if (getLogger().isErrorEnabled()) { + getLogger().error(String.valueOf(message), t); + } } /** @@ -137,7 +144,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#error(Object) */ public void error(Object message) { - if (getLogger().isErrorEnabled()) getLogger().error(String.valueOf(message)); + if (getLogger().isErrorEnabled()) { + getLogger().error(String.valueOf(message)); + } } /** @@ -148,7 +157,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#fatal(Object, Throwable) */ public void fatal(Object message, Throwable t) { - if (getLogger().isFatalErrorEnabled()) getLogger().fatalError(String.valueOf(message), t); + if (getLogger().isFatalErrorEnabled()) { + getLogger().fatalError(String.valueOf(message), t); + } } /** @@ -158,7 +169,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#fatal(Object) */ public void fatal(Object message) { - if (getLogger().isFatalErrorEnabled()) getLogger().fatalError(String.valueOf(message)); + if (getLogger().isFatalErrorEnabled()) { + getLogger().fatalError(String.valueOf(message)); + } } /** @@ -169,7 +182,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#info(Object, Throwable) */ public void info(Object message, Throwable t) { - if (getLogger().isInfoEnabled()) getLogger().info(String.valueOf(message), t); + if (getLogger().isInfoEnabled()) { + getLogger().info(String.valueOf(message), t); + } } /** @@ -179,7 +194,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#info(Object) */ public void info(Object message) { - if (getLogger().isInfoEnabled()) getLogger().info(String.valueOf(message)); + if (getLogger().isInfoEnabled()) { + getLogger().info(String.valueOf(message)); + } } /** @@ -238,7 +255,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#trace(Object, Throwable) */ public void trace(Object message, Throwable t) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message), t); + if (getLogger().isDebugEnabled()) { + getLogger().debug(String.valueOf(message), t); + } } /** @@ -248,7 +267,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#trace(Object) */ public void trace(Object message) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message)); + if (getLogger().isDebugEnabled()) { + getLogger().debug(String.valueOf(message)); + } } /** @@ -259,7 +280,9 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#warn(Object, Throwable) */ public void warn(Object message, Throwable t) { - if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message), t); + if (getLogger().isWarnEnabled()) { + getLogger().warn(String.valueOf(message), t); + } } /** @@ -269,6 +292,8 @@ public class AvalonLogger implements Log { * @see org.apache.commons.logging.Log#warn(Object) */ public void warn(Object message) { - if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message)); + if (getLogger().isWarnEnabled()) { + getLogger().warn(String.valueOf(message)); + } } } diff --git a/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java b/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java index 6bc7690..5f46717 100644 --- a/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java +++ b/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java @@ -739,8 +739,9 @@ public class LogFactoryImpl extends LogFactory { */ private boolean getBooleanConfiguration(String key, boolean dflt) { String val = getConfigurationValue(key); - if (val == null) + if (val == null) { return dflt; + } return Boolean.valueOf(val).booleanValue(); } @@ -1234,19 +1235,22 @@ public class LogFactoryImpl extends LogFactory { private ClassLoader getLowestClassLoader(ClassLoader c1, ClassLoader c2) { // TODO: use AccessController when dealing with classloaders here - if (c1 == null) + if (c1 == null) { return c2; + } - if (c2 == null) + if (c2 == null) { return c1; + } ClassLoader current; // scan c1's ancestors to find c2 current = c1; while (current != null) { - if (current == c2) + if (current == c2) { return c1; + } // current = current.getParent(); current = getParentClassLoader(current); } @@ -1254,8 +1258,9 @@ public class LogFactoryImpl extends LogFactory { // scan c2's ancestors to find c1 current = c2; while (current != null) { - if (current == c1) + if (current == c1) { return c2; + } // current = current.getParent(); current = getParentClassLoader(current); } diff --git a/src/test/org/apache/commons/logging/log4j/log4j12/TestAppender.java b/src/test/org/apache/commons/logging/log4j/log4j12/TestAppender.java index 8b118a2..0ffc086 100644 --- a/src/test/org/apache/commons/logging/log4j/log4j12/TestAppender.java +++ b/src/test/org/apache/commons/logging/log4j/log4j12/TestAppender.java @@ -54,15 +54,17 @@ public class TestAppender extends AppenderSkeleton { lev.level = event.getLevel().toString(); - if (event.getMessage() == null) + if (event.getMessage() == null) { lev.msg = null; - else + } else { lev.msg = event.getMessage().toString(); + } - if (event.getThrowableInformation() == null) + if (event.getThrowableInformation() == null) { lev.throwable = null; - else + } else { lev.throwable = event.getThrowableInformation().getThrowable(); + } events.add(lev); }