mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-05-01 04:34:45 +02:00
checkstyle/pmd/findbugs recommended updates
This commit is contained in:
@@ -30,13 +30,26 @@ import org.slf4j.helpers.MessageFormatter;
|
||||
*/
|
||||
public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
|
||||
/**
|
||||
* A reference to the Ant task used for logging.
|
||||
*/
|
||||
private Task task;
|
||||
|
||||
/**
|
||||
* Constructs an Ant Logger Adapter.
|
||||
*
|
||||
* @param task the Ant Task to use for logging
|
||||
*/
|
||||
public AntLoggerAdapter(Task task) {
|
||||
super();
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current Ant task to use for logging.
|
||||
*
|
||||
* @param task the Ant task to use for logging
|
||||
*/
|
||||
public void setTask(Task task) {
|
||||
this.task = task;
|
||||
}
|
||||
@@ -56,7 +69,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void trace(String format, Object arg) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
task.log(tp.getMessage(), Project.MSG_VERBOSE);
|
||||
}
|
||||
}
|
||||
@@ -64,7 +77,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void trace(String format, Object arg1, Object arg2) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
task.log(tp.getMessage(), Project.MSG_VERBOSE);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +85,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void trace(String format, Object... arguments) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
task.log(tp.getMessage(), Project.MSG_VERBOSE);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +112,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void debug(String format, Object arg) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
task.log(tp.getMessage(), Project.MSG_DEBUG);
|
||||
}
|
||||
}
|
||||
@@ -107,7 +120,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void debug(String format, Object arg1, Object arg2) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
task.log(tp.getMessage(), Project.MSG_DEBUG);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +128,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void debug(String format, Object... arguments) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
task.log(tp.getMessage(), Project.MSG_DEBUG);
|
||||
}
|
||||
}
|
||||
@@ -142,7 +155,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void info(String format, Object arg) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
task.log(tp.getMessage(), Project.MSG_INFO);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +163,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void info(String format, Object arg1, Object arg2) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
task.log(tp.getMessage(), Project.MSG_INFO);
|
||||
}
|
||||
}
|
||||
@@ -158,7 +171,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void info(String format, Object... arguments) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
task.log(tp.getMessage(), Project.MSG_INFO);
|
||||
}
|
||||
}
|
||||
@@ -185,7 +198,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void warn(String format, Object arg) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
task.log(tp.getMessage(), Project.MSG_WARN);
|
||||
}
|
||||
}
|
||||
@@ -193,7 +206,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void warn(String format, Object... arguments) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
task.log(tp.getMessage(), Project.MSG_WARN);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +214,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void warn(String format, Object arg1, Object arg2) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
task.log(tp.getMessage(), Project.MSG_WARN);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +241,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void error(String format, Object arg) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg);
|
||||
task.log(tp.getMessage(), Project.MSG_ERR);
|
||||
}
|
||||
}
|
||||
@@ -236,7 +249,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void error(String format, Object arg1, Object arg2) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
|
||||
task.log(tp.getMessage(), Project.MSG_ERR);
|
||||
}
|
||||
}
|
||||
@@ -244,7 +257,7 @@ public class AntLoggerAdapter extends MarkerIgnoringBase {
|
||||
@Override
|
||||
public void error(String format, Object... arguments) {
|
||||
if (task != null) {
|
||||
FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
final FormattingTuple tp = MessageFormatter.format(format, arguments);
|
||||
task.log(tp.getMessage(), Project.MSG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,28 @@ import org.slf4j.Logger;
|
||||
*/
|
||||
public class AntLoggerFactory implements ILoggerFactory {
|
||||
|
||||
private AntLoggerAdapter antLoggerAdapter;
|
||||
/**
|
||||
* A reference to the Ant logger Adapter.
|
||||
*/
|
||||
private final AntLoggerAdapter antLoggerAdapter;
|
||||
|
||||
/**
|
||||
* Constructs a new Ant Logger Factory.
|
||||
*
|
||||
* @param task the Ant task to use for logging
|
||||
*/
|
||||
public AntLoggerFactory(Task task) {
|
||||
super();
|
||||
this.antLoggerAdapter = new AntLoggerAdapter(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Ant logger adapter.
|
||||
*
|
||||
* @param name ignored in this implementation
|
||||
* @return the Ant logger adapter
|
||||
*/
|
||||
@Override
|
||||
public Logger getLogger(String name) {
|
||||
return antLoggerAdapter;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
|
||||
/**
|
||||
* Ant tasks have the log method we actually want to call. So we hang onto the task as a delegate
|
||||
*/
|
||||
private Task task;
|
||||
private Task task = null;
|
||||
|
||||
/**
|
||||
* Set the Task which will this is to log through.
|
||||
@@ -67,22 +67,37 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
|
||||
// to avoid constant folding by the compiler, this field must *not* be final
|
||||
public static String REQUESTED_API_VERSION = "1.7.12"; // final
|
||||
|
||||
private static final String loggerFactoryClassStr = AntLoggerFactory.class.getName();
|
||||
private static final String LOGGER_FACTORY_CLASS = AntLoggerFactory.class.getName();
|
||||
|
||||
/**
|
||||
* The ILoggerFactory instance returned by the {@link #getLoggerFactory} method should always be the smae object
|
||||
*/
|
||||
private ILoggerFactory loggerFactory;
|
||||
|
||||
/**
|
||||
* Constructs a new static logger binder.
|
||||
*/
|
||||
private StaticLoggerBinder() {
|
||||
loggerFactory = new AntLoggerFactory(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the logger factory.
|
||||
*
|
||||
* @return the logger factory
|
||||
*/
|
||||
@Override
|
||||
public ILoggerFactory getLoggerFactory() {
|
||||
return loggerFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the logger factory class string.
|
||||
*
|
||||
* @return the logger factory class string
|
||||
*/
|
||||
@Override
|
||||
public String getLoggerFactoryClassStr() {
|
||||
return loggerFactoryClassStr;
|
||||
return LOGGER_FACTORY_CLASS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user