mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-17 23:04:07 +01:00
updated functionality and incremented database schema version
Former-commit-id: fdf58314c5357a43828e6da1e95a5a88f15d1472
This commit is contained in:
@@ -59,7 +59,7 @@ public class CveDB {
|
|||||||
/**
|
/**
|
||||||
* The version of the current DB Schema.
|
* The version of the current DB Schema.
|
||||||
*/
|
*/
|
||||||
public static final String DB_SCHEMA_VERSION = "2.6";
|
public static final String DB_SCHEMA_VERSION = "2.7";
|
||||||
/**
|
/**
|
||||||
* Database connection
|
* Database connection
|
||||||
*/
|
*/
|
||||||
@@ -132,7 +132,7 @@ public class CveDB {
|
|||||||
/**
|
/**
|
||||||
* SQL Statement to select vendor and product for lucene index.
|
* SQL Statement to select vendor and product for lucene index.
|
||||||
*/
|
*/
|
||||||
public static final String SELECT_VENDOR_PRODUCT_LIST = "SELECT DISTINCT vendor, product FROM cpeEntry";
|
public static final String SELECT_VENDOR_PRODUCT_LIST = "SELECT vendor, product FROM cpeEntry GROUP BY vendor, product";
|
||||||
/**
|
/**
|
||||||
* SQL Statement to select software by CVEID.
|
* SQL Statement to select software by CVEID.
|
||||||
*/
|
*/
|
||||||
@@ -257,26 +257,16 @@ public class CveDB {
|
|||||||
*
|
*
|
||||||
* @return the entire list of vendor/product combinations.
|
* @return the entire list of vendor/product combinations.
|
||||||
*/
|
*/
|
||||||
public Set<IndexEntry> getVendorProductList() {
|
public ResultSet getVendorProductList() {
|
||||||
final Set<IndexEntry> set = new HashSet<IndexEntry>();
|
final Set<IndexEntry> set = new HashSet<IndexEntry>();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
PreparedStatement ps = null;
|
|
||||||
try {
|
try {
|
||||||
ps = conn.prepareStatement(SELECT_VENDOR_PRODUCT_LIST);
|
PreparedStatement ps = conn.prepareStatement(SELECT_VENDOR_PRODUCT_LIST);
|
||||||
rs = ps.executeQuery();
|
rs = ps.executeQuery();
|
||||||
while (rs.next()) {
|
|
||||||
final IndexEntry entry = new IndexEntry();
|
|
||||||
entry.setVendor(rs.getString(1));
|
|
||||||
entry.setProduct(rs.getString(2));
|
|
||||||
set.add(entry);
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
Logger.getLogger(CveDB.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(CveDB.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
} finally {
|
|
||||||
closeResultSet(rs);
|
|
||||||
closeStatement(ps);
|
|
||||||
}
|
}
|
||||||
return set;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -634,7 +624,7 @@ public class CveDB {
|
|||||||
*
|
*
|
||||||
* @param rs a ResultSet to close
|
* @param rs a ResultSet to close
|
||||||
*/
|
*/
|
||||||
private void closeResultSet(ResultSet rs) {
|
public void closeResultSet(ResultSet rs) {
|
||||||
if (rs != null) {
|
if (rs != null) {
|
||||||
try {
|
try {
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user