mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-19 15:54:52 +01:00
minor bug fixes
Former-commit-id: f79fdb279ef60bebace4061a9df6d9a6e0cf818b
This commit is contained in:
@@ -229,10 +229,17 @@ public class JarAnalyzer extends AbstractAnalyzer {
|
|||||||
}
|
}
|
||||||
} else if (!entry.isDirectory() && "pom.properties".equals(entryName)) {
|
} else if (!entry.isDirectory() && "pom.properties".equals(entryName)) {
|
||||||
if (pomProperties == null) {
|
if (pomProperties == null) {
|
||||||
Reader reader = new InputStreamReader(zin, "UTF-8");
|
Reader reader = null;
|
||||||
|
try {
|
||||||
|
reader = new InputStreamReader(zin, "UTF-8");
|
||||||
pomProperties = new Properties();
|
pomProperties = new Properties();
|
||||||
pomProperties.load(reader);
|
pomProperties.load(reader);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
//zin.closeEntry closes the reader
|
||||||
|
//reader.close();
|
||||||
zin.closeEntry();
|
zin.closeEntry();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new AnalysisException("JAR file contains multiple pom.properties files - unable to process POM");
|
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 {
|
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();
|
java.util.Enumeration en = jar.entries();
|
||||||
|
|
||||||
HashMap<String, Integer> level0 = new HashMap<String, Integer>();
|
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.
|
* @throws IOException if there is an issue reading the JAR file.
|
||||||
*/
|
*/
|
||||||
protected void parseManifest(Dependency dependency) throws IOException {
|
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();
|
Manifest manifest = jar.getManifest();
|
||||||
if (manifest == null) {
|
if (manifest == null) {
|
||||||
Logger.getLogger(JarAnalyzer.class.getName()).log(Level.SEVERE,
|
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) {
|
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.
|
* @return whether or not the date is within the range.
|
||||||
*/
|
*/
|
||||||
private boolean withinRange(long date, long compareTo, int 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;
|
return differenceInDays < range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user