ensured resources are closed

This commit is contained in:
Jeremy Long
2016-11-22 06:39:50 -05:00
parent 6838b9b950
commit 316b936326

View File

@@ -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