Skip to content

Commit

Permalink
fix(aggregate): Added a safeguard for docker image being present or c…
Browse files Browse the repository at this point in the history
…reator not being present. (Fixes IDETECT-1453)
  • Loading branch information
taikuukaits committed Jun 17, 2019
1 parent 6142721 commit 8209ca9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class AggregateBdioCreator {
private final DetectBdioWriter detectBdioWriter;

public AggregateBdioCreator(final SimpleBdioFactory simpleBdioFactory, final IntegrationEscapeUtil integrationEscapeUtil,
final CodeLocationNameManager codeLocationNameManager, final DetectConfiguration detectConfiguration, DetectBdioWriter detectBdioWriter) {
final CodeLocationNameManager codeLocationNameManager, final DetectConfiguration detectConfiguration, DetectBdioWriter detectBdioWriter) {
this.simpleBdioFactory = simpleBdioFactory;
this.integrationEscapeUtil = integrationEscapeUtil;
this.codeLocationNameManager = codeLocationNameManager;
Expand Down Expand Up @@ -113,7 +113,13 @@ private Dependency createAggregateDependency(File sourcePath, final DetectCodeLo
final File codeLocationSourceDir = new File(codeLocationSourcePath);
final String relativePath = FileNameUtils.relativize(sourcePath.getAbsolutePath(), codeLocationSourceDir.getAbsolutePath());

final String bomToolType = codeLocation.getCreatorName().get().toLowerCase();
String bomToolType;
if (codeLocation.getDockerImageName().isPresent()) {
bomToolType = "docker"; // TODO: Should docker image name be considered here?
} else {
bomToolType = codeLocation.getCreatorName().orElse("unknown").toLowerCase();
}

final List<String> externalIdPieces = new ArrayList<>();
externalIdPieces.addAll(Arrays.asList(original.getExternalIdPieces()));
externalIdPieces.add(relativePath);
Expand Down

0 comments on commit 8209ca9

Please sign in to comment.