1
0

Convert control statement bodies to block.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory
2013-01-13 04:39:03 +00:00
parent d1123e424d
commit 3e255fea93
3 changed files with 54 additions and 22 deletions

View File

@@ -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));
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}