mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 16:24:11 +01:00
removed duplicate code by adding a public getPropertiesFile method to obtain the File
Former-commit-id: cd3c7fdad8907eb28704e1e8342dfe41e08d9da3
This commit is contained in:
@@ -40,7 +40,12 @@ import org.owasp.dependencycheck.utils.Settings;
|
|||||||
public class DataStoreMetaInfo {
|
public class DataStoreMetaInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modified key word.
|
* Batch key word, used as key to store information about batch mode.
|
||||||
|
*/
|
||||||
|
public static final String BATCH = "batch";
|
||||||
|
/**
|
||||||
|
* Modified key word, used as a key to store information about the modified
|
||||||
|
* file (i.e. the containing the last 8 days of updates)..
|
||||||
*/
|
*/
|
||||||
public static final String MODIFIED = "modified";
|
public static final String MODIFIED = "modified";
|
||||||
/**
|
/**
|
||||||
@@ -99,8 +104,7 @@ public class DataStoreMetaInfo {
|
|||||||
* Loads the data's meta properties.
|
* Loads the data's meta properties.
|
||||||
*/
|
*/
|
||||||
private void loadProperties() {
|
private void loadProperties() {
|
||||||
final File dataDirectory = Settings.getFile(Settings.KEYS.DATA_DIRECTORY);
|
File file = getPropertiesFile();
|
||||||
final File file = new File(dataDirectory, UPDATE_PROPERTIES_FILE);
|
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
@@ -139,8 +143,7 @@ public class DataStoreMetaInfo {
|
|||||||
if (updatedValue == null) {
|
if (updatedValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final File dataDirectory = Settings.getFile(Settings.KEYS.DATA_DIRECTORY);
|
final File cveProp = getPropertiesFile();
|
||||||
final File cveProp = new File(dataDirectory, UPDATE_PROPERTIES_FILE);
|
|
||||||
final Properties prop = new Properties();
|
final Properties prop = new Properties();
|
||||||
if (cveProp.exists()) {
|
if (cveProp.exists()) {
|
||||||
FileInputStream in = null;
|
FileInputStream in = null;
|
||||||
@@ -214,4 +217,15 @@ public class DataStoreMetaInfo {
|
|||||||
public String getProperty(String key, String defaultValue) {
|
public String getProperty(String key, String defaultValue) {
|
||||||
return properties.getProperty(key, defaultValue);
|
return properties.getProperty(key, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the properties file.
|
||||||
|
*
|
||||||
|
* @return the properties file
|
||||||
|
*/
|
||||||
|
public File getPropertiesFile() {
|
||||||
|
final File dataDirectory = Settings.getFile(Settings.KEYS.DATA_DIRECTORY);
|
||||||
|
final File file = new File(dataDirectory, UPDATE_PROPERTIES_FILE);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user