diff --git a/src/main/java/com/ibm/resources/v1/ScannerResource.java b/src/main/java/com/ibm/resources/v1/ScannerResource.java index 209b01a53..d0722b711 100644 --- a/src/main/java/com/ibm/resources/v1/ScannerResource.java +++ b/src/main/java/com/ibm/resources/v1/ScannerResource.java @@ -19,7 +19,6 @@ */ package com.ibm.resources.v1; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.ibm.Utils; @@ -266,7 +265,7 @@ private Optional runScan( .scan(iMessageDispatcher, clonedProject.cloneDir, scanRequest); try { return scanResult.toJson(); - } catch (JsonProcessingException jpe) { + } catch (Exception jpe) { LOG.error("Cannot parse CBOM", jpe); } return Optional.empty(); diff --git a/src/main/java/com/ibm/scan/IScanner.java b/src/main/java/com/ibm/scan/IScanner.java index d0c4d89f3..a4db068f4 100644 --- a/src/main/java/com/ibm/scan/IScanner.java +++ b/src/main/java/com/ibm/scan/IScanner.java @@ -29,6 +29,7 @@ import java.util.Optional; import javax.annotation.Nonnull; import org.cyclonedx.Version; +import org.cyclonedx.exception.GeneratorException; import org.cyclonedx.generators.BomGeneratorFactory; import org.cyclonedx.generators.json.BomJsonGenerator; import org.cyclonedx.model.Bom; @@ -84,7 +85,7 @@ public void setDuration(long duration) { } @Nonnull - public Optional toJson() throws JsonProcessingException { + public Optional toJson() throws JsonProcessingException, GeneratorException { final ObjectMapper mapper = new ObjectMapper(); if (bom != null) { final BomJsonGenerator bomGenerator =