diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporter.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporter.java index 03c0313fc9..5d7da3ef77 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporter.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporter.java @@ -6,7 +6,6 @@ package net.sourceforge.pmd.lang.ast; import java.text.MessageFormat; -import org.slf4j.Logger; import org.slf4j.event.Level; import net.sourceforge.pmd.util.StringUtil; @@ -90,7 +89,7 @@ public interface SemanticErrorReporter { * Forwards to a {@link MessageReporter}, except trace and debug * messages which are reported on a logger. */ - static SemanticErrorReporter reportToLogger(MessageReporter reporter, Logger logger) { + static SemanticErrorReporter reportToLogger(MessageReporter reporter) { return new SemanticErrorReporter() { private boolean hasError = false; @@ -105,11 +104,7 @@ public interface SemanticErrorReporter { private String logMessage(Level level, Node location, String message, Object[] args) { String fullMessage = makeMessage(location, message, args); - if (level.compareTo(Level.INFO) > 0) { - logger.atLevel(level).log(fullMessage); - } else { - reporter.log(level, StringUtil.quoteMessageFormat(fullMessage)); // already formatted - } + reporter.log(level, StringUtil.quoteMessageFormat(fullMessage)); // already formatted return fullMessage; } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/processor/PmdRunnable.java b/pmd-core/src/main/java/net/sourceforge/pmd/processor/PmdRunnable.java index 20173a5247..667ac21f88 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/processor/PmdRunnable.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/processor/PmdRunnable.java @@ -129,7 +129,7 @@ abstract class PmdRunnable implements Runnable { LanguageVersion languageVersion, String filename) throws FileAnalysisException { - SemanticErrorReporter reporter = SemanticErrorReporter.reportToLogger(configuration.getReporter(), LOG); + SemanticErrorReporter reporter = SemanticErrorReporter.reportToLogger(configuration.getReporter()); ParserTask task = new ParserTask( languageVersion, filename, diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporterTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporterTest.java index 90e2952100..c6ca31b805 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporterTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporterTest.java @@ -45,7 +45,7 @@ public class SemanticErrorReporterTest { @Test public void testErrorLogging() { - SemanticErrorReporter reporter = SemanticErrorReporter.reportToLogger(mockReporter, mockLogger); + SemanticErrorReporter reporter = SemanticErrorReporter.reportToLogger(mockReporter); RootNode node = parseMockNode(reporter); assertFalse(reporter.hasError()); @@ -61,7 +61,7 @@ public class SemanticErrorReporterTest { @Test public void testEscaping() { - SemanticErrorReporter reporter = SemanticErrorReporter.reportToLogger(mockReporter, mockLogger); + SemanticErrorReporter reporter = SemanticErrorReporter.reportToLogger(mockReporter); RootNode node = parseMockNode(reporter); // this is a MessageFormat string diff --git a/pmd-html/src/main/java/net/sourceforge/pmd/lang/html/ast/HtmlTokenizer.java b/pmd-html/src/main/java/net/sourceforge/pmd/lang/html/ast/HtmlTokenizer.java index f99793cb55..94a3e7d205 100644 --- a/pmd-html/src/main/java/net/sourceforge/pmd/lang/html/ast/HtmlTokenizer.java +++ b/pmd-html/src/main/java/net/sourceforge/pmd/lang/html/ast/HtmlTokenizer.java @@ -4,9 +4,6 @@ package net.sourceforge.pmd.lang.html.ast; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import net.sourceforge.pmd.cpd.SourceCode; import net.sourceforge.pmd.cpd.TokenEntry; import net.sourceforge.pmd.cpd.Tokenizer; @@ -17,7 +14,6 @@ import net.sourceforge.pmd.lang.ast.SemanticErrorReporter; import net.sourceforge.pmd.lang.html.HtmlLanguageModule; public class HtmlTokenizer implements Tokenizer { - private static final Logger LOG = LoggerFactory.getLogger(HtmlTokenizer.class); @Override public void tokenize(SourceCode sourceCode, Tokens tokenEntries) { @@ -25,7 +21,7 @@ public class HtmlTokenizer implements Tokenizer { LanguageRegistry.getLanguage(HtmlLanguageModule.NAME).getDefaultVersion(), sourceCode.getFileName(), sourceCode.getCodeBuffer().toString(), - SemanticErrorReporter.reportToLogger(LOG) + SemanticErrorReporter.noop() // todo ); HtmlParser parser = new HtmlParser(); diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaParsingHelper.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaParsingHelper.java index f6df0c19c9..3e2028b96e 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaParsingHelper.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaParsingHelper.java @@ -125,7 +125,7 @@ public class JavaParsingHelper extends BaseParsingHelper