Skip to content

Commit

Permalink
fix generator exception error
Browse files Browse the repository at this point in the history
Signed-off-by: Nicklas Körtge <[email protected]>
  • Loading branch information
n1ckl0sk0rtge committed Sep 19, 2024
1 parent b7396bc commit 6cfd833
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/ibm/resources/v1/ScannerResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -266,7 +265,7 @@ private Optional<JsonNode> 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();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/ibm/scan/IScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void setDuration(long duration) {
}

@Nonnull
public Optional<JsonNode> toJson() throws JsonProcessingException {
public Optional<JsonNode> toJson() throws JsonProcessingException, GeneratorException {
final ObjectMapper mapper = new ObjectMapper();
if (bom != null) {
final BomJsonGenerator bomGenerator =
Expand Down

0 comments on commit 6cfd833

Please sign in to comment.