diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java index 17a5ddaf7..3c5a225cf 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/AssemblyAnalyzer.java @@ -31,11 +31,10 @@ import org.owasp.dependencycheck.analyzer.exception.AnalysisException; import org.owasp.dependencycheck.dependency.Confidence; import org.owasp.dependencycheck.dependency.Dependency; import org.owasp.dependencycheck.dependency.Evidence; -import org.owasp.dependencycheck.utils.DCResources; import org.owasp.dependencycheck.utils.FileFilterBuilder; import org.owasp.dependencycheck.utils.Settings; -import org.slf4j.cal10n.LocLogger; -import org.slf4j.cal10n.LocLoggerFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -80,14 +79,10 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { * Message Conveyer */ private static final IMessageConveyor MESSAGE_CONVERYOR = new MessageConveyor(Locale.getDefault()); - /** - * LocLoggerFactory for localized logger - */ - private static final LocLoggerFactory LLFACTORY = new LocLoggerFactory(MESSAGE_CONVERYOR); /** * Logger */ - private static final LocLogger LOGGER = LLFACTORY.getLocLogger(AssemblyAnalyzer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AssemblyAnalyzer.class); /** * Builds the beginnings of a List for ProcessBuilder @@ -120,7 +115,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { if (grokAssemblyExe == null) { - LOGGER.warn(DCResources.NOTDEPLOYED); + LOGGER.warn("GrokAssembly didn't get deployed"); return; } @@ -136,7 +131,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { String line = null; // CHECKSTYLE:OFF while (rdr.ready() && (line = rdr.readLine()) != null) { - LOGGER.warn(DCResources.GROKERROR, line); + LOGGER.warn("Error from GrokAssembly: {}", line); } // CHECKSTYLE:ON int rc = 0; @@ -148,10 +143,11 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { return; } if (rc == 3) { - LOGGER.debug(DCResources.NOTASSEMBLY, dependency.getActualFilePath()); + LOGGER.debug("{} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check", + dependency.getActualFilePath()); return; } else if (rc != 0) { - LOGGER.warn(DCResources.GROKRC, rc); + LOGGER.warn("Return code {} from GrokAssembly", rc); } final XPath xpath = XPathFactory.newInstance().newXPath(); @@ -219,10 +215,10 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { grokAssemblyExe = tempFile; // Set the temp file to get deleted when we're done grokAssemblyExe.deleteOnExit(); - LOGGER.debug(DCResources.GROKDEPLOYED, grokAssemblyExe.getPath()); + LOGGER.debug("Extracted GrokAssembly.exe to {}", grokAssemblyExe.getPath()); } catch (IOException ioe) { this.setEnabled(false); - LOGGER.warn(DCResources.GROKNOTDEPLOYED, ioe.getMessage()); + LOGGER.warn("Could not extract GrokAssembly.exe: {}", ioe.getMessage()); throw new AnalysisException("Could not extract GrokAssembly.exe", ioe); } finally { if (fos != null) { @@ -268,8 +264,9 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { if (e instanceof AnalysisException) { throw (AnalysisException) e; } else { - LOGGER.warn(DCResources.GROKINITFAIL); - LOGGER.debug(DCResources.GROKINITMSG, e.getMessage()); + LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" + + "this can be ignored unless you are scanning .NET DLLs. Please see the log for more details."); + LOGGER.debug("Could not execute GrokAssembly {}", e.getMessage()); this.setEnabled(false); throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e); } @@ -298,7 +295,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer { grokAssemblyExe.deleteOnExit(); } } catch (SecurityException se) { - LOGGER.debug(DCResources.GROKNOTDELETED); + LOGGER.debug("Can't delete temporary GrokAssembly.exe"); } } diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DCResources.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DCResources.java deleted file mode 100644 index e0e8a0540..000000000 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/DCResources.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of dependency-check-ant. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright (c) 2015 The OWASP Foundation. All Rights Reserved. - */ -package org.owasp.dependencycheck.utils; - -import ch.qos.cal10n.BaseName; -import ch.qos.cal10n.Locale; -import ch.qos.cal10n.LocaleData; - -/** - * @author colezlaw - */ -@BaseName("dependencycheck-resources") -@LocaleData(defaultCharset = "UTF-8", - value = { - @Locale("en") - } -) -public enum DCResources { - - /** - * Not deployed. - */ - NOTDEPLOYED, - /** - * grok error. - */ - GROKERROR, - /** - * The dependency is not an assembly. - */ - NOTASSEMBLY, - /** - * GROK Return Code. - */ - GROKRC, - /** - * Grok assembly was extracted. - */ - GROKDEPLOYED, - /** - * Grok assembly was not extracted. - */ - GROKNOTDEPLOYED, - /** - * Grok failed to initialize. - */ - GROKINITFAIL, - /** - * Grok initialized. - */ - GROKINITMSG, - /** - * Grok assembly was not deleted. - */ - GROKNOTDELETED -} diff --git a/dependency-check-core/src/main/resources/dependencycheck-resources.properties b/dependency-check-core/src/main/resources/dependencycheck-resources.properties deleted file mode 100644 index 92a38b666..000000000 --- a/dependency-check-core/src/main/resources/dependencycheck-resources.properties +++ /dev/null @@ -1,10 +0,0 @@ -NOTDEPLOYED=GrokAssembly didn't get deployed -GROKERROR=Error from GrokAssembly: {0} -NOTASSEMBLY={0} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check -GROKRC=Return code {0} from GrokAssembly -GROKDEPLOYED=Extracted GrokAssembly.exe to {0} -GROKNOTDEPLOYED=Could not extract GrokAssembly.exe: {0} -GROKINITFAIL=An error occurred with the .NET AssemblyAnalyzer; \ - this can be ignored unless you are scanning .NET DLLs. Please see the log for more details. -GROKINITMSG=Could not execute GrokAssembly {0} -GROKNOTDELETED=Can't delete temporary GrokAssembly.exe \ No newline at end of file diff --git a/dependency-check-core/src/main/resources/dependencycheck-resources_en.properties b/dependency-check-core/src/main/resources/dependencycheck-resources_en.properties deleted file mode 100644 index 92a38b666..000000000 --- a/dependency-check-core/src/main/resources/dependencycheck-resources_en.properties +++ /dev/null @@ -1,10 +0,0 @@ -NOTDEPLOYED=GrokAssembly didn't get deployed -GROKERROR=Error from GrokAssembly: {0} -NOTASSEMBLY={0} is not a .NET assembly or executable and as such cannot be analyzed by dependency-check -GROKRC=Return code {0} from GrokAssembly -GROKDEPLOYED=Extracted GrokAssembly.exe to {0} -GROKNOTDEPLOYED=Could not extract GrokAssembly.exe: {0} -GROKINITFAIL=An error occurred with the .NET AssemblyAnalyzer; \ - this can be ignored unless you are scanning .NET DLLs. Please see the log for more details. -GROKINITMSG=Could not execute GrokAssembly {0} -GROKNOTDELETED=Can't delete temporary GrokAssembly.exe \ No newline at end of file