1
0

Remove unnecessary parentheses.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory
2013-01-11 13:02:50 +00:00
parent 663137e8f0
commit 268b725476
15 changed files with 54 additions and 54 deletions

View File

@@ -60,7 +60,7 @@ public class LogConfigurationException extends RuntimeException {
*/ */
public LogConfigurationException(Throwable cause) { public LogConfigurationException(Throwable cause) {
this((cause == null) ? null : cause.toString(), cause); this(cause == null ? null : cause.toString(), cause);
} }
@@ -90,7 +90,7 @@ public class LogConfigurationException extends RuntimeException {
*/ */
public Throwable getCause() { public Throwable getCause() {
return (this.cause); return this.cause;
} }

View File

@@ -683,7 +683,7 @@ public abstract class LogFactory {
public static Log getLog(Class clazz) public static Log getLog(Class clazz)
throws LogConfigurationException { throws LogConfigurationException {
return (getFactory().getInstance(clazz)); return getFactory().getInstance(clazz);
} }
@@ -702,7 +702,7 @@ public abstract class LogFactory {
public static Log getLog(String name) public static Log getLog(String name)
throws LogConfigurationException { throws LogConfigurationException {
return (getFactory().getInstance(name)); return getFactory().getInstance(name);
} }

View File

@@ -84,8 +84,8 @@ public class LogSource {
// Is JDK 1.4 Logging Available? // Is JDK 1.4 Logging Available?
try { try {
jdk14IsAvailable = (null != Class.forName("java.util.logging.Logger")) && jdk14IsAvailable = null != Class.forName("java.util.logging.Logger") &&
(null != Class.forName("org.apache.commons.logging.impl.Jdk14Logger")); null != Class.forName("org.apache.commons.logging.impl.Jdk14Logger");
} catch (Throwable t) { } catch (Throwable t) {
jdk14IsAvailable = false; jdk14IsAvailable = false;
} }
@@ -185,7 +185,7 @@ public class LogSource {
/** Get a <code>Log</code> instance by class name */ /** Get a <code>Log</code> instance by class name */
static public Log getInstance(String name) { static public Log getInstance(String name) {
Log log = (Log) (logs.get(name)); Log log = (Log) logs.get(name);
if (null == log) { if (null == log) {
log = makeNewLogInstance(name); log = makeNewLogInstance(name);
logs.put(name, log); logs.put(name, log);
@@ -229,7 +229,7 @@ public class LogSource {
Log log; Log log;
try { try {
Object[] args = { name }; Object[] args = { name };
log = (Log) (logImplctor.newInstance(args)); log = (Log) logImplctor.newInstance(args);
} catch (Throwable t) { } catch (Throwable t) {
log = null; log = null;
} }
@@ -246,7 +246,7 @@ public class LogSource {
* all logs known to me. * all logs known to me.
*/ */
static public String[] getLogNames() { static public String[] getLogNames() {
return (String[]) (logs.keySet().toArray(new String[logs.size()])); return (String[]) logs.keySet().toArray(new String[logs.size()]);
} }

View File

@@ -211,7 +211,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
if (logger == null) { if (logger == null) {
logger = Logger.getLogger(name); logger = Logger.getLogger(name);
} }
return (logger); return logger;
} }
@@ -242,7 +242,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
* Is debug logging currently enabled? * Is debug logging currently enabled?
*/ */
public boolean isDebugEnabled() { public boolean isDebugEnabled() {
return (getLogger().isLoggable(Level.FINE)); return getLogger().isLoggable(Level.FINE);
} }
@@ -250,7 +250,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
* Is error logging currently enabled? * Is error logging currently enabled?
*/ */
public boolean isErrorEnabled() { public boolean isErrorEnabled() {
return (getLogger().isLoggable(Level.SEVERE)); return getLogger().isLoggable(Level.SEVERE);
} }
@@ -258,7 +258,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
* Is fatal logging currently enabled? * Is fatal logging currently enabled?
*/ */
public boolean isFatalEnabled() { public boolean isFatalEnabled() {
return (getLogger().isLoggable(Level.SEVERE)); return getLogger().isLoggable(Level.SEVERE);
} }
@@ -266,7 +266,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
* Is info logging currently enabled? * Is info logging currently enabled?
*/ */
public boolean isInfoEnabled() { public boolean isInfoEnabled() {
return (getLogger().isLoggable(Level.INFO)); return getLogger().isLoggable(Level.INFO);
} }
@@ -274,7 +274,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
* Is trace logging currently enabled? * Is trace logging currently enabled?
*/ */
public boolean isTraceEnabled() { public boolean isTraceEnabled() {
return (getLogger().isLoggable(Level.FINEST)); return getLogger().isLoggable(Level.FINEST);
} }
@@ -282,7 +282,7 @@ public class Jdk13LumberjackLogger implements Log, Serializable {
* Is warn logging currently enabled? * Is warn logging currently enabled?
*/ */
public boolean isWarnEnabled() { public boolean isWarnEnabled() {
return (getLogger().isLoggable(Level.WARNING)); return getLogger().isLoggable(Level.WARNING);
} }

View File

@@ -180,7 +180,7 @@ public class Jdk14Logger implements Log, Serializable {
if (logger == null) { if (logger == null) {
logger = Logger.getLogger(name); logger = Logger.getLogger(name);
} }
return (logger); return logger;
} }
@@ -211,7 +211,7 @@ public class Jdk14Logger implements Log, Serializable {
* Is debug logging currently enabled? * Is debug logging currently enabled?
*/ */
public boolean isDebugEnabled() { public boolean isDebugEnabled() {
return (getLogger().isLoggable(Level.FINE)); return getLogger().isLoggable(Level.FINE);
} }
@@ -219,7 +219,7 @@ public class Jdk14Logger implements Log, Serializable {
* Is error logging currently enabled? * Is error logging currently enabled?
*/ */
public boolean isErrorEnabled() { public boolean isErrorEnabled() {
return (getLogger().isLoggable(Level.SEVERE)); return getLogger().isLoggable(Level.SEVERE);
} }
@@ -227,7 +227,7 @@ public class Jdk14Logger implements Log, Serializable {
* Is fatal logging currently enabled? * Is fatal logging currently enabled?
*/ */
public boolean isFatalEnabled() { public boolean isFatalEnabled() {
return (getLogger().isLoggable(Level.SEVERE)); return getLogger().isLoggable(Level.SEVERE);
} }
@@ -235,7 +235,7 @@ public class Jdk14Logger implements Log, Serializable {
* Is info logging currently enabled? * Is info logging currently enabled?
*/ */
public boolean isInfoEnabled() { public boolean isInfoEnabled() {
return (getLogger().isLoggable(Level.INFO)); return getLogger().isLoggable(Level.INFO);
} }
@@ -243,7 +243,7 @@ public class Jdk14Logger implements Log, Serializable {
* Is trace logging currently enabled? * Is trace logging currently enabled?
*/ */
public boolean isTraceEnabled() { public boolean isTraceEnabled() {
return (getLogger().isLoggable(Level.FINEST)); return getLogger().isLoggable(Level.FINEST);
} }
@@ -251,7 +251,7 @@ public class Jdk14Logger implements Log, Serializable {
* Is warn logging currently enabled? * Is warn logging currently enabled?
*/ */
public boolean isWarnEnabled() { public boolean isWarnEnabled() {
return (getLogger().isLoggable(Level.WARNING)); return getLogger().isLoggable(Level.WARNING);
} }

View File

@@ -273,7 +273,7 @@ public class Log4JLogger implements Log, Serializable {
if (logger == null) { if (logger == null) {
logger = Logger.getLogger(name); logger = Logger.getLogger(name);
} }
return (this.logger); return this.logger;
} }

View File

@@ -268,7 +268,7 @@ public class LogFactoryImpl extends LogFactory {
*/ */
public Object getAttribute(String name) { public Object getAttribute(String name) {
return (attributes.get(name)); return attributes.get(name);
} }
@@ -294,7 +294,7 @@ public class LogFactoryImpl extends LogFactory {
*/ */
public Log getInstance(Class clazz) throws LogConfigurationException { public Log getInstance(Class clazz) throws LogConfigurationException {
return (getInstance(clazz.getName())); return getInstance(clazz.getName());
} }
@@ -323,7 +323,7 @@ public class LogFactoryImpl extends LogFactory {
instance = newInstance(name); instance = newInstance(name);
instances.put(name, instance); instances.put(name, instance);
} }
return (instance); return instance;
} }
@@ -600,7 +600,7 @@ public class LogFactoryImpl extends LogFactory {
logMethod.invoke(instance, params); logMethod.invoke(instance, params);
} }
return (instance); return instance;
} catch (LogConfigurationException lce) { } catch (LogConfigurationException lce) {
@@ -891,7 +891,7 @@ public class LogFactoryImpl extends LogFactory {
"No user-specified Log implementation; performing discovery" + "No user-specified Log implementation; performing discovery" +
" using the standard supported logging implementations..."); " using the standard supported logging implementations...");
} }
for(int i=0; (i<classesToDiscover.length) && (result == null); ++i) { for(int i=0; i<classesToDiscover.length && result == null; ++i) {
result = createLogFromClass(classesToDiscover[i], logCategory, true); result = createLogFromClass(classesToDiscover[i], logCategory, true);
} }
@@ -1168,7 +1168,7 @@ public class LogFactoryImpl extends LogFactory {
currentCL = getParentClassLoader(currentCL); currentCL = getParentClassLoader(currentCL);
} }
if ((logAdapter != null) && affectState) { if (logAdapter != null && affectState) {
// We've succeeded, so set instance fields // We've succeeded, so set instance fields
this.logClassName = logAdapterClassName; this.logClassName = logAdapterClassName;
this.logConstructor = constructor; this.logConstructor = constructor;

View File

@@ -77,7 +77,7 @@ public class LogKitLogger implements Log, Serializable {
if (logger == null) { if (logger == null) {
logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name); logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
} }
return (logger); return logger;
} }

View File

@@ -128,10 +128,10 @@ public class SimpleLog implements Log, Serializable {
public static final int LOG_LEVEL_FATAL = 6; public static final int LOG_LEVEL_FATAL = 6;
/** Enable all logging levels */ /** Enable all logging levels */
public static final int LOG_LEVEL_ALL = (LOG_LEVEL_TRACE - 1); public static final int LOG_LEVEL_ALL = LOG_LEVEL_TRACE - 1;
/** Enable no logging levels */ /** Enable no logging levels */
public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1); public static final int LOG_LEVEL_OFF = LOG_LEVEL_FATAL + 1;
// ------------------------------------------------------------ Initializer // ------------------------------------------------------------ Initializer
@@ -142,17 +142,17 @@ public class SimpleLog implements Log, Serializable {
} catch (SecurityException e) { } catch (SecurityException e) {
// Ignore // Ignore
} }
return (prop == null) ? simpleLogProps.getProperty(name) : prop; return prop == null ? simpleLogProps.getProperty(name) : prop;
} }
private static String getStringProperty(String name, String dephault) { private static String getStringProperty(String name, String dephault) {
String prop = getStringProperty(name); String prop = getStringProperty(name);
return (prop == null) ? dephault : prop; return prop == null ? dephault : prop;
} }
private static boolean getBooleanProperty(String name, boolean dephault) { private static boolean getBooleanProperty(String name, boolean dephault) {
String prop = getStringProperty(name); String prop = getStringProperty(name);
return (prop == null) ? dephault : "true".equalsIgnoreCase(prop); return prop == null ? dephault : "true".equalsIgnoreCase(prop);
} }
// Initialize class attributes. // Initialize class attributes.
@@ -364,7 +364,7 @@ public class SimpleLog implements Log, Serializable {
protected boolean isLevelEnabled(int logLevel) { protected boolean isLevelEnabled(int logLevel) {
// log level are numerically ordered so can use simple numeric // log level are numerically ordered so can use simple numeric
// comparison // comparison
return (logLevel >= currentLogLevel); return logLevel >= currentLogLevel;
} }

View File

@@ -240,7 +240,7 @@ public final class WeakHashtable extends Hashtable {
changeCount = 0; changeCount = 0;
} }
// do a partial purge more often // do a partial purge more often
else if ((changeCount % PARTIAL_PURGE_COUNT) == 0) { else if (changeCount % PARTIAL_PURGE_COUNT == 0) {
purgeOne(); purgeOne();
} }
@@ -280,7 +280,7 @@ public final class WeakHashtable extends Hashtable {
changeCount = 0; changeCount = 0;
} }
// do a partial purge more often // do a partial purge more often
else if ((changeCount % PARTIAL_PURGE_COUNT) == 0) { else if (changeCount % PARTIAL_PURGE_COUNT == 0) {
purgeOne(); purgeOne();
} }
return super.remove(new Referenced(key)); return super.remove(new Referenced(key));
@@ -436,7 +436,7 @@ public final class WeakHashtable extends Hashtable {
Object thisKeyValue = getValue(); Object thisKeyValue = getValue();
Object otherKeyValue = otherKey.getValue(); Object otherKeyValue = otherKey.getValue();
if (thisKeyValue == null) { if (thisKeyValue == null) {
result = (otherKeyValue == null); result = otherKeyValue == null;
// Since our hashcode was calculated from the original // Since our hashcode was calculated from the original
// non-null referant, the above check breaks the // non-null referant, the above check breaks the
@@ -444,7 +444,7 @@ public final class WeakHashtable extends Hashtable {
// objects could test equal but have different hashcodes. // objects could test equal but have different hashcodes.
// We can reduce (not eliminate) the chance of this // We can reduce (not eliminate) the chance of this
// happening by comparing hashcodes. // happening by comparing hashcodes.
result = result && (this.hashCode() == otherKey.hashCode()); result = result && this.hashCode() == otherKey.hashCode();
// In any case, as our c'tor does not allow null referants // In any case, as our c'tor does not allow null referants
// and Hashtable does not do equality checks between // and Hashtable does not do equality checks between
// existing keys, normal hashtable operations should never // existing keys, normal hashtable operations should never

View File

@@ -270,7 +270,7 @@ public class WeakHashtableTest extends TestCase {
public void run() { public void run() {
for (int i = 0; i < RUN_LOOPS; i++) { for (int i = 0; i < RUN_LOOPS; i++) {
hashtable.put("key" + ":" + (i%10), Boolean.TRUE); hashtable.put("key" + ":" + i%10, Boolean.TRUE);
if(i%50 == 0) { if(i%50 == 0) {
yield(); yield();
} }

View File

@@ -46,7 +46,7 @@ public class TestHandler extends Handler {
public Iterator records() { public Iterator records() {
return (records.iterator()); return records.iterator();
} }

View File

@@ -170,22 +170,22 @@ public abstract class StandardTests extends TestCase {
ev = (LogEvent) logEvents.get(0); ev = (LogEvent) logEvents.get(0);
assertEquals("Info message expected", "info", ev.msg); assertEquals("Info message expected", "info", ev.msg);
assertEquals("Info level expected", "INFO", ev.level); assertEquals("Info level expected", "INFO", ev.level);
assertEquals("Exception data incorrect", (ev.throwable!=null), thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(1); ev = (LogEvent) logEvents.get(1);
assertEquals("Warn message expected", "warn", ev.msg); assertEquals("Warn message expected", "warn", ev.msg);
assertEquals("Warn level expected", "WARN", ev.level); assertEquals("Warn level expected", "WARN", ev.level);
assertEquals("Exception data incorrect", (ev.throwable!=null), thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(2); ev = (LogEvent) logEvents.get(2);
assertEquals("Error message expected", "error", ev.msg); assertEquals("Error message expected", "error", ev.msg);
assertEquals("Error level expected", "ERROR", ev.level); assertEquals("Error level expected", "ERROR", ev.level);
assertEquals("Exception data incorrect", (ev.throwable!=null), thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
ev = (LogEvent) logEvents.get(3); ev = (LogEvent) logEvents.get(3);
assertEquals("Fatal message expected", "fatal", ev.msg); assertEquals("Fatal message expected", "fatal", ev.msg);
assertEquals("Fatal level expected", "FATAL", ev.level); assertEquals("Fatal level expected", "FATAL", ev.level);
assertEquals("Exception data incorrect", (ev.throwable!=null), thrown); assertEquals("Exception data incorrect", ev.throwable!=null, thrown);
} }

View File

@@ -73,7 +73,7 @@ public class TestAppender extends AppenderSkeleton {
public boolean requiresLayout() { public boolean requiresLayout() {
return (false); return false;
} }

View File

@@ -43,27 +43,27 @@ public class DecoratedSimpleLog extends SimpleLog {
// ------------------------------------------------------------- Properties // ------------------------------------------------------------- Properties
public DateFormat getDateTimeFormatter() { public DateFormat getDateTimeFormatter() {
return (dateFormatter); return dateFormatter;
} }
public String getDateTimeFormat() { public String getDateTimeFormat() {
return (dateTimeFormat); return dateTimeFormat;
} }
public String getLogName() { public String getLogName() {
return (logName); return logName;
} }
public boolean getShowDateTime() { public boolean getShowDateTime() {
return (showDateTime); return showDateTime;
} }
public boolean getShowShortName() { public boolean getShowShortName() {
return (showShortName); return showShortName;
} }
@@ -94,7 +94,7 @@ public class DecoratedSimpleLog extends SimpleLog {
// Return cache // Return cache
public List getCache() { public List getCache() {
return (this.cache); return this.cache;
} }