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