Skip to content

Commit 975e30f

Browse files
akshitjoshiiGMishx
authored andcommitted
fix(importCDX): Add logging for null metadata in sbom.
Signed-off-by: Akshit Joshi <akshit.joshi@siemens-healthineers.com>
1 parent 41ea548 commit 975e30f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

backend/common/src/main/java/org/eclipse/sw360/cyclonedx/CycloneDxBOMImporter.java

+4
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ private Attachment makeAttachmentFromContent(AttachmentContent attachmentContent
816816
}
817817

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

0 commit comments

Comments
 (0)