mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 17:19:30 +01:00
checkstyle correction
This commit is contained in:
@@ -62,7 +62,19 @@ public class DependencyBundlingAnalyzer extends AbstractAnalyzer {
|
|||||||
/**
|
/**
|
||||||
* a flag indicating if this analyzer has run. This analyzer only runs once.
|
* a flag indicating if this analyzer has run. This analyzer only runs once.
|
||||||
*/
|
*/
|
||||||
boolean analyzed = false;
|
private boolean analyzed = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a flag indicating if this analyzer has run. This analyzer only
|
||||||
|
* runs once. Note this is currently only used in the unit tests.
|
||||||
|
*
|
||||||
|
* @return a flag indicating if this analyzer has run. This analyzer only
|
||||||
|
* runs once
|
||||||
|
*/
|
||||||
|
protected boolean getAnalyzed() {
|
||||||
|
return analyzed;
|
||||||
|
}
|
||||||
|
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
|
//<editor-fold defaultstate="collapsed" desc="All standard implementation details of Analyzer">
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -44,11 +44,14 @@ import org.xml.sax.SAXException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This class is currently unused and if enabled will likely not work on MySQL as the MERGE statement is used.
|
* This class is currently unused and if enabled will likely not work on MySQL
|
||||||
|
* as the MERGE statement is used.
|
||||||
*
|
*
|
||||||
* The CpeUpdater is designed to download the CPE data file from NIST and import the data into the database. However, as this
|
* The CpeUpdater is designed to download the CPE data file from NIST and import
|
||||||
* currently adds no beneficial data, compared to what is in the CPE data contained in the CVE data files, this class is not
|
* the data into the database. However, as this currently adds no beneficial
|
||||||
* currently used. The code is being kept as a future update may utilize more data from the CPE xml files.
|
* data, compared to what is in the CPE data contained in the CVE data files,
|
||||||
|
* this class is not currently used. The code is being kept as a future update
|
||||||
|
* may utilize more data from the CPE XML files.
|
||||||
*
|
*
|
||||||
* @author Jeremy Long
|
* @author Jeremy Long
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +87,8 @@ public class CpeUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
* Downloads the CPE XML file.
|
* Downloads the CPE XML file.
|
||||||
*
|
*
|
||||||
* @return the file reference to the CPE.xml file
|
* @return the file reference to the CPE.xml file
|
||||||
* @throws UpdateException thrown if there is an issue downloading the XML file
|
* @throws UpdateException thrown if there is an issue downloading the XML
|
||||||
|
* file
|
||||||
*/
|
*/
|
||||||
private File downloadCpe() throws UpdateException {
|
private File downloadCpe() throws UpdateException {
|
||||||
File xml;
|
File xml;
|
||||||
@@ -112,13 +116,14 @@ public class CpeUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
*
|
*
|
||||||
* @param xml the CPE data file
|
* @param xml the CPE data file
|
||||||
* @return the list of CPE entries
|
* @return the list of CPE entries
|
||||||
* @throws UpdateException thrown if there is an issue with parsing the XML file
|
* @throws UpdateException thrown if there is an issue with parsing the XML
|
||||||
|
* file
|
||||||
*/
|
*/
|
||||||
private List<Cpe> processXML(final File xml) throws UpdateException {
|
private List<Cpe> processXML(final File xml) throws UpdateException {
|
||||||
try {
|
try {
|
||||||
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
final SAXParser saxParser = factory.newSAXParser();
|
final SAXParser saxParser = factory.newSAXParser();
|
||||||
final CPEHandler handler = new CPEHandler();
|
final CPEHandler handler = new CPEHandler();
|
||||||
saxParser.parse(xml, handler);
|
saxParser.parse(xml, handler);
|
||||||
return handler.getData();
|
return handler.getData();
|
||||||
@@ -132,7 +137,8 @@ public class CpeUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to find the last time the CPE data was refreshed and if it needs to be updated.
|
* Checks to find the last time the CPE data was refreshed and if it needs
|
||||||
|
* to be updated.
|
||||||
*
|
*
|
||||||
* @return true if the CPE data should be refreshed
|
* @return true if the CPE data should be refreshed
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +154,8 @@ public class CpeUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the file contained in a gzip archive. The extracted file is placed in the exact same path as the file specified.
|
* Extracts the file contained in a gzip archive. The extracted file is
|
||||||
|
* placed in the exact same path as the file specified.
|
||||||
*
|
*
|
||||||
* @param file the archive file
|
* @param file the archive file
|
||||||
* @throws FileNotFoundException thrown if the file does not exist
|
* @throws FileNotFoundException thrown if the file does not exist
|
||||||
|
|||||||
@@ -67,15 +67,15 @@ public class DependencyBundlingAnalyzerTest extends BaseTest {
|
|||||||
DependencyBundlingAnalyzer instance = new DependencyBundlingAnalyzer();
|
DependencyBundlingAnalyzer instance = new DependencyBundlingAnalyzer();
|
||||||
|
|
||||||
// the actual dependency does not matter
|
// the actual dependency does not matter
|
||||||
assertFalse(instance.analyzed);
|
assertFalse(instance.getAnalyzed());
|
||||||
instance.analyze(null, engineMock);
|
instance.analyze(null, engineMock);
|
||||||
|
|
||||||
// the second runs basically does nothing
|
// the second runs basically does nothing
|
||||||
assertTrue(instance.analyzed);
|
assertTrue(instance.getAnalyzed());
|
||||||
instance.analyze(null, engineMock);
|
instance.analyze(null, engineMock);
|
||||||
instance.analyze(null, engineMock);
|
instance.analyze(null, engineMock);
|
||||||
instance.analyze(null, engineMock);
|
instance.analyze(null, engineMock);
|
||||||
assertTrue(instance.analyzed);
|
assertTrue(instance.getAnalyzed());
|
||||||
|
|
||||||
new Verifications() {{
|
new Verifications() {{
|
||||||
engineMock.getDependencies();
|
engineMock.getDependencies();
|
||||||
|
|||||||
Reference in New Issue
Block a user