Skip to content

Migrate Commons Lang 2 to 3 using API plugins#174

Closed
alecharp wants to merge 2 commits intojenkinsci:masterfrom
alecharp:chore/migratio-commons-lang-2-to-3
Closed

Migrate Commons Lang 2 to 3 using API plugins#174
alecharp wants to merge 2 commits intojenkinsci:masterfrom
alecharp:chore/migratio-commons-lang-2-to-3

Conversation

@alecharp
Copy link
Member

The plugin is using Commons Lang 2.6 library, implied because packaged in Jenkins Core. This might not continue (jenkinsci/jenkins#26105).

This pull request migrate the code to use Commons Lang 3 and Commons Text libraries.

Testing done

I ran mvn verify locally

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@alecharp alecharp requested a review from a team as a code owner January 15, 2026 15:56
Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

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

StringUtils could be removed as it is a few uses that are trivial to do in Java 17
commons-text has a dependency on commons-lang3 in any case 🤷

Text blocks were added to Java in version 15
Copy link
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.

-0 I guess. Let me see if I can fix this up properly.

import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
Copy link
Member

Choose a reason for hiding this comment

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

An example of a completely gratuitous use of StringUtils that would better be replaced with a simpler idiom using only types defined in the Java Platform.

final String context = getContext();
//Functions.jsStringEscape() is also an alternative though the one below escapes more stuff
return context != null ? StringEscapeUtils.escapeJavaScript(context) : null;
return context != null ? StringEscapeUtils.escapeEcmaScript(context) : null;
Copy link
Member

Choose a reason for hiding this comment

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

fetch(document.querySelector('#params').dataset.descriptor + '/parameters?job=' + encodeURIComponent(document.getElementById(document.querySelector('#params').dataset.jobfield).value) + '&context=${descriptor.contextEncoded}').then((rsp) => {
should be fixed to use data-* attributes idiomatically, in which case we should not need either of these lib deps.

@jglick jglick mentioned this pull request Jan 15, 2026
Comment on lines +60 to +67
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-lang3-api</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-text-api</artifactId>
</dependency>
Copy link
Member

Choose a reason for hiding this comment

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

prefer #176

@alecharp alecharp closed this Jan 15, 2026
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.

3 participants