mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 00:03:43 +01:00
Cleanup: Codacy conformance
This commit is contained in:
@@ -78,11 +78,10 @@ public final class CveDB {
|
||||
*/
|
||||
private final DatabaseProperties databaseProperties;
|
||||
/**
|
||||
* Creates a new CveDB object and opens the database connection. Note, the
|
||||
* connection must be closed by the caller by calling the close method.
|
||||
* ======= Does the underlying connection support batch operations?
|
||||
* Does the underlying connection support batch operations?
|
||||
* Currently we do not support batch execution.
|
||||
*/
|
||||
private final boolean batchSupported;
|
||||
private final boolean batchSupported = false;
|
||||
/**
|
||||
* The prepared statements.
|
||||
*/
|
||||
@@ -127,7 +126,6 @@ public final class CveDB {
|
||||
public CveDB() throws DatabaseException {
|
||||
open();
|
||||
final String databaseProductName = determineDatabaseProductName();
|
||||
batchSupported = isBatchSupportedFor(databaseProductName);
|
||||
statementBundle = databaseProductName != null ?
|
||||
ResourceBundle.getBundle("data/dbStatements", new Locale(databaseProductName)) :
|
||||
ResourceBundle.getBundle("data/dbStatements");
|
||||
@@ -151,21 +149,6 @@ public final class CveDB {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the database supports batch execution of statements.
|
||||
*
|
||||
* @param databaseProductName the product name of the database
|
||||
* @return if the database supports batch execution
|
||||
*/
|
||||
private boolean isBatchSupportedFor(String databaseProductName) {
|
||||
if ("mysql".equalsIgnoreCase(databaseProductName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// per default we do not support batch execution
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the database connection.
|
||||
*
|
||||
@@ -227,7 +210,7 @@ public final class CveDB {
|
||||
throws DatabaseException {
|
||||
|
||||
final EnumMap<PreparedStatementCveDb, PreparedStatement> result = new EnumMap<PreparedStatementCveDb, PreparedStatement>(PreparedStatementCveDb.class);
|
||||
for (PreparedStatementCveDb key : PreparedStatementCveDb.values()) {
|
||||
for (PreparedStatementCveDb key : values()) {
|
||||
final String statementString = statementBundle.getString(key.name());
|
||||
final PreparedStatement preparedStatement;
|
||||
try {
|
||||
@@ -610,7 +593,7 @@ public final class CveDB {
|
||||
}
|
||||
|
||||
final PreparedStatement insertReference = getPreparedStatement(INSERT_REFERENCE);
|
||||
if(batchSupported) {
|
||||
if (batchSupported) {
|
||||
insertReference.clearBatch();
|
||||
}
|
||||
for (Reference r : vuln.getReferences()) {
|
||||
@@ -631,7 +614,7 @@ public final class CveDB {
|
||||
}
|
||||
|
||||
final PreparedStatement insertSoftware = getPreparedStatement(INSERT_SOFTWARE);
|
||||
if(batchSupported) {
|
||||
if (batchSupported) {
|
||||
insertSoftware.clearBatch();
|
||||
}
|
||||
for (VulnerableSoftware s : vuln.getVulnerableSoftware()) {
|
||||
|
||||
Reference in New Issue
Block a user