mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 07:43:40 +01:00
updated Settigns to get the temp directory
Former-commit-id: d9a1e89ce829ab06e5aa1cd454184966d1e4b115
This commit is contained in:
@@ -127,8 +127,10 @@ public class ArchiveAnalyzer extends AbstractAnalyzer implements Analyzer {
|
||||
*/
|
||||
@Override
|
||||
public void initialize() throws Exception {
|
||||
final String tmpDir = Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir"));
|
||||
final File baseDir = new File(tmpDir);
|
||||
final File baseDir = Settings.getTempDirectory();
|
||||
if (!baseDir.exists()) {
|
||||
baseDir.mkdirs();
|
||||
}
|
||||
tempFileLocation = File.createTempFile("check", "tmp", baseDir);
|
||||
if (!tempFileLocation.delete()) {
|
||||
throw new AnalysisException("Unable to delete temporary file '" + tempFileLocation.getAbsolutePath() + "'.");
|
||||
|
||||
@@ -296,6 +296,15 @@ public final class Settings {
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the temporary directory.
|
||||
*
|
||||
* @return the temporary directory
|
||||
*/
|
||||
public static File getTempDirectory() {
|
||||
return new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value from the properties file. If the value was specified as a
|
||||
* system property or passed in via the -Dprop=value argument - this method
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DatabaseUpdater_1_Test {
|
||||
old12 = Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL);
|
||||
old20 = Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL);
|
||||
|
||||
File tmp = Settings.getFile(Settings.KEYS.TEMP_DIRECTORY);
|
||||
File tmp = Settings.getTempDirectory();
|
||||
if (!tmp.exists()) {
|
||||
tmp.mkdirs();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DatabaseUpdater_2_Test {
|
||||
Settings.removeProperty(Settings.KEYS.CVE_MODIFIED_12_URL);
|
||||
Settings.removeProperty(Settings.KEYS.CVE_MODIFIED_20_URL);
|
||||
|
||||
File tmp = Settings.getFile(Settings.KEYS.TEMP_DIRECTORY);
|
||||
File tmp = Settings.getTempDirectory();
|
||||
if (!tmp.exists()) {
|
||||
tmp.mkdirs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user