mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-24 18:11:47 +01:00
attempted to fix minor bug of files not being extracted due to a failure when calling mkdirs()
Former-commit-id: 2ca6840f3198adb11df764bf11a96c23885f3217
This commit is contained in:
@@ -231,6 +231,10 @@ public class ArchiveAnalyzer extends AbstractAnalyzer implements Analyzer {
|
|||||||
private File getNextTempDirectory() throws AnalysisException {
|
private File getNextTempDirectory() throws AnalysisException {
|
||||||
dirCount += 1;
|
dirCount += 1;
|
||||||
final File directory = new File(tempFileLocation, String.valueOf(dirCount));
|
final File directory = new File(tempFileLocation, String.valueOf(dirCount));
|
||||||
|
//getting an exception for some directories not being able to be created; might be because the directory already exists?
|
||||||
|
if (directory.exists()) {
|
||||||
|
return getNextTempDirectory();
|
||||||
|
}
|
||||||
if (!directory.mkdirs()) {
|
if (!directory.mkdirs()) {
|
||||||
throw new AnalysisException("Unable to create temp directory '" + directory.getAbsolutePath() + "'.");
|
throw new AnalysisException("Unable to create temp directory '" + directory.getAbsolutePath() + "'.");
|
||||||
}
|
}
|
||||||
@@ -267,9 +271,11 @@ public class ArchiveAnalyzer extends AbstractAnalyzer implements Analyzer {
|
|||||||
while ((entry = zis.getNextZipEntry()) != null) {
|
while ((entry = zis.getNextZipEntry()) != null) {
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
final File d = new File(extractTo, entry.getName());
|
final File d = new File(extractTo, entry.getName());
|
||||||
|
if (!d.exists()) {
|
||||||
if (!d.mkdirs()) {
|
if (!d.mkdirs()) {
|
||||||
throw new AnalysisException("Unable to create '" + d.getAbsolutePath() + "'.");
|
throw new AnalysisException("Unable to create '" + d.getAbsolutePath() + "'.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final File file = new File(extractTo, entry.getName());
|
final File file = new File(extractTo, entry.getName());
|
||||||
final String ext = org.owasp.dependencycheck.utils.FileUtils.getFileExtension(file.getName());
|
final String ext = org.owasp.dependencycheck.utils.FileUtils.getFileExtension(file.getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user