Skip to content

Commit

Permalink
Fix build randomization to account for null strings (elastic#101019)
Browse files Browse the repository at this point in the history
Since adding qualifier as a nullable string, the build utils which
mutates Build objects for tests may experience an NPE. This commit
handles null for string values.

closes elastic#100994
  • Loading branch information
rjernst authored Oct 18, 2023
1 parent e001c91 commit aada7d5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static Build mutateBuild(Build existing) {
}

private static String randomStringExcept(final String s) {
return randomAlphaOfLength(13 - s.length());
int len = s == null ? 0 : s.length();
return randomAlphaOfLength(13 - len);
}
}

0 comments on commit aada7d5

Please sign in to comment.