mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 16:24:11 +01:00
updated settings cleanup to prevent issue with the update process
Former-commit-id: 07122c535d47f3f414659013555fa826ce0e9b9c
This commit is contained in:
@@ -62,7 +62,7 @@ public class App {
|
|||||||
final App app = new App();
|
final App app = new App();
|
||||||
app.run(args);
|
app.run(args);
|
||||||
} finally {
|
} finally {
|
||||||
Settings.cleanup();
|
Settings.cleanup(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class CliParserTest {
|
|||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownClass() throws Exception {
|
public static void tearDownClass() throws Exception {
|
||||||
Settings.cleanup();
|
Settings.cleanup(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|||||||
@@ -888,7 +888,7 @@ public class DependencyCheckScanAgent {
|
|||||||
"Unable to connect to the dependency-check database; analysis has stopped");
|
"Unable to connect to the dependency-check database; analysis has stopped");
|
||||||
LOGGER.log(Level.FINE, "", ex);
|
LOGGER.log(Level.FINE, "", ex);
|
||||||
} finally {
|
} finally {
|
||||||
Settings.cleanup();
|
Settings.cleanup(true);
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
engine.cleanup();
|
engine.cleanup();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,9 +247,11 @@ public final class Settings {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up resources to prevent memory leaks.
|
* Cleans up resources to prevent memory leaks.
|
||||||
|
*
|
||||||
|
* @param deleteTemporary flag indicating whether any temporary directories generated should be removed
|
||||||
*/
|
*/
|
||||||
public static void cleanup() {
|
public static void cleanup(boolean deleteTemporary) {
|
||||||
if (tempDirectory != null && tempDirectory.exists()) {
|
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
||||||
FileUtils.delete(tempDirectory);
|
FileUtils.delete(tempDirectory);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ public class BaseTest {
|
|||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownClass() throws Exception {
|
public static void tearDownClass() throws Exception {
|
||||||
Settings.cleanup();
|
Settings.cleanup(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -953,7 +953,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
|
|||||||
"Unable to connect to the dependency-check database; analysis has stopped");
|
"Unable to connect to the dependency-check database; analysis has stopped");
|
||||||
logger.log(Level.FINE, "", ex);
|
logger.log(Level.FINE, "", ex);
|
||||||
} finally {
|
} finally {
|
||||||
Settings.cleanup();
|
Settings.cleanup(true);
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
engine.cleanup();
|
engine.cleanup();
|
||||||
}
|
}
|
||||||
@@ -994,7 +994,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
|
|||||||
"Unable to connect to the dependency-check database; analysis has stopped");
|
"Unable to connect to the dependency-check database; analysis has stopped");
|
||||||
logger.log(Level.FINE, "", ex);
|
logger.log(Level.FINE, "", ex);
|
||||||
} finally {
|
} finally {
|
||||||
Settings.cleanup();
|
Settings.cleanup(true);
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
engine.cleanup();
|
engine.cleanup();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user