From 658860e396eb25f24c8f842eb429d0bc82ce6575 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sat, 6 Dec 2014 10:15:28 -0500 Subject: [PATCH] added new save properties method to support changes for issue #82 Former-commit-id: 56480f2d0233a03aed83ec0e8c8092f599cd0a62 --- .../data/nvdcve/DatabaseProperties.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.java index a4261abfe..a10fc1d30 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/nvdcve/DatabaseProperties.java @@ -91,7 +91,7 @@ public class DatabaseProperties { } /** - * Writes a properties file containing the last updated date to the VULNERABLE_CPE directory. + * Saves the last updated information to the properties file. * * @param updatedValue the updated NVD CVE entry * @throws UpdateException is thrown if there is an update exception @@ -100,8 +100,19 @@ public class DatabaseProperties { if (updatedValue == null) { return; } - properties.put(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); - cveDB.saveProperty(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); + save(LAST_UPDATED_BASE + updatedValue.getId(), String.valueOf(updatedValue.getTimestamp())); + } + + /** + * Saves the key value pair to the properties store. + * + * @param key the property key + * @param value the property value + * @throws UpdateException is thrown if there is an update exception + */ + public void save(String key, String value) throws UpdateException { + properties.put(key, value); + cveDB.saveProperty(key, value); } /**