mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-25 10:32:00 +01:00
revert database name to dc.h2.db
This commit is contained in:
@@ -106,7 +106,7 @@ public class Purge extends Task {
|
|||||||
populateSettings();
|
populateSettings();
|
||||||
File db;
|
File db;
|
||||||
try {
|
try {
|
||||||
db = new File(Settings.getDataDirectory(), "odc.h2.db");
|
db = new File(Settings.getDataDirectory(), "dc.h2.db");
|
||||||
if (db.exists()) {
|
if (db.exists()) {
|
||||||
if (db.delete()) {
|
if (db.delete()) {
|
||||||
log("Database file purged; local copy of the NVD has been removed", Project.MSG_INFO);
|
log("Database file purged; local copy of the NVD has been removed", Project.MSG_INFO);
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class App {
|
|||||||
}
|
}
|
||||||
File db;
|
File db;
|
||||||
try {
|
try {
|
||||||
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.h2.db"));
|
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "dc.h2.db"));
|
||||||
if (db.exists()) {
|
if (db.exists()) {
|
||||||
if (db.delete()) {
|
if (db.delete()) {
|
||||||
LOGGER.info("Database file purged; local copy of the NVD has been removed");
|
LOGGER.info("Database file purged; local copy of the NVD has been removed");
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ import java.io.RandomAccessFile;
|
|||||||
import java.nio.channels.FileLock;
|
import java.nio.channels.FileLock;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.owasp.dependencycheck.data.nvdcve.ConnectionFactory;
|
import org.owasp.dependencycheck.data.nvdcve.ConnectionFactory;
|
||||||
import org.owasp.dependencycheck.data.update.NvdCveUpdater;
|
|
||||||
import org.owasp.dependencycheck.data.update.exception.UpdateException;
|
|
||||||
import org.owasp.dependencycheck.exception.H2DBLockException;
|
import org.owasp.dependencycheck.exception.H2DBLockException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -61,11 +59,16 @@ public class H2DBLock {
|
|||||||
return lock != null && lock.isValid();
|
return lock != null && lock.isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains a lock on the H2 database.
|
||||||
|
*
|
||||||
|
* @throws H2DBLockException thrown if a lock could not be obtained
|
||||||
|
*/
|
||||||
public void lock() throws H2DBLockException {
|
public void lock() throws H2DBLockException {
|
||||||
if (ConnectionFactory.isH2Connection()) {
|
if (ConnectionFactory.isH2Connection()) {
|
||||||
try {
|
try {
|
||||||
final File dir = Settings.getDataDirectory();
|
final File dir = Settings.getDataDirectory();
|
||||||
lockFile = new File(dir, "odc.update.lock");
|
lockFile = new File(dir, "dc.update.lock");
|
||||||
if (lockFile.isFile() && getFileAge(lockFile) > 5 && !lockFile.delete()) {
|
if (lockFile.isFile() && getFileAge(lockFile) > 5 && !lockFile.delete()) {
|
||||||
LOGGER.warn("An old db update lock file was found but the system was unable to delete "
|
LOGGER.warn("An old db update lock file was found but the system was unable to delete "
|
||||||
+ "the file. Consider manually deleting {}", lockFile.getAbsolutePath());
|
+ "the file. Consider manually deleting {}", lockFile.getAbsolutePath());
|
||||||
@@ -108,6 +111,9 @@ public class H2DBLock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Releases the lock on the H2 database.
|
||||||
|
*/
|
||||||
public void release() {
|
public void release() {
|
||||||
if (lock != null) {
|
if (lock != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ engine.version.url=https://jeremylong.github.io/DependencyCheck/current.txt
|
|||||||
# below contains a %s then the data.directory will replace the %s.
|
# below contains a %s then the data.directory will replace the %s.
|
||||||
data.directory=[JAR]/data
|
data.directory=[JAR]/data
|
||||||
#if the filename has a %s it will be replaced with the current expected version
|
#if the filename has a %s it will be replaced with the current expected version
|
||||||
data.file_name=odc.h2.db
|
data.file_name=dc.h2.db
|
||||||
|
|
||||||
### if you increment the DB version then you must increment the database file path
|
### if you increment the DB version then you must increment the database file path
|
||||||
### in the mojo.properties, task.properties (maven and ant respectively), and
|
### in the mojo.properties, task.properties (maven and ant respectively), and
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public abstract class BaseDBTestCase extends BaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureDBExists() throws Exception {
|
public static void ensureDBExists() throws Exception {
|
||||||
File f = new File("./target/data/odc.h2.db");
|
File f = new File("./target/data/dc.h2.db");
|
||||||
if (f.exists() && f.isFile() && f.length() < 71680) {
|
if (f.exists() && f.isFile() && f.length() < 71680) {
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class BaseTest {
|
|||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownClass() throws Exception {
|
public static void tearDownClass() throws Exception {
|
||||||
File f = new File("./target/data/odc.h2.db");
|
File f = new File("./target/data/dc.h2.db");
|
||||||
if (f.exists() && f.isFile() && f.length() < 71680) {
|
if (f.exists() && f.isFile() && f.length() < 71680) {
|
||||||
System.err.println("------------------------------------------------");
|
System.err.println("------------------------------------------------");
|
||||||
System.err.println("------------------------------------------------");
|
System.err.println("------------------------------------------------");
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ engine.version.url=https://jeremylong.github.io/DependencyCheck/current.txt
|
|||||||
# below contains a %s then the data.directory will replace the %s.
|
# below contains a %s then the data.directory will replace the %s.
|
||||||
data.directory=[JAR]/data
|
data.directory=[JAR]/data
|
||||||
#if the filename has a %s it will be replaced with the current expected version
|
#if the filename has a %s it will be replaced with the current expected version
|
||||||
data.file_name=odc.h2.db
|
data.file_name=dc.h2.db
|
||||||
data.version=3.0
|
data.version=3.0
|
||||||
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOCK_MODE=0;FILE_LOCK=NO
|
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOCK_MODE=0;FILE_LOCK=NO
|
||||||
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class PurgeMojo extends BaseDependencyCheckMojo {
|
|||||||
populateSettings();
|
populateSettings();
|
||||||
File db;
|
File db;
|
||||||
try {
|
try {
|
||||||
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.h2.db"));
|
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "dc.h2.db"));
|
||||||
if (db.exists()) {
|
if (db.exists()) {
|
||||||
if (db.delete()) {
|
if (db.delete()) {
|
||||||
getLog().info("Database file purged; local copy of the NVD has been removed");
|
getLog().info("Database file purged; local copy of the NVD has been removed");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ engine.version.url=http://jeremylong.github.io/DependencyCheck/current.txt
|
|||||||
# will not be used. The data.directory will be resolved and if the connection string
|
# will not be used. The data.directory will be resolved and if the connection string
|
||||||
# below contains a %s then the data.directory will replace the %s.
|
# below contains a %s then the data.directory will replace the %s.
|
||||||
data.directory=[JAR]/data
|
data.directory=[JAR]/data
|
||||||
data.file_name=odc.h2.db
|
data.file_name=dc.h2.db
|
||||||
data.version=3.0
|
data.version=3.0
|
||||||
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOCK_MODE=0;FILE_LOCK=NO
|
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOCK_MODE=0;FILE_LOCK=NO
|
||||||
#data.connection_string=jdbc:h2:file:%s;AUTO_SERVER=TRUE;AUTOCOMMIT=ON;
|
#data.connection_string=jdbc:h2:file:%s;AUTO_SERVER=TRUE;AUTOCOMMIT=ON;
|
||||||
|
|||||||
Reference in New Issue
Block a user