From 6adecf4cb2c8d3c1a7f1b8b3c1509be2b92ed73e Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 3 Aug 2023 14:52:14 +0100 Subject: [PATCH] Fix handling of potential ugrade issues with no space in title --- .../boot/build/bom/bomr/UpgradeDependencies.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java index ae2625c0e4..de577de367 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java @@ -188,9 +188,12 @@ public abstract class UpgradeDependencies extends DefaultTask { private Issue findExistingUpgradeIssue(List existingUpgradeIssues, Upgrade upgrade) { String toMatch = "Upgrade to " + upgrade.getLibrary().getName(); for (Issue existingUpgradeIssue : existingUpgradeIssues) { - if (existingUpgradeIssue.getTitle() - .substring(0, existingUpgradeIssue.getTitle().lastIndexOf(' ')) - .equals(toMatch)) { + String title = existingUpgradeIssue.getTitle(); + int lastSpaceIndex = title.lastIndexOf(' '); + if (lastSpaceIndex > -1) { + title = title.substring(0, lastSpaceIndex); + } + if (title.equals(toMatch)) { return existingUpgradeIssue; } }