mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 07:43:40 +01:00
improved logging to assist in resolving #1061
This commit is contained in:
@@ -206,12 +206,13 @@ public class ArchiveAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
@Override
|
||||
public void closeAnalyzer() throws Exception {
|
||||
if (tempFileLocation != null && tempFileLocation.exists()) {
|
||||
LOGGER.debug("Attempting to delete temporary files");
|
||||
LOGGER.debug("Attempting to delete temporary files from `{}`", tempFileLocation.toString());
|
||||
final boolean success = FileUtils.delete(tempFileLocation);
|
||||
if (!success && tempFileLocation.exists()) {
|
||||
final String[] l = tempFileLocation.list();
|
||||
if (l != null && l.length > 0) {
|
||||
LOGGER.warn("Failed to delete some temporary files, see the log for more details");
|
||||
LOGGER.warn("Failed to delete the Archive Analyzer's temporary files from `{}`, "
|
||||
+ "see the log for more details", tempFileLocation.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,8 +389,9 @@ public class ArchiveAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
try {
|
||||
fis = new FileInputStream(archive);
|
||||
} catch (FileNotFoundException ex) {
|
||||
LOGGER.debug("", ex);
|
||||
throw new AnalysisException("Archive file was not found.", ex);
|
||||
final String msg = String.format("Error extracting file `%s`: %s", archive.toString(), ex.getMessage());
|
||||
LOGGER.debug(msg, ex);
|
||||
throw new AnalysisException(msg);
|
||||
}
|
||||
BufferedInputStream in = null;
|
||||
ZipArchiveInputStream zin = null;
|
||||
|
||||
@@ -970,12 +970,13 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
@Override
|
||||
public void closeAnalyzer() {
|
||||
if (tempFileLocation != null && tempFileLocation.exists()) {
|
||||
LOGGER.debug("Attempting to delete temporary files");
|
||||
LOGGER.debug("Attempting to delete temporary files from `{}`", tempFileLocation.toString());
|
||||
final boolean success = FileUtils.delete(tempFileLocation);
|
||||
if (!success && tempFileLocation.exists()) {
|
||||
final String[] l = tempFileLocation.list();
|
||||
if (l != null && l.length > 0) {
|
||||
LOGGER.warn("Failed to delete some temporary files, see the log for more details");
|
||||
LOGGER.warn("Failed to delete the JAR Analyzder's temporary files from `{}`, "
|
||||
+ "see the log for more details", tempFileLocation.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +139,9 @@ public final class ExtractionUtil {
|
||||
extractArchive(new ZipArchiveInputStream(new BufferedInputStream(
|
||||
fis)), destination, filter);
|
||||
} catch (FileNotFoundException ex) {
|
||||
LOGGER.debug("", ex);
|
||||
throw new ExtractionException("Archive file was not found.", ex);
|
||||
final String msg = String.format("Error extracting file `%s` with filter: %s",archive.toString(), ex.getMessage());
|
||||
LOGGER.debug(msg, ex);
|
||||
throw new ExtractionException(msg);
|
||||
} catch (IOException | ArchiveExtractionException ex) {
|
||||
LOGGER.warn("Exception extracting archive '{}'.", archive.getName());
|
||||
LOGGER.debug("", ex);
|
||||
|
||||
@@ -457,7 +457,8 @@ public final class Settings {
|
||||
*/
|
||||
public static final String MAX_BATCH_SIZE = "database.batchinsert.maxsize";
|
||||
/**
|
||||
* The key that specifies the class name of the H2 database shutdown hook.
|
||||
* The key that specifies the class name of the H2 database shutdown
|
||||
* hook.
|
||||
*/
|
||||
public static final String H2DB_SHUTDOWN_HOOK = "data.h2.shutdownhook";
|
||||
|
||||
@@ -522,6 +523,7 @@ public final class Settings {
|
||||
*/
|
||||
public synchronized void cleanup(boolean deleteTemporary) {
|
||||
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
||||
LOGGER.debug("Deleting ALL temporary files from `{}`", tempDirectory.toString());
|
||||
FileUtils.delete(tempDirectory);
|
||||
tempDirectory = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user