Further reduce usages of StringUtils (#9044)

* Remove usages of StringUtils#containsIgnoreCase

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#removeStart StringUtils#removeEnd

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#defaultString

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#defaultIfBlank

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#isAlphanumeric

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils.EMPTY

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#split

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#startsWithIgnoreCase

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#countMatches

Signed-off-by: Bob Du <i@bobdu.cc>

* Remove usages of StringUtils#endsWithAny

Signed-off-by: Bob Du <i@bobdu.cc>

* fix spotbugs warning

Signed-off-by: Bob Du <i@bobdu.cc>

* Use Objects.toString

Signed-off-by: Bob Du <i@bobdu.cc>

* revert unrelated change

Signed-off-by: Bob Du <i@bobdu.cc>

---------

Signed-off-by: Bob Du <i@bobdu.cc>
This commit is contained in:
Bob Du authored and GitHub committed 2024-03-27 06:38:23 -06:00
1 parent e914bb6d76
commit 8197702484
17 files changed
+53 -43

No files matched your search

+6 -2
View File
@@ -73,7 +73,6 @@ import jenkins.model.Jenkins;
import jenkins.plugins.DetachedPluginsUtil;
import jenkins.security.UpdateSiteWarningsMonitor;
import jenkins.util.URLClassLoader2;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.LogFactory;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;
@@ -497,7 +496,12 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
@Override
public String getDisplayName() {
return StringUtils.removeStart(getLongName(), "Jenkins ");
String displayName = getLongName();
String removePrefix = "Jenkins ";
if (displayName != null && displayName.startsWith(removePrefix)) {
return displayName.substring(removePrefix.length());
}
return displayName;
}
public Api getApi() {