revert database name to dc.h2.db

This commit is contained in:
Jeremy Long
2017-08-13 16:05:26 -04:00
parent 3ef80644f8
commit c0aca39d31
9 changed files with 17 additions and 11 deletions

View File

@@ -23,8 +23,6 @@ import java.io.RandomAccessFile;
import java.nio.channels.FileLock;
import java.util.Date;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,11 +59,16 @@ public class H2DBLock {
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 {
if (ConnectionFactory.isH2Connection()) {
try {
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()) {
LOGGER.warn("An old db update lock file was found but the system was unable to delete "
+ "the file. Consider manually deleting {}", lockFile.getAbsolutePath());
@@ -108,6 +111,9 @@ public class H2DBLock {
}
}
/**
* Releases the lock on the H2 database.
*/
public void release() {
if (lock != null) {
try {

View File

@@ -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.
data.directory=[JAR]/data
#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
### in the mojo.properties, task.properties (maven and ant respectively), and