Migrate the last Commons Lang 2 usage to native Java - #1030
Open
timja wants to merge 1 commit into
Open
Conversation
jenkinsci#519 migrated PluginPatchsetCreatedEvent but missed the sibling PluginChangeMergedEvent, which still imported Commons Lang 2. Also enables ban-commons-lang-2 so the enforcer catches any future regression -- had it been on, the missed file would have failed the build at the time.
rsandell
approved these changes
Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#519 removed the Commons Lang 2 usages from this plugin, but it missed one file:
PluginChangeMergedEvent, the sibling ofPluginPatchsetCreatedEventwhich that PR did migrate. It still hasimport org.apache.commons.lang.StringUtilsonmaster, so the plugin will break at runtime once Jenkins core stops exposing Commons Lang 2 (jenkinsci/jenkins#26105).This applies exactly the same transformation #519 used on the sibling file —
StringUtils.isNotEmpty(x)becomesx != null && !x.isEmpty()— so no new dependency is introduced.It also sets
<ban-commons-lang-2.skip>false</ban-commons-lang-2.skip>. That property was never enabled here, which is precisely why the missed file went unnoticed: the enforcer rule was not running. With it on, a regression fails the build.Testing done
mvn clean installpasses with the enforcer enabled.Reason: Use Commons Lang 2 (org.apache.commons.lang.*).PluginChangeMergedEventTest— 7 tests, 0 failures.A related problem this does not fix
pct-build-failure-analyzerin jenkinsci/bom#6234 fails withNoClassDefFoundError: org/apache/commons/lang/StringUtilsthrown fromcom.sonymobile.tools.gerrit.gerritevents.GerritHandler, reached through this plugin. That is thegerrit-eventslibrary rather than plugin code, so it needs sonyxperiadev/gerrit-events#131 to merge and release, then agerrit-eventsbump here.This change was prepared with AI assistance (Claude Code); it has been reviewed and built locally by me.