mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-27 19:41:38 +01:00
resolved null pointer exception
Former-commit-id: 3cc97c878a2bcc09c8a2cea3802278974d56b954
This commit is contained in:
@@ -291,17 +291,20 @@ public class ReportGenerator {
|
|||||||
* @throws Exception is thrown when an exception occurs.
|
* @throws Exception is thrown when an exception occurs.
|
||||||
*/
|
*/
|
||||||
protected void generateReport(String templateName, String outFileName) throws Exception {
|
protected void generateReport(String templateName, String outFileName) throws Exception {
|
||||||
final File outDir = new File(outFileName).getParentFile();
|
File outFile = new File(outFileName);
|
||||||
if (!outDir.exists()) {
|
if (outFile.getParentFile() == null) {
|
||||||
final boolean created = outDir.mkdirs();
|
outFile = new File(".", outFileName);
|
||||||
|
}
|
||||||
|
if (!outFile.getParentFile().exists()) {
|
||||||
|
final boolean created = outFile.getParentFile().mkdirs();
|
||||||
if (!created) {
|
if (!created) {
|
||||||
throw new Exception("Unable to create directory '" + outDir.getAbsolutePath() + "'.");
|
throw new Exception("Unable to create directory '" + outFile.getParentFile().getAbsolutePath() + "'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputStream outputSteam = null;
|
OutputStream outputSteam = null;
|
||||||
try {
|
try {
|
||||||
outputSteam = new FileOutputStream(outFileName);
|
outputSteam = new FileOutputStream(outFile);
|
||||||
generateReport(templateName, outputSteam);
|
generateReport(templateName, outputSteam);
|
||||||
} finally {
|
} finally {
|
||||||
if (outputSteam != null) {
|
if (outputSteam != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user