mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-26 19:11:29 +01:00
initial upgrade of h2
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(), "dc.h2.db");
|
db = new File(Settings.getDataDirectory(), "odc.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(), "dc.h2.db");
|
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.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");
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ 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=dc.h2.db
|
data.file_name=odc.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
|
||||||
### the gradle PurgeDataExtension.
|
### the gradle PurgeDataExtension.
|
||||||
data.version=3.0
|
data.version=3.0
|
||||||
|
|
||||||
data.connection_string=jdbc:h2:file:%s;FILE_LOCK=SERIALIZED;AUTOCOMMIT=ON;
|
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;
|
||||||
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
||||||
|
|
||||||
# user name and password for the database connection. The inherent case is to use H2.
|
# user name and password for the database connection. The inherent case is to use H2.
|
||||||
|
|||||||
@@ -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/dc.h2.db");
|
File f = new File("./target/data/odc.h2.db");
|
||||||
if (f.exists() && f.isFile() && f.length() < 71680) {
|
if (f.exists() && f.isFile() && f.length() < 71680) {
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
@@ -70,9 +70,10 @@ public abstract class BaseDBTestCase extends BaseTest {
|
|||||||
d.mkdir();
|
d.mkdir();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
File o = new File(dataPath, entry.getName());
|
//File o = new File(dataPath, entry.getName());
|
||||||
o.createNewFile();
|
//o.createNewFile();
|
||||||
try (FileOutputStream fos = new FileOutputStream(o, false);
|
dataFile.createNewFile();
|
||||||
|
try (FileOutputStream fos = new FileOutputStream(dataFile, false);
|
||||||
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
|
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
|
||||||
IOUtils.copy(zin, dest);
|
IOUtils.copy(zin, dest);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
|
|||||||
@@ -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/dc.h2.db");
|
File f = new File("./target/data/odc.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("------------------------------------------------");
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ public class EngineModeIT extends BaseTest {
|
|||||||
assertThat(Files.exists(directory), is(true));
|
assertThat(Files.exists(directory), is(true));
|
||||||
assertThat(Files.isDirectory(directory), is(true));
|
assertThat(Files.isDirectory(directory), is(true));
|
||||||
Path database = directory.resolve(Settings.getString(Settings.KEYS.DB_FILE_NAME));
|
Path database = directory.resolve(Settings.getString(Settings.KEYS.DB_FILE_NAME));
|
||||||
|
System.err.println(database.toString());
|
||||||
|
for (String f : directory.toFile().list()) {
|
||||||
|
System.err.println(f);
|
||||||
|
}
|
||||||
|
|
||||||
assertThat(Files.exists(database), is(exists));
|
assertThat(Files.exists(database), is(exists));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ 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=dc.h2.db
|
data.file_name=odc.h2.db
|
||||||
data.version=3.0
|
data.version=3.0
|
||||||
data.connection_string=jdbc:h2:file:%s;FILE_LOCK=SERIALIZED;AUTOCOMMIT=ON;
|
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;
|
||||||
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
||||||
|
|
||||||
# user name and password for the database connection. The inherent case is to use H2.
|
# user name and password for the database connection. The inherent case is to use H2.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class PurgeMojo extends BaseDependencyCheckMojo {
|
|||||||
populateSettings();
|
populateSettings();
|
||||||
File db;
|
File db;
|
||||||
try {
|
try {
|
||||||
db = new File(Settings.getDataDirectory(), "dc.h2.db");
|
db = new File(Settings.getDataDirectory(), Settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.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");
|
||||||
|
|||||||
@@ -1010,7 +1010,7 @@ public final class Settings {
|
|||||||
// yes, for H2 this path won't actually exists - but this is sufficient to get the value needed
|
// yes, for H2 this path won't actually exists - but this is sufficient to get the value needed
|
||||||
final File dbFile = new File(directory, fileName);
|
final File dbFile = new File(directory, fileName);
|
||||||
final String cString = String.format(connStr, dbFile.getCanonicalPath());
|
final String cString = String.format(connStr, dbFile.getCanonicalPath());
|
||||||
LOGGER.debug("Connection String: '{}'", cString);
|
LOGGER.error("Connection String: '{}'", cString);
|
||||||
return cString;
|
return cString;
|
||||||
}
|
}
|
||||||
return connStr;
|
return connStr;
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ 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=dc.h2.db
|
data.file_name=odc.h2.db
|
||||||
data.version=3.0
|
data.version=3.0
|
||||||
data.connection_string=jdbc:h2:file:%s;FILE_LOCK=SERIALIZED;AUTOCOMMIT=ON;
|
data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;
|
||||||
#data.connection_string=jdbc:h2:file:%s;AUTO_SERVER=TRUE;AUTOCOMMIT=ON;
|
#data.connection_string=jdbc:h2:file:%s;AUTO_SERVER=TRUE;AUTOCOMMIT=ON;
|
||||||
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -624,7 +624,7 @@ Copyright (c) 2012 - Jeremy Long
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>1.3.176</version>
|
<version>1.4.196</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-cli</groupId>
|
<groupId>commons-cli</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user