Skip to content

Commit

Permalink
fix(importCDX): Add logging for null metadata in sbom.
Browse files Browse the repository at this point in the history
Signed-off-by: Akshit Joshi <[email protected]>
  • Loading branch information
akshitjoshii authored and GMishx committed Jan 21, 2025
1 parent 41ea548 commit 975e30f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ private Attachment makeAttachmentFromContent(AttachmentContent attachmentContent
}

private Project createProject(org.cyclonedx.model.Component compMetadata) {
if (compMetadata == null) {
log.error("Component metadata is null. Unable to create project.");
throw new IllegalArgumentException("Unable to create project due to incorrect metadata");
}
return new Project(CommonUtils.nullToEmptyString(compMetadata.getName()).trim())
.setVersion(CommonUtils.nullToEmptyString(compMetadata.getVersion()).trim())
.setDescription(CommonUtils.nullToEmptyString(compMetadata.getDescription()).trim()).setType(ThriftEnumUtils.enumToString(ProjectType.PRODUCT))
Expand Down

0 comments on commit 975e30f

Please sign in to comment.