checkstyle and findbugs corrections

Former-commit-id: 2bf90876b7c88bccb93135a0be43f01e49c3cd30
This commit is contained in:
Jeremy Long
2014-08-30 15:51:24 -04:00
parent b6b070584f
commit fc0a556e5f
2 changed files with 32 additions and 12 deletions

View File

@@ -92,7 +92,7 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
* The path to the verbose log.
*/
@Parameter(property = "logfile", defaultValue = "")
private String logFile;
private String logFile = null;
/**
* The output directory. This generally maps to "target".
*/
@@ -815,21 +815,41 @@ public class DependencyCheckMojo extends ReportAggregationMojo {
File file = null;
if (engine != null && getProject().getContextValue(this.getDataFileContextKey()) == null) {
file = new File(getProject().getBuild().getDirectory(), getDataFileName());
OutputStream os = null;
OutputStream bos = null;
ObjectOutput out = null;
try {
final OutputStream os = new FileOutputStream(file);
final OutputStream bos = new BufferedOutputStream(os);
final ObjectOutput out = new ObjectOutputStream(bos);
try {
out.writeObject(engine.getDependencies());
out.flush();
} finally {
out.close();
}
//getProject().setContextValue(this.getDataFileContextKey(), file.getAbsolutePath());
os = new FileOutputStream(file);
bos = new BufferedOutputStream(os);
out = new ObjectOutputStream(bos);
out.writeObject(engine.getDependencies());
out.flush();
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Unable to create data file used for report aggregation; "
+ "if report aggregation is being used the results may be incomplete.");
LOGGER.log(Level.FINE, ex.getMessage(), ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException ex) {
LOGGER.log(Level.FINEST, "ignore", ex);
}
}
if (bos != null) {
try {
bos.close();
} catch (IOException ex) {
LOGGER.log(Level.FINEST, "ignore", ex);
}
}
if (os != null) {
try {
os.close();
} catch (IOException ex) {
LOGGER.log(Level.FINEST, "ignore", ex);
}
}
}
}
return file;

View File

@@ -394,7 +394,7 @@ public abstract class ReportAggregationMojo extends AbstractMojo implements Mave
proj.getName());
LOGGER.warning(msg);
} else {
File outputFile = new File((String) path);
final File outputFile = new File((String) path);
if (outputFile.exists()) {
files.add(outputFile);
} else {