mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +01:00
removed duplicate code by adding a public getPropertiesFile method to obtain the File
Former-commit-id: 38ea859b46d9e7d0db622033b16fa3b23e93a3de
This commit is contained in:
@@ -40,7 +40,12 @@ import org.owasp.dependencycheck.utils.Settings;
|
||||
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";
|
||||
/**
|
||||
@@ -99,8 +104,7 @@ public class DataStoreMetaInfo {
|
||||
* Loads the data's meta properties.
|
||||
*/
|
||||
private void loadProperties() {
|
||||
final File dataDirectory = Settings.getFile(Settings.KEYS.DATA_DIRECTORY);
|
||||
final File file = new File(dataDirectory, UPDATE_PROPERTIES_FILE);
|
||||
File file = getPropertiesFile();
|
||||
if (file.exists()) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
@@ -139,8 +143,7 @@ public class DataStoreMetaInfo {
|
||||
if (updatedValue == null) {
|
||||
return;
|
||||
}
|
||||
final File dataDirectory = Settings.getFile(Settings.KEYS.DATA_DIRECTORY);
|
||||
final File cveProp = new File(dataDirectory, UPDATE_PROPERTIES_FILE);
|
||||
final File cveProp = getPropertiesFile();
|
||||
final Properties prop = new Properties();
|
||||
if (cveProp.exists()) {
|
||||
FileInputStream in = null;
|
||||
@@ -214,4 +217,15 @@ public class DataStoreMetaInfo {
|
||||
public String getProperty(String key, String 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