Skip to content

Migrate Commons Lang from 2 to 3#2797

Open
jonesbusy wants to merge 1 commit intojenkinsci:masterfrom
jonesbusy-automation:plugin-modernizer/migratecommonslang2tolang3andcommontext
Open

Migrate Commons Lang from 2 to 3#2797
jonesbusy wants to merge 1 commit intojenkinsci:masterfrom
jonesbusy-automation:plugin-modernizer/migratecommonslang2tolang3andcommontext

Conversation

@jonesbusy
Copy link
Copy Markdown
Contributor

Hello kubernetes developers! 👋

This is an automated pull request created by the Jenkins Plugin Modernizer tool. The tool has applied the following recipes to modernize the plugin:

Migrate Commons Lang from 2 to 3 and StringEscapeUtils to Commons Text

io.jenkins.tools.pluginmodernizer.MigrateCommonsLang2ToLang3AndCommonText

Migrate Commons Lang from 2 to 3 and StringEscapeUtils to Commons Text.

This pull request upgrades Apache Commons Lang 2 to Apache Commons Lang 3. Additionally, if the plugin uses StringEscapeUtils from Apache Commons Lang, it will be migrated to use Apache Commons Text instead.
The Apache Commons community recommends using Apache Commons Text for string escaping operations, as it offers a more focused and feature-rich API for text processing.

What's Changed?

  • Migrated from deprecated/EOL Apache Commons Lang 2 to Commons Lang 3.
  • If applicable: Transitioned from deprecated/EOL StringEscapeUtils in Apache Commons Lang to Commons Text.

Copy link
Copy Markdown
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to have CL2 usages replaced with plain Java idioms rather than introducing the new dep. (To src/main/java/; do not care about test-scoped deps.) Do we not have an automatic translator for the common cases?

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate.notNull(podTemplate);
Validate.notNull(cloud);
better handled with Objects

import java.util.TreeMap;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonesbusy
Copy link
Copy Markdown
Contributor Author

Sure. The OpenRewrite recipe I have naively replace it with common lang3.

When it is not wanted I just use copilot AI assisted PR to perform Java 17 native API changes. Most of the time it gives good results.

@cronik cronik mentioned this pull request Mar 22, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants