From 34ce50b7b57656dcc1b9108b0bd7f1a4b71c9b6f Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sat, 31 Aug 2013 06:46:26 -0400 Subject: [PATCH] removed duplicate code by adding a public getPropertiesFile method to obtain the File Former-commit-id: cd3c7fdad8907eb28704e1e8342dfe41e08d9da3 --- .../data/update/DataStoreMetaInfo.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/DataStoreMetaInfo.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/DataStoreMetaInfo.java index 08500dea2..38fc77bfd 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/DataStoreMetaInfo.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/DataStoreMetaInfo.java @@ -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; + } }