Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,13 @@ private static Predicate<ServiceComponent> distinctServicesByIdentity(
final var identitiesSeen = new HashSet<ComponentIdentity>();
return service -> {
final var componentIdentity = new ComponentIdentity(service);
identitiesByBomRef.putIfAbsent(service.getBomRef(), componentIdentity);
final boolean isBomRefUnique = identitiesByBomRef.putIfAbsent(service.getBomRef(), componentIdentity) == null;
if (!isBomRefUnique) {
LOGGER.warn("""
BOM ref %s is associated with multiple services in the BOM; \
BOM refs are required to be unique; Please report this to the vendor \
of the tool that generated the BOM""".formatted(service.getBomRef()));
}
bomRefsByIdentity.put(componentIdentity, service.getBomRef());
final boolean isSeenBefore = !identitiesSeen.add(componentIdentity);
if (LOGGER.isDebugEnabled() && isSeenBefore) {
Expand Down