From f25a406c51594ed598e760c8c9b2856d15edfc2a Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Fri, 28 Jan 2022 11:09:38 +0000 Subject: [PATCH] Use ID if provided otherwise generate one --- core/src/main/java/hudson/Functions.java | 5 +++-- core/src/main/resources/lib/form/radio.jelly | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 8b8c84cc5593..5c690f7637f1 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -2290,8 +2290,9 @@ public static boolean isContextMenuVisible(Action a) { } } + @SuppressFBWarnings(value = "PREDICTABLE_RANDOM", justification = "True randomness isn't necessary for form item IDs") @Restricted(NoExternalUse.class) - public static String generateItemId(String id) { - return Math.floor(Math.random() * 3000) + "-" + id; + public static String generateItemId() { + return String.valueOf(Math.floor(Math.random() * 3000)); } } diff --git a/core/src/main/resources/lib/form/radio.jelly b/core/src/main/resources/lib/form/radio.jelly index a8726b059aa4..6df5cfbe5454 100644 --- a/core/src/main/resources/lib/form/radio.jelly +++ b/core/src/main/resources/lib/form/radio.jelly @@ -43,7 +43,7 @@ THE SOFTWARE. toggles the radio. - +