mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-23 09:31:32 +01:00
updated error handling for issue #821
This commit is contained in:
@@ -395,9 +395,9 @@ public class ReportGenerator {
|
|||||||
* Reformats the given JSON file.
|
* Reformats the given JSON file.
|
||||||
*
|
*
|
||||||
* @param pathToJson the path to the JSON file to be reformatted
|
* @param pathToJson the path to the JSON file to be reformatted
|
||||||
* @throws JsonSyntaxException thrown if the given JSON file is malformed
|
* @throws ReportException thrown if the given JSON file is malformed
|
||||||
*/
|
*/
|
||||||
private void pretifyJson(String pathToJson) throws JsonSyntaxException {
|
private void pretifyJson(String pathToJson) throws ReportException {
|
||||||
final String outputPath = pathToJson + ".pretty";
|
final String outputPath = pathToJson + ".pretty";
|
||||||
final File in = new File(pathToJson);
|
final File in = new File(pathToJson);
|
||||||
final File out = new File(outputPath);
|
final File out = new File(outputPath);
|
||||||
@@ -405,8 +405,8 @@ public class ReportGenerator {
|
|||||||
JsonWriter writer = new JsonWriter(new OutputStreamWriter(new FileOutputStream(out), StandardCharsets.UTF_8))) {
|
JsonWriter writer = new JsonWriter(new OutputStreamWriter(new FileOutputStream(out), StandardCharsets.UTF_8))) {
|
||||||
prettyPrint(reader, writer);
|
prettyPrint(reader, writer);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
LOGGER.error("Unable to generate pretty report, caused by: ", ex.getMessage());
|
LOGGER.debug("Malformed JSON?", ex);
|
||||||
return;
|
throw new ReportException("Unable to generate json report", ex);
|
||||||
}
|
}
|
||||||
if (out.isFile() && in.isFile() && in.delete()) {
|
if (out.isFile() && in.isFile() && in.delete()) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user