mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 08:14:44 +01:00
fixed issue #570 - each instance of dependency-check will have its own temporary folder
This commit is contained in:
@@ -293,7 +293,8 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final String ANALYZER_COCOAPODS_ENABLED = "analyzer.cocoapods.enabled";
|
public static final String ANALYZER_COCOAPODS_ENABLED = "analyzer.cocoapods.enabled";
|
||||||
/**
|
/**
|
||||||
* The properties key for whether the SWIFT package manager analyzer is enabled.
|
* The properties key for whether the SWIFT package manager analyzer is
|
||||||
|
* enabled.
|
||||||
*/
|
*/
|
||||||
public static final String ANALYZER_SWIFT_PACKAGE_MANAGER_ENABLED = "analyzer.swift.package.manager.enabled";
|
public static final String ANALYZER_SWIFT_PACKAGE_MANAGER_ENABLED = "analyzer.swift.package.manager.enabled";
|
||||||
/**
|
/**
|
||||||
@@ -425,14 +426,7 @@ public final class Settings {
|
|||||||
public static void cleanup(boolean deleteTemporary) {
|
public static void cleanup(boolean deleteTemporary) {
|
||||||
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
||||||
FileUtils.delete(tempDirectory);
|
FileUtils.delete(tempDirectory);
|
||||||
if (tempDirectory.exists()) {
|
tempDirectory = null;
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException ex) {
|
|
||||||
LOGGER.trace("ignore", ex);
|
|
||||||
}
|
|
||||||
FileUtils.delete(tempDirectory);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
LOCAL_SETTINGS.remove();
|
LOCAL_SETTINGS.remove();
|
||||||
@@ -746,14 +740,12 @@ public final class Settings {
|
|||||||
* @throws java.io.IOException thrown if the temporary directory does not
|
* @throws java.io.IOException thrown if the temporary directory does not
|
||||||
* exist and cannot be created
|
* exist and cannot be created
|
||||||
*/
|
*/
|
||||||
public static File getTempDirectory() throws IOException {
|
public static synchronized File getTempDirectory() throws IOException {
|
||||||
final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp");
|
if (tempDirectory == null) {
|
||||||
if (!tmpDir.exists() && !tmpDir.mkdirs()) {
|
final File baseTemp = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
|
||||||
final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
|
tempDirectory = FileUtils.createTempDirectory(baseTemp);
|
||||||
throw new IOException(msg);
|
|
||||||
}
|
}
|
||||||
tempDirectory = tmpDir;
|
return tempDirectory;
|
||||||
return tmpDir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user