mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-21 08:39:24 +01:00
fixed issue #272
This commit is contained in:
@@ -271,12 +271,22 @@ public class NvdCveUpdater extends BaseUpdater implements CachedWebDataSource {
|
|||||||
}
|
}
|
||||||
if (!getProperties().isEmpty()) {
|
if (!getProperties().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
final int startYear = Settings.getInt(Settings.KEYS.CVE_START_YEAR, 2002);
|
||||||
|
final int endYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||||
|
boolean needsFullUpdate = false;
|
||||||
|
for (int y = startYear; y <= endYear; y++) {
|
||||||
|
long val = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED_BASE + y, "0"));
|
||||||
|
if (val == 0) {
|
||||||
|
needsFullUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final long lastUpdated = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED, "0"));
|
final long lastUpdated = Long.parseLong(getProperties().getProperty(DatabaseProperties.LAST_UPDATED, "0"));
|
||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 7);
|
final int days = Settings.getInt(Settings.KEYS.CVE_MODIFIED_VALID_FOR_DAYS, 7);
|
||||||
if (lastUpdated == updates.getTimeStamp(MODIFIED)) {
|
if (!needsFullUpdate && lastUpdated == updates.getTimeStamp(MODIFIED)) {
|
||||||
updates.clear(); //we don't need to update anything.
|
updates.clear(); //we don't need to update anything.
|
||||||
} else if (DateUtil.withinDateRange(lastUpdated, now, days)) {
|
} else if (!needsFullUpdate && DateUtil.withinDateRange(lastUpdated, now, days)) {
|
||||||
for (NvdCveInfo entry : updates) {
|
for (NvdCveInfo entry : updates) {
|
||||||
if (MODIFIED.equals(entry.getId())) {
|
if (MODIFIED.equals(entry.getId())) {
|
||||||
entry.setNeedsUpdate(true);
|
entry.setNeedsUpdate(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user