Skip to content

Commit

Permalink
🚧 - building impact paths before creating the full impact graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
noyshabtay committed Nov 8, 2023
1 parent 73ec45d commit cd6a068
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/java/com/jfrog/ide/common/yarn/YarnTreeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,19 @@ private List<String> extractSinglePath(String packageFullName, String rawDepende
// return the package name
return Collections.singletonList(packageFullName);
}
int startIndex = rawDependency.indexOf('"');
int endIndex = rawDependency.indexOf('"', startIndex + 1);
int startIndex = StringUtils.indexOf(rawDependency, '"');
int endIndex = StringUtils.indexOf(rawDependency, '"', startIndex + 1);

if (startIndex != -1 && endIndex != -1) {
// split the path by #
String[] split = rawDependency.substring(startIndex + 1, endIndex).split("#");
return Arrays.asList(split);
String[] splitPath = StringUtils.split(StringUtils.substring(rawDependency, startIndex + 1, endIndex), "#");

// packageFullName is guaranteed to be the last element in the path
if (!StringUtils.equals(splitPath[splitPath.length - 1], (StringUtils.substringBefore(packageFullName, ":")))) {
splitPath = Arrays.copyOf(splitPath, splitPath.length + 1);
}
splitPath[splitPath.length - 1] = packageFullName;
return Arrays.asList(splitPath);
}
return null;
}
Expand Down

0 comments on commit cd6a068

Please sign in to comment.