Skip to content

Commit

Permalink
Merge pull request #342 from udda1996/fix-indexing
Browse files Browse the repository at this point in the history
Fix indexing issue in distribution list
  • Loading branch information
udda1996 authored Feb 6, 2024
2 parents c8a22ba + 0ee5021 commit b3a30f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/ballerinalang/command/util/ToolUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,14 @@ public static List<Channel> getDistributions(PrintStream printStream) {
}

matcher = Pattern.compile("\"name\":\"(.*?)\"").matcher(json);
i = 0;
int distIndex = 0;
int count = 0;
while (matcher.find()) {
if (count++ % 2 == 0) {
distributions.get(i++).setName(matcher.group(1));
distributions.get(distIndex).setName(matcher.group(1));
} else {
distributions.get(i++).setDependency(matcher.group(1));
distributions.get(distIndex).setDependency(matcher.group(1));
distIndex++;
}
}

Expand Down

0 comments on commit b3a30f5

Please sign in to comment.