Skip to content

Conversation

@andreas-hilti
Copy link
Contributor

Fixes a couple of issues discovered while working on merge functionality

@andreas-hilti andreas-hilti requested a review from a team as a code owner September 28, 2025 17:25
Signed-off-by: andreas hilti <69210561+andreas-hilti@users.noreply.github.com>
result.Vulnerabilities = vulnerabilitiesMerger.Merge(bom1.Vulnerabilities, bom2.Vulnerabilities);

if (bom1.Definitions != null && bom2.Definitions != null)
if (bom1.Definitions != null || bom2.Definitions != null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitions were skipped if not all BOMs had them.

}

if (bom1.Declarations != null && bom2.Declarations != null)
if (bom1.Declarations != null || bom2.Declarations != null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, Declarations were skipped if not all BOMs had them.

result.Declarations.Targets.Organizations = new ListMergeHelper<OrganizationalEntity>().Merge(bom1.Declarations.Targets.Organizations, bom2.Declarations.Targets.Organizations);
result.Declarations.Targets.Components = new ListMergeHelper<Component>().Merge(bom1.Declarations.Targets.Components, bom2.Declarations.Targets.Components);
result.Declarations.Targets.Services = new ListMergeHelper<Service>().Merge(bom1.Declarations.Targets.Services, bom2.Declarations.Targets.Services);
result.Declarations.Targets = new Targets();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Targets wasn't initialized.


if (bomSubject != null)
{
if (result.Metadata == null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata wasn't initialized.

}
}

if (result.Dependencies == null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies were not initialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant