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

View File

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