mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 09:09:31 +01:00
improved logging to assist in resolving #1061
This commit is contained in:
@@ -206,12 +206,13 @@ public class ArchiveAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
@Override
|
@Override
|
||||||
public void closeAnalyzer() throws Exception {
|
public void closeAnalyzer() throws Exception {
|
||||||
if (tempFileLocation != null && tempFileLocation.exists()) {
|
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);
|
final boolean success = FileUtils.delete(tempFileLocation);
|
||||||
if (!success && tempFileLocation.exists()) {
|
if (!success && tempFileLocation.exists()) {
|
||||||
final String[] l = tempFileLocation.list();
|
final String[] l = tempFileLocation.list();
|
||||||
if (l != null && l.length > 0) {
|
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 {
|
try {
|
||||||
fis = new FileInputStream(archive);
|
fis = new FileInputStream(archive);
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
LOGGER.debug("", ex);
|
final String msg = String.format("Error extracting file `%s`: %s", archive.toString(), ex.getMessage());
|
||||||
throw new AnalysisException("Archive file was not found.", ex);
|
LOGGER.debug(msg, ex);
|
||||||
|
throw new AnalysisException(msg);
|
||||||
}
|
}
|
||||||
BufferedInputStream in = null;
|
BufferedInputStream in = null;
|
||||||
ZipArchiveInputStream zin = null;
|
ZipArchiveInputStream zin = null;
|
||||||
|
|||||||
@@ -970,12 +970,13 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
@Override
|
@Override
|
||||||
public void closeAnalyzer() {
|
public void closeAnalyzer() {
|
||||||
if (tempFileLocation != null && tempFileLocation.exists()) {
|
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);
|
final boolean success = FileUtils.delete(tempFileLocation);
|
||||||
if (!success && tempFileLocation.exists()) {
|
if (!success && tempFileLocation.exists()) {
|
||||||
final String[] l = tempFileLocation.list();
|
final String[] l = tempFileLocation.list();
|
||||||
if (l != null && l.length > 0) {
|
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(
|
extractArchive(new ZipArchiveInputStream(new BufferedInputStream(
|
||||||
fis)), destination, filter);
|
fis)), destination, filter);
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
LOGGER.debug("", ex);
|
final String msg = String.format("Error extracting file `%s` with filter: %s",archive.toString(), ex.getMessage());
|
||||||
throw new ExtractionException("Archive file was not found.", ex);
|
LOGGER.debug(msg, ex);
|
||||||
|
throw new ExtractionException(msg);
|
||||||
} catch (IOException | ArchiveExtractionException ex) {
|
} catch (IOException | ArchiveExtractionException ex) {
|
||||||
LOGGER.warn("Exception extracting archive '{}'.", archive.getName());
|
LOGGER.warn("Exception extracting archive '{}'.", archive.getName());
|
||||||
LOGGER.debug("", ex);
|
LOGGER.debug("", ex);
|
||||||
|
|||||||
@@ -457,7 +457,8 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final String MAX_BATCH_SIZE = "database.batchinsert.maxsize";
|
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";
|
public static final String H2DB_SHUTDOWN_HOOK = "data.h2.shutdownhook";
|
||||||
|
|
||||||
@@ -522,6 +523,7 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public synchronized void cleanup(boolean deleteTemporary) {
|
public synchronized void cleanup(boolean deleteTemporary) {
|
||||||
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
||||||
|
LOGGER.debug("Deleting ALL temporary files from `{}`", tempDirectory.toString());
|
||||||
FileUtils.delete(tempDirectory);
|
FileUtils.delete(tempDirectory);
|
||||||
tempDirectory = null;
|
tempDirectory = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user