Skip to content

Commit

Permalink
Merge pull request #1002 from blackducksoftware/dev/IDETECT-4046-Tran…
Browse files Browse the repository at this point in the history
…sformer-Fix

Fix to parse a:v in transformer for Rapid scans
  • Loading branch information
Madhu authored Nov 29, 2023
2 parents b9d470d + 9d4e0a7 commit f83792e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ private Set<Component> convertExternalIDsToComponentList(HashMap<String, ScanMet
for (String componentIdString : orderedComponentIDs) {
JsonObject jsonObject = getJsonObjectFromScanMetadata(componentIdWithMetadata.get(componentIdString));
String[] parts;
if ((parts = componentIdString.split(":")).length == 3) {
// For Maven and Gradle, the componentId is of the form "g:a:v"
componentSet.add(new Component(parts[0], parts[1], parts[2], jsonObject));
if ((parts = componentIdString.split(":")).length > 1) {
if (parts.length == 2) {
// The componentId is of the form "a:v"
componentSet.add(new Component(null, parts[0], parts[1], jsonObject));
} else if (parts.length == 3) {
// For Maven and Gradle, the componentId is of the form "g:a:v"
componentSet.add(new Component(parts[0], parts[1], parts[2], jsonObject));
}
} else if ((parts = componentIdString.split("/")).length == 2) {
// For NPM and NuGet, the componentId looks is of the form "a/v"
componentSet.add(new Component(null, parts[0], parts[1], jsonObject));
Expand Down

0 comments on commit f83792e

Please sign in to comment.