Skip to content

Commit

Permalink
Handle preliminary end
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmitterdorfer committed Jul 17, 2023
1 parent 9d3d546 commit edf0a95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ public boolean isMatchWithoutVersion(String indexName) {

private boolean isVersionNumber(String name, int startIndex) {
final int versionNumberLength = 3;
return name.substring(startIndex, startIndex + versionNumberLength).chars().allMatch(Character::isDigit);
String versionNumberCandidate = name.substring(startIndex, Math.min(startIndex + versionNumberLength, name.length()));
return versionNumberCandidate.length() == versionNumberLength && versionNumberCandidate.chars().allMatch(Character::isDigit);
}

public boolean isMatchWithoutGeneration(String indexName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ public void testIndexMatchWithoutVersion() {
assertTrue(idx.isMatchWithoutVersion(".profiling-test-v002"));
assertFalse(idx.isMatchWithoutVersion(".profiling-testing-v001"));
assertFalse(idx.isMatchWithoutVersion(".profiling-test-verbose"));
assertFalse(idx.isMatchWithoutVersion(".profiling-test-v"));
}

private ActionResponse verifyIndexInstalled(
Expand Down

0 comments on commit edf0a95

Please sign in to comment.