mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 00:03:43 +01:00
ensured resources are closed
This commit is contained in:
@@ -280,31 +280,39 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
||||
return false;
|
||||
}
|
||||
if (pomEntries != null && pomEntries.size() <= 1) {
|
||||
String path = null;
|
||||
Properties pomProperties = null;
|
||||
File pomFile = null;
|
||||
if (pomEntries.size() == 1) {
|
||||
path = pomEntries.get(0);
|
||||
pomFile = extractPom(path, jar);
|
||||
pomProperties = retrievePomProperties(path, jar);
|
||||
} else {
|
||||
path = FilenameUtils.removeExtension(dependency.getActualFilePath()) + ".pom";
|
||||
pomFile = new File(path);
|
||||
}
|
||||
if (pomFile.isFile()) {
|
||||
Model pom = PomUtils.readPom(pomFile);
|
||||
if (pom != null && pomProperties != null) {
|
||||
pom.processProperties(pomProperties);
|
||||
try {
|
||||
String path = null;
|
||||
Properties pomProperties = null;
|
||||
File pomFile = null;
|
||||
if (pomEntries.size() == 1) {
|
||||
path = pomEntries.get(0);
|
||||
pomFile = extractPom(path, jar);
|
||||
pomProperties = retrievePomProperties(path, jar);
|
||||
} else {
|
||||
path = FilenameUtils.removeExtension(dependency.getActualFilePath()) + ".pom";
|
||||
pomFile = new File(path);
|
||||
}
|
||||
if (pom != null) {
|
||||
return setPomEvidence(dependency, pom, classes);
|
||||
if (pomFile.isFile()) {
|
||||
Model pom = PomUtils.readPom(pomFile);
|
||||
if (pom != null && pomProperties != null) {
|
||||
pom.processProperties(pomProperties);
|
||||
}
|
||||
if (pom != null) {
|
||||
return setPomEvidence(dependency, pom, classes);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
jar.close();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.trace("", ex);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//reported possible null dereference on pomEntries is on a non-feasible path
|
||||
for (String path : pomEntries) {
|
||||
//TODO - one of these is likely the pom for the main JAR we are analyzing
|
||||
|
||||
Reference in New Issue
Block a user