diff --git a/db/src/main/java/edu/rit/se/nvip/db/repositories/RawDescriptionRepository.java b/db/src/main/java/edu/rit/se/nvip/db/repositories/RawDescriptionRepository.java index 0b64f4271..b7e803e0c 100644 --- a/db/src/main/java/edu/rit/se/nvip/db/repositories/RawDescriptionRepository.java +++ b/db/src/main/java/edu/rit/se/nvip/db/repositories/RawDescriptionRepository.java @@ -70,6 +70,7 @@ public List batchInsertRawVulnerability(List //Split vulns into batches for JDBC Insert //TODO: Move the hardcoded value for(List batch: Lists.partition(vulns, 256)) { + int ignored = 0; for(RawVulnerability vuln: batch) { try { pstmt.setString(1, vuln.getDescription()); @@ -84,13 +85,14 @@ public List batchInsertRawVulnerability(List } catch (DateTimeParseException e) { log.error("Failed to add {} to batch: {}", vuln.getCveId(), e.getMessage()); log.error("", e); + ignored++; } } int[] results = pstmt.executeBatch(); - if(results.length == vulns.size()){ - for(int i = 0; i < vulns.size(); i++){ + if(results.length == (batch.size() - ignored) ){ + for(int i = 0; i < batch.size(); i++){ if(results[i] == Statement.SUCCESS_NO_INFO || results[i] == Statement.KEEP_CURRENT_RESULT || results[i] == Statement.CLOSE_CURRENT_RESULT) { inserted.add(vulns.get(i)); } else {