From f438cb15f70db86481abc7cb8a019f8de5cdfee3 Mon Sep 17 00:00:00 2001 From: Tim Jacomb Date: Mon, 3 Aug 2026 09:47:22 +0100 Subject: [PATCH] Remove usages of Commons Lang 2 --- pom.xml | 5 +++++ .../plugins/folderauth/FolderAuthorizationStrategyAPI.java | 7 +++---- .../plugins/folderauth/FolderAuthorizationWebAPITest.java | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index c019d42..aa41ec9 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,11 @@ + + io.jenkins.plugins + commons-lang3-api + test + org.jenkins-ci.plugins cloudbees-folder diff --git a/src/main/java/io/jenkins/plugins/folderauth/FolderAuthorizationStrategyAPI.java b/src/main/java/io/jenkins/plugins/folderauth/FolderAuthorizationStrategyAPI.java index 27a312b..3f94375 100644 --- a/src/main/java/io/jenkins/plugins/folderauth/FolderAuthorizationStrategyAPI.java +++ b/src/main/java/io/jenkins/plugins/folderauth/FolderAuthorizationStrategyAPI.java @@ -5,7 +5,6 @@ import io.jenkins.plugins.folderauth.roles.FolderRole; import io.jenkins.plugins.folderauth.roles.GlobalRole; import jenkins.model.Jenkins; -import org.apache.commons.lang.StringUtils; import javax.annotation.ParametersAreNonnullByDefault; import java.util.HashSet; @@ -119,7 +118,7 @@ public static void addAgentRole(AgentRole role) { * @throws IllegalArgumentException when the {@code sid} is empty */ public static void assignSidToGlobalRole(String sid, String roleName) { - if (StringUtils.isBlank(sid)) { + if (sid == null || sid.isBlank()) { throw new IllegalArgumentException("Sid should not be blank."); } @@ -144,7 +143,7 @@ public static void assignSidToGlobalRole(String sid, String roleName) { * @throws IllegalArgumentException when the {@code sid} is empty */ public static void assignSidToAgentRole(String sid, String roleName) { - if (StringUtils.isBlank(sid)) { + if (sid == null || sid.isBlank()) { throw new IllegalArgumentException("Sid should not be blank."); } @@ -169,7 +168,7 @@ public static void assignSidToAgentRole(String sid, String roleName) { * @throws IllegalArgumentException when the {@code sid} is empty */ public static void assignSidToFolderRole(String sid, String roleName) { - if (StringUtils.isBlank(sid)) { + if (sid == null || sid.isBlank()) { throw new IllegalArgumentException("Sid should not be blank."); } diff --git a/src/test/java/io/jenkins/plugins/folderauth/FolderAuthorizationWebAPITest.java b/src/test/java/io/jenkins/plugins/folderauth/FolderAuthorizationWebAPITest.java index b914bce..69a584e 100644 --- a/src/test/java/io/jenkins/plugins/folderauth/FolderAuthorizationWebAPITest.java +++ b/src/test/java/io/jenkins/plugins/folderauth/FolderAuthorizationWebAPITest.java @@ -15,7 +15,7 @@ import java.util.Map; import java.util.Set; import net.sf.json.JSONObject; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.htmlunit.HttpMethod; import org.htmlunit.Page; import org.htmlunit.WebRequest;