mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-19 07:44:23 +01:00
removed unused code for batching
This commit is contained in:
@@ -81,11 +81,6 @@ public final class CveDB {
|
|||||||
* table.
|
* table.
|
||||||
*/
|
*/
|
||||||
private DatabaseProperties databaseProperties;
|
private DatabaseProperties databaseProperties;
|
||||||
/**
|
|
||||||
* Does the underlying connection support batch operations? Currently we do
|
|
||||||
* not support batch execution.
|
|
||||||
*/
|
|
||||||
private final boolean batchSupported = false;
|
|
||||||
/**
|
/**
|
||||||
* The prepared statements.
|
* The prepared statements.
|
||||||
*/
|
*/
|
||||||
@@ -623,30 +618,14 @@ public final class CveDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PreparedStatement insertReference = getPreparedStatement(INSERT_REFERENCE);
|
final PreparedStatement insertReference = getPreparedStatement(INSERT_REFERENCE);
|
||||||
if (batchSupported) {
|
|
||||||
insertReference.clearBatch();
|
|
||||||
}
|
|
||||||
for (Reference r : vuln.getReferences()) {
|
for (Reference r : vuln.getReferences()) {
|
||||||
insertReference.setInt(1, vulnerabilityId);
|
insertReference.setInt(1, vulnerabilityId);
|
||||||
insertReference.setString(2, r.getName());
|
insertReference.setString(2, r.getName());
|
||||||
insertReference.setString(3, r.getUrl());
|
insertReference.setString(3, r.getUrl());
|
||||||
insertReference.setString(4, r.getSource());
|
insertReference.setString(4, r.getSource());
|
||||||
|
insertReference.execute();
|
||||||
if (batchSupported) {
|
|
||||||
insertReference.addBatch();
|
|
||||||
} else {
|
|
||||||
insertReference.execute();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (batchSupported) {
|
|
||||||
insertReference.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
final PreparedStatement insertSoftware = getPreparedStatement(INSERT_SOFTWARE);
|
final PreparedStatement insertSoftware = getPreparedStatement(INSERT_SOFTWARE);
|
||||||
if (batchSupported) {
|
|
||||||
insertSoftware.clearBatch();
|
|
||||||
}
|
|
||||||
for (VulnerableSoftware s : vuln.getVulnerableSoftware()) {
|
for (VulnerableSoftware s : vuln.getVulnerableSoftware()) {
|
||||||
int cpeProductId = 0;
|
int cpeProductId = 0;
|
||||||
final PreparedStatement selectCpeId = getPreparedStatement(SELECT_CPE_ID);
|
final PreparedStatement selectCpeId = getPreparedStatement(SELECT_CPE_ID);
|
||||||
@@ -682,24 +661,17 @@ public final class CveDB {
|
|||||||
} else {
|
} else {
|
||||||
insertSoftware.setString(3, s.getPreviousVersion());
|
insertSoftware.setString(3, s.getPreviousVersion());
|
||||||
}
|
}
|
||||||
if (batchSupported) {
|
try {
|
||||||
insertSoftware.addBatch();
|
insertSoftware.execute();
|
||||||
} else {
|
} catch (SQLException ex) {
|
||||||
try {
|
if (ex.getMessage().contains("Duplicate entry")) {
|
||||||
insertSoftware.execute();
|
final String msg = String.format("Duplicate software key identified in '%s:%s'", vuln.getName(), s.getName());
|
||||||
} catch (SQLException ex) {
|
LOGGER.info(msg, ex);
|
||||||
if (ex.getMessage().contains("Duplicate entry")) {
|
} else {
|
||||||
final String msg = String.format("Duplicate software key identified in '%s:%s'", vuln.getName(), s.getName());
|
throw ex;
|
||||||
LOGGER.info(msg, ex);
|
|
||||||
} else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (batchSupported) {
|
|
||||||
insertSoftware.executeBatch();
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
final String msg = String.format("Error updating '%s'", vuln.getName());
|
final String msg = String.format("Error updating '%s'", vuln.getName());
|
||||||
LOGGER.debug(msg, ex);
|
LOGGER.debug(msg, ex);
|
||||||
|
|||||||
Reference in New Issue
Block a user