mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-04-10 02:44:02 +02:00
minor bug fixes
Former-commit-id: a605c8a5f8dbf18186cdfc6e4460956702100339
This commit is contained in:
@@ -229,10 +229,17 @@ public class JarAnalyzer extends AbstractAnalyzer {
|
||||
}
|
||||
} else if (!entry.isDirectory() && "pom.properties".equals(entryName)) {
|
||||
if (pomProperties == null) {
|
||||
Reader reader = new InputStreamReader(zin, "UTF-8");
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new InputStreamReader(zin, "UTF-8");
|
||||
pomProperties = new Properties();
|
||||
pomProperties.load(reader);
|
||||
}
|
||||
finally {
|
||||
//zin.closeEntry closes the reader
|
||||
//reader.close();
|
||||
zin.closeEntry();
|
||||
}
|
||||
} else {
|
||||
throw new AnalysisException("JAR file contains multiple pom.properties files - unable to process POM");
|
||||
}
|
||||
@@ -327,7 +334,10 @@ public class JarAnalyzer extends AbstractAnalyzer {
|
||||
*/
|
||||
protected void analyzePackageNames(Dependency dependency) throws IOException {
|
||||
|
||||
JarFile jar = new JarFile(dependency.getActualFilePath());
|
||||
JarFile jar = null;
|
||||
try {
|
||||
jar = new JarFile(dependency.getActualFilePath());
|
||||
|
||||
java.util.Enumeration en = jar.entries();
|
||||
|
||||
HashMap<String, Integer> level0 = new HashMap<String, Integer>();
|
||||
@@ -466,6 +476,11 @@ public class JarAnalyzer extends AbstractAnalyzer {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (jar != null) {
|
||||
jar.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,7 +495,10 @@ public class JarAnalyzer extends AbstractAnalyzer {
|
||||
* @throws IOException if there is an issue reading the JAR file.
|
||||
*/
|
||||
protected void parseManifest(Dependency dependency) throws IOException {
|
||||
JarFile jar = new JarFile(dependency.getActualFilePath());
|
||||
JarFile jar = null;
|
||||
try {
|
||||
jar = new JarFile(dependency.getActualFilePath());
|
||||
|
||||
Manifest manifest = jar.getManifest();
|
||||
if (manifest == null) {
|
||||
Logger.getLogger(JarAnalyzer.class.getName()).log(Level.SEVERE,
|
||||
@@ -556,6 +574,11 @@ public class JarAnalyzer extends AbstractAnalyzer {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (jar != null) {
|
||||
jar.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addDescription(Dependency d, String description) {
|
||||
|
||||
@@ -395,7 +395,7 @@ public class IndexUpdater extends Index implements CachedWebDataSource {
|
||||
* @return whether or not the date is within the range.
|
||||
*/
|
||||
private boolean withinRange(long date, long compareTo, int range) {
|
||||
double differenceInDays = (compareTo - date) / 1000 / 60 / 60 / 24;
|
||||
double differenceInDays = (compareTo - date) / 1000.0 / 60.0 / 60.0 / 24.0;
|
||||
return differenceInDays < range;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user