findbugs fixes

Former-commit-id: 390c00542b8ee16746118126bd9d6b7f4f98b546
This commit is contained in:
Jeremy Long
2013-06-03 20:07:39 -04:00
parent 0ea29b3d7c
commit 92d306f777
2 changed files with 9 additions and 8 deletions

View File

@@ -224,8 +224,6 @@ public class JarAnalyzer extends AbstractAnalyzer implements Analyzer {
* @throws AnalysisException is thrown if there is an exception parsing the pom.
* @return whether or not evidence was added to the dependency
*/
//@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "OS_OPEN_STREAM",
//justification = "The reader on line 259 is closed by closing the zipEntry")
protected boolean analyzePOM(Dependency dependency) throws AnalysisException {
boolean foundSomething = false;
final JarFile jar;
@@ -238,7 +236,6 @@ public class JarAnalyzer extends AbstractAnalyzer implements Analyzer {
Logger.getLogger(JarAnalyzer.class.getName()).log(Level.WARNING, msg, ex);
return foundSomething;
}
final List<Model> poms = new ArrayList<Model>();
List<String> pomEntries;
try {
pomEntries = retrievePomListing(jar);
@@ -283,6 +280,8 @@ public class JarAnalyzer extends AbstractAnalyzer implements Analyzer {
* @return a Properties object or null if no pom.properties was found
* @throws IOException thrown if there is an exception reading the pom.properties
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "OS_OPEN_STREAM",
justification = "The reader is closed by closing the zipEntry")
private Properties retrievePomProperties(String path, final JarFile jar) throws IOException {
Properties pomProperties = null;
String propPath = path.substring(0, path.length() - 7) + "pom.properies";
@@ -726,7 +725,7 @@ public class JarAnalyzer extends AbstractAnalyzer implements Analyzer {
* within the text.
* @return the interpolated text.
*/
private String interpolateString(String text, Properties properties) {
protected String interpolateString(String text, Properties properties) {
//${project.build.directory}
if (properties == null || text == null) {
return text;

View File

@@ -140,21 +140,23 @@ public class DatabaseUpdater implements CachedWebDataSource {
} catch (ClassNotFoundException ex) {
throw new UpdateException(ex);
} finally {
boolean deleted = false;
try {
if (outputPath != null && outputPath.exists()) {
outputPath.delete();
deleted = outputPath.delete();
}
} finally {
if (outputPath != null && outputPath.exists()) {
if (outputPath != null && (outputPath.exists() || !deleted)) {
outputPath.deleteOnExit();
}
}
try {
deleted = false;
if (outputPath12 != null && outputPath12.exists()) {
outputPath12.delete();
deleted = outputPath12.delete();
}
} finally {
if (outputPath12 != null && outputPath12.exists()) {
if (outputPath12 != null && (outputPath12.exists() || !deleted)) {
outputPath12.deleteOnExit();
}
}