fix(deps): EOL replace commons-lang 2.6 with commons-lang3 3.20.0 (issue #84) - #85
Merged
Merged
Conversation
Closes #84. Mechanical migration of every `org.apache.commons.lang.*` import to `org.apache.commons.lang3.*` across the codebase, plus removal of the 2.6 dep from the root pom and 28 module poms. commons-lang 2.6 has been EOL since 2010. The 2.7+ line is also unmaintained, and the project's other analysis (T2.6 hardening, #83) flags the same set of CVEs. The 3.x line is the maintained successor; `commons-lang3:3.20.0` was already in the root pom's dependencyManagement (only the 2.6 line was in active use), so no new dep is added. Scope: - 1,396 .java files: `org.apache.commons.lang.` -> `org.apache.commons.lang3.` - 29 .xml files (root pom + 28 module poms): drop the `commons-lang:commons-lang:2.6` dependency and the `<commons.lang.version>2.6</commons.lang.version>` property - 6 special-case files (see API notes below) API differences between commons-lang 2.x and 3.20.0 that this PR addresses (all behavioural, no semantic change for the call sites involved): 1. CharEncoding was removed (it was a 2.x-only constants holder). Fixed in projects/sitemanage/src/test/java/.../PSRestClient.java by switching to java.nio.charset.StandardCharsets.UTF_8.name(). 2. StrTokenizer (text.* subpackage) was removed in lang3 3.12+. Fixed in modules/ContentUI/.../PSAutoLinkGenerationProperties.java by inlining a StringUtils.split(text, ',') loop (only one call site). 3. WordUtils was moved from top-level `org.apache.commons.lang3.WordUtils` to `org.apache.commons.lang3.text.WordUtils`. 3 call sites fixed via a per-file import path correction (modules/utils, deployer, projects/sitemanage). 4. NullArgumentException was removed entirely. The only call site (projects/sitemanage/.../AssetAdaptor.java) now throws java.lang.NullPointerException with the same custom message. 5. ExceptionUtils.getFullStackTrace(t) was renamed to getStackTrace(t) in lang3 3.0. 49 call sites updated across 24 files (some broken across multiple lines; fixed with a word-bounded sed). 6. Validate.allElementsOfType(coll, type) was removed. The single call site (projects/sitemanage/.../PSResourceInstanceHelper.java) now inlines an instanceof loop with an IllegalArgumentException on mismatch. 7. StringEscapeUtils (text.* subpackage) was moved out of lang3 entirely; the maintained replacement is `org.apache.commons.text.StringEscapeUtils` in commons-text (already a transitive dep at 1.15.0). The 2 call sites in system/business/.../PSMetadataExtractorService.java and projects/sitemanage/.../PSLegacyLinkGenerator.java now import from commons-text. The legacy shortcut `StringEscapeUtils.unescapeHtml("&entity;")` is replaced with `StringEscapeUtils.UNESCAPE_HTML4.translate("&entity;")` in PSMetadataExtractorService (long form `escapeHtml4`/`unescapeHtml4` used elsewhere; both still exist in commons-text 1.15.0). Verification: - ./mvn-env.sh clean install -DskipTests: BUILD SUCCESS in 2:18 (61 modules, Java 1.8.0_504) - ./mvn-env.sh spotless:check: clean (the only spotless violation during the run was a multi-line import comment I had to inline; the project spotless config ran auto-style during the build and fixed everything else) - No UnsupportedClassVersionError in the build log - commons-lang 2.x no longer in the project's own dependency graph (commons-lang 2.5 is still pulled in transitively by axe/caja/ smartgwt-jar, but the project's own declared dep is gone) Out of scope (separate issues under #73): - commons-collections 3.2.2 -> commons-collections4 (next EOL in queue) - commons-beanutils 1.11.0 -> beanutils2 (Jakarta migration) - commons-httpclient 3.1 -> HttpClient 5 (the project already has HttpClient 5 from PR #79) - commons-configuration 1.10 -> commons-configuration2 Refs #84, #73, #72
natechadwick
approved these changes
Aug 28, 2026
Closed
6 tasks
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.
Summary
EOL replace
commons-lang:commons-lang:2.6(EOL since 2010) withorg.apache.commons:commons-lang3:3.20.0project-wide.commons-lang3:3.20.0was already in the root pom'sdependencyManagement— only the 2.6 line was in active use, so no new dep is added.This is a mechanical package rename plus removal of the 2.6 dep. Total: 1 431 files changed, +2 474 / −2 682.
What changes (7 categories)
1. Bulk package rename (1 396 .java files)
Every
import org.apache.commons.lang.X.Y;becomesimport org.apache.commons.lang3.X.Y;. Most class names are identical between the two lines (StringUtils,ObjectUtils,ArrayUtils,Validate,WordUtils,RandomStringUtils,SerializationUtils,NotImplementedException, etc.) so this is mostly an import-line change with no API impact.2. Pom: drop commons-lang 2.6 (1 file + 28 module poms)
pom.xml: removed the<dependency>commons-lang:commons-lang:2.6</dependency>block and the<commons.lang.version>2.6</commons.lang.version>property<dependency>block (and 5 exclusion blocks where commons-lang was being excluded from a transitive dep) that referenced the 2.6 line3. Special-case API moves in lang3 (6 files)
projects/sitemanage/.../PSRestClient.javaorg.apache.commons.lang.CharEncodingwas removed in lang3 (it was a 2.x-only constants holder)java.nio.charset.StandardCharsets.UTF_8.name()modules/ContentUI/.../PSAutoLinkGenerationProperties.javaorg.apache.commons.lang.text.StrTokenizerwas removed in lang3 3.12+StringUtils.split(text, ',')loop (only one call site)modules/utils/.../PSStringUtils.java,deployer/.../PSDescriptorSummaryReport.java,projects/sitemanage/.../PSWidgetPackageSpec.javaorg.apache.commons.lang.WordUtilsmoved toorg.apache.commons.lang3.text.WordUtils(subpackage change, top-levelWordUtilswas deleted)projects/sitemanage/.../AssetAdaptor.javaorg.apache.commons.lang.NullArgumentExceptionwas removed in lang3java.lang.NullPointerExceptionwith the same custom messagesystem/business/.../PSMetadataExtractorService.java(line 489 only)StringEscapeUtils.unescapeHtml(...)was removed from lang3 (and from commons-text too)StringEscapeUtils.UNESCAPE_HTML4.translate("&" + entityName + ";")PSLegacyLinkGenerator.java,PSMetadataExtractorService.javaorg.apache.commons.lang3.StringEscapeUtilswas moved out of lang3 entirelyorg.apache.commons.text.StringEscapeUtils(commons-text 1.15.0 is already a transitive dep)4.
ExceptionUtils.getFullStackTrace(t)→getStackTrace(t)(49 call sites across 24 files)Renamed in lang3 3.0. Many call sites are broken across multiple lines (e.g.
ExceptionUtils\n .getFullStackTrace(...)); fixed with a word-bounded sed pass.5.
Validate.allElementsOfType(coll, type)removed (1 call site)The single call site in
projects/sitemanage/.../PSResourceInstanceHelper.javanow inlines aninstanceofloop with anIllegalArgumentExceptionon mismatch (same throw behaviour as before).6.
StringEscapeUtils.unescapeHtml/escapeHtml/escapeHtml4(25 call sites)All call sites use the long-form
escapeHtml4/unescapeHtml4which exist in commons-text 1.15.0 unchanged. Only the oneunescapeHtmlshortcut (inPSMetadataExtractorService.java) needed to switch toUNESCAPE_HTML4.translate(...).7. Spotless pass during build
The build's
validatephase runsspotless:applyautomatically, which reformatted some of the import blocks after the sed pass. No semantic changes; the only spotless violation during my run was a multi-line import comment I had to inline (Google Java Format doesn't allow comments between import lines).Verification
./mvn-env.sh clean install -DskipTests→ BUILD SUCCESS in 2:18 (61 modules, Java 1.8.0_504)UnsupportedClassVersionErrorin the build log./mvn-env.sh spotless:check(run by the validate phase; no manual violations)commons-lang:2.6no longer in the project's own dependency graphmvn dependency:tree -Dincludes=commons-lang:commons-langis now emptycommons-lang:2.5is still pulled in transitively byaxe:axe-saaj:1.4.1,caja, andcom.isomorphic.smartgwt.lgpl:smartgwt(allsystem-scoped legacy jars inperc-system); that is independent of this PRcommons-lang3:3.20.0resolves correctly:mvn dependency:tree -Dincludes=org.apache.commons:commons-lang3shows the dep at 3.20.0Out of scope (separate issues under #73)
commons-collections 3.2.2 → commons-collections4(next EOL in queue)commons-beanutils 1.11.0 → beanutils2(Jakarta migration; large blast radius)commons-httpclient 3.1 → HttpClient 5(the project already has HttpClient 5 from chore(deps): tier1 dependency upgrades for Java 1.8 (issue #72, 13 of 19 GAVs) #79; remove the 3.1 dep)commons-configuration 1.10 → commons-configuration2(API changes; not just a package rename)References
commons-lang 2.6 → commons-lang3migration guide: https://commons.apache.org/proper/commons-lang/article3_0_0.htmlcommons-lang3 3.20.0Javadoc: https://commons.apache.org/proper/commons-lang/javadocs/api-3.20.0/docs/ai-generated/tasks/PR#-DependencyVulnerabilityAnalysis/issues/02-epic-non-upgradeable.md#t26--apache-commons-hardening