mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-21 00:29:21 +01:00
Removed i18n for SLF4J logging as it was preventing build on jdk1.6
This commit is contained in:
@@ -31,11 +31,10 @@ import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
|||||||
import org.owasp.dependencycheck.dependency.Confidence;
|
import org.owasp.dependencycheck.dependency.Confidence;
|
||||||
import org.owasp.dependencycheck.dependency.Dependency;
|
import org.owasp.dependencycheck.dependency.Dependency;
|
||||||
import org.owasp.dependencycheck.dependency.Evidence;
|
import org.owasp.dependencycheck.dependency.Evidence;
|
||||||
import org.owasp.dependencycheck.utils.DCResources;
|
|
||||||
import org.owasp.dependencycheck.utils.FileFilterBuilder;
|
import org.owasp.dependencycheck.utils.FileFilterBuilder;
|
||||||
import org.owasp.dependencycheck.utils.Settings;
|
import org.owasp.dependencycheck.utils.Settings;
|
||||||
import org.slf4j.cal10n.LocLogger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.cal10n.LocLoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
@@ -80,14 +79,10 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
* Message Conveyer
|
* Message Conveyer
|
||||||
*/
|
*/
|
||||||
private static final IMessageConveyor MESSAGE_CONVERYOR = new MessageConveyor(Locale.getDefault());
|
private static final IMessageConveyor MESSAGE_CONVERYOR = new MessageConveyor(Locale.getDefault());
|
||||||
/**
|
|
||||||
* LocLoggerFactory for localized logger
|
|
||||||
*/
|
|
||||||
private static final LocLoggerFactory LLFACTORY = new LocLoggerFactory(MESSAGE_CONVERYOR);
|
|
||||||
/**
|
/**
|
||||||
* Logger
|
* 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
|
* Builds the beginnings of a List for ProcessBuilder
|
||||||
@@ -120,7 +115,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
public void analyzeFileType(Dependency dependency, Engine engine)
|
public void analyzeFileType(Dependency dependency, Engine engine)
|
||||||
throws AnalysisException {
|
throws AnalysisException {
|
||||||
if (grokAssemblyExe == null) {
|
if (grokAssemblyExe == null) {
|
||||||
LOGGER.warn(DCResources.NOTDEPLOYED);
|
LOGGER.warn("GrokAssembly didn't get deployed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +131,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
String line = null;
|
String line = null;
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
while (rdr.ready() && (line = rdr.readLine()) != null) {
|
while (rdr.ready() && (line = rdr.readLine()) != null) {
|
||||||
LOGGER.warn(DCResources.GROKERROR, line);
|
LOGGER.warn("Error from GrokAssembly: {}", line);
|
||||||
}
|
}
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -148,10 +143,11 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rc == 3) {
|
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;
|
return;
|
||||||
} else if (rc != 0) {
|
} else if (rc != 0) {
|
||||||
LOGGER.warn(DCResources.GROKRC, rc);
|
LOGGER.warn("Return code {} from GrokAssembly", rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
final XPath xpath = XPathFactory.newInstance().newXPath();
|
final XPath xpath = XPathFactory.newInstance().newXPath();
|
||||||
@@ -219,10 +215,10 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
grokAssemblyExe = tempFile;
|
grokAssemblyExe = tempFile;
|
||||||
// Set the temp file to get deleted when we're done
|
// Set the temp file to get deleted when we're done
|
||||||
grokAssemblyExe.deleteOnExit();
|
grokAssemblyExe.deleteOnExit();
|
||||||
LOGGER.debug(DCResources.GROKDEPLOYED, grokAssemblyExe.getPath());
|
LOGGER.debug("Extracted GrokAssembly.exe to {}", grokAssemblyExe.getPath());
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
this.setEnabled(false);
|
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);
|
throw new AnalysisException("Could not extract GrokAssembly.exe", ioe);
|
||||||
} finally {
|
} finally {
|
||||||
if (fos != null) {
|
if (fos != null) {
|
||||||
@@ -268,8 +264,9 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
if (e instanceof AnalysisException) {
|
if (e instanceof AnalysisException) {
|
||||||
throw (AnalysisException) e;
|
throw (AnalysisException) e;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn(DCResources.GROKINITFAIL);
|
LOGGER.warn("An error occurred with the .NET AssemblyAnalyzer;\n" +
|
||||||
LOGGER.debug(DCResources.GROKINITMSG, e.getMessage());
|
"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);
|
this.setEnabled(false);
|
||||||
throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e);
|
throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer", e);
|
||||||
}
|
}
|
||||||
@@ -298,7 +295,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
grokAssemblyExe.deleteOnExit();
|
grokAssemblyExe.deleteOnExit();
|
||||||
}
|
}
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
LOGGER.debug(DCResources.GROKNOTDELETED);
|
LOGGER.debug("Can't delete temporary GrokAssembly.exe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user