Skip to content

Migrate the last Commons Lang 2 usage to native Java - #1030

Open
timja wants to merge 1 commit into
jenkinsci:masterfrom
timja:commons-lang3
Open

Migrate the last Commons Lang 2 usage to native Java#1030
timja wants to merge 1 commit into
jenkinsci:masterfrom
timja:commons-lang3

Conversation

@timja

@timja timja commented Aug 8, 2026

Copy link
Copy Markdown
Member

#519 removed the Commons Lang 2 usages from this plugin, but it missed one file: PluginChangeMergedEvent, the sibling of PluginPatchsetCreatedEvent which that PR did migrate. It still has import org.apache.commons.lang.StringUtils on master, 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) becomes x != 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 install passes with the enforcer enabled.
  • Verified the enforcer is genuinely active, rather than silently skipping: restoring the Commons Lang 2 import with the property in place fails the build with Reason: Use Commons Lang 2 (org.apache.commons.lang.*).
  • PluginChangeMergedEventTest — 7 tests, 0 failures.

A related problem this does not fix

pct-build-failure-analyzer in jenkinsci/bom#6234 fails with NoClassDefFoundError: org/apache/commons/lang/StringUtils thrown from com.sonymobile.tools.gerrit.gerritevents.GerritHandler, reached through this plugin. That is the gerrit-events library rather than plugin code, so it needs sonyxperiadev/gerrit-events#131 to merge and release, then a gerrit-events bump here.


This change was prepared with AI assistance (Claude Code); it has been reviewed and built locally by me.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants