From b49713a8942e1e6f96bc599cabef27265915d0d5 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 3 Sep 2025 12:58:21 -0400 Subject: [PATCH 1/3] Replace commons-lang:commons-lang with org.apache.commons:commons-lang3 Signed-off-by: Craig Perkins --- plugins/discovery-azure-classic/build.gradle | 3 ++- .../licenses/commons-lang-2.6.jar.sha1 | 1 - .../licenses/commons-lang-NOTICE.txt | 8 -------- .../licenses/commons-lang3-3.18.0.jar.sha1 | 1 + ...commons-lang-LICENSE.txt => commons-lang3-LICENSE.txt} | 0 .../licenses/commons-lang3-NOTICE.txt} | 0 plugins/identity-shiro/build.gradle | 2 +- plugins/identity-shiro/licenses/commons-lang-2.6.jar.sha1 | 1 - .../identity-shiro/licenses/commons-lang3-3.18.0.jar.sha1 | 1 + ...commons-lang-LICENSE.txt => commons-lang3-LICENSE.txt} | 0 plugins/identity-shiro/licenses/commons-lang3-NOTICE.txt | 5 +++++ 11 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 plugins/discovery-azure-classic/licenses/commons-lang-2.6.jar.sha1 delete mode 100644 plugins/discovery-azure-classic/licenses/commons-lang-NOTICE.txt create mode 100644 plugins/discovery-azure-classic/licenses/commons-lang3-3.18.0.jar.sha1 rename plugins/discovery-azure-classic/licenses/{commons-lang-LICENSE.txt => commons-lang3-LICENSE.txt} (100%) rename plugins/{identity-shiro/licenses/commons-lang-NOTICE.txt => discovery-azure-classic/licenses/commons-lang3-NOTICE.txt} (100%) delete mode 100644 plugins/identity-shiro/licenses/commons-lang-2.6.jar.sha1 create mode 100644 plugins/identity-shiro/licenses/commons-lang3-3.18.0.jar.sha1 rename plugins/identity-shiro/licenses/{commons-lang-LICENSE.txt => commons-lang3-LICENSE.txt} (100%) create mode 100644 plugins/identity-shiro/licenses/commons-lang3-NOTICE.txt diff --git a/plugins/discovery-azure-classic/build.gradle b/plugins/discovery-azure-classic/build.gradle index 2627b3061bdf2..65919ff4a0a45 100644 --- a/plugins/discovery-azure-classic/build.gradle +++ b/plugins/discovery-azure-classic/build.gradle @@ -52,7 +52,7 @@ dependencies { api "commons-logging:commons-logging:${versions.commonslogging}" api "org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}" api "commons-codec:commons-codec:${versions.commonscodec}" - api "commons-lang:commons-lang:2.6" + api "org.apache.commons:commons-lang3:${versions.commonslang}" api "commons-io:commons-io:${versions.commonsio}" api 'javax.mail:mail:1.4.7' api 'javax.inject:javax.inject:1' @@ -126,6 +126,7 @@ tasks.named("thirdPartyAudit").configure { 'javax.servlet.ServletContextEvent', 'javax.servlet.ServletContextListener', 'org.apache.avalon.framework.logger.Logger', + 'org.apache.commons.lang.StringUtils', 'org.apache.log.Hierarchy', 'org.apache.log.Logger', 'org.eclipse.persistence.descriptors.ClassDescriptor', diff --git a/plugins/discovery-azure-classic/licenses/commons-lang-2.6.jar.sha1 b/plugins/discovery-azure-classic/licenses/commons-lang-2.6.jar.sha1 deleted file mode 100644 index 4ee9249d2b76f..0000000000000 --- a/plugins/discovery-azure-classic/licenses/commons-lang-2.6.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -0ce1edb914c94ebc388f086c6827e8bdeec71ac2 \ No newline at end of file diff --git a/plugins/discovery-azure-classic/licenses/commons-lang-NOTICE.txt b/plugins/discovery-azure-classic/licenses/commons-lang-NOTICE.txt deleted file mode 100644 index 592023af76b07..0000000000000 --- a/plugins/discovery-azure-classic/licenses/commons-lang-NOTICE.txt +++ /dev/null @@ -1,8 +0,0 @@ -Apache Commons Lang -Copyright 2001-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -This product includes software from the Spring Framework, -under the Apache License 2.0 (see: StringUtils.containsWhitespace()) diff --git a/plugins/discovery-azure-classic/licenses/commons-lang3-3.18.0.jar.sha1 b/plugins/discovery-azure-classic/licenses/commons-lang3-3.18.0.jar.sha1 new file mode 100644 index 0000000000000..a1a6598bd4f1b --- /dev/null +++ b/plugins/discovery-azure-classic/licenses/commons-lang3-3.18.0.jar.sha1 @@ -0,0 +1 @@ +fb14946f0e39748a6571de0635acbe44e7885491 \ No newline at end of file diff --git a/plugins/discovery-azure-classic/licenses/commons-lang-LICENSE.txt b/plugins/discovery-azure-classic/licenses/commons-lang3-LICENSE.txt similarity index 100% rename from plugins/discovery-azure-classic/licenses/commons-lang-LICENSE.txt rename to plugins/discovery-azure-classic/licenses/commons-lang3-LICENSE.txt diff --git a/plugins/identity-shiro/licenses/commons-lang-NOTICE.txt b/plugins/discovery-azure-classic/licenses/commons-lang3-NOTICE.txt similarity index 100% rename from plugins/identity-shiro/licenses/commons-lang-NOTICE.txt rename to plugins/discovery-azure-classic/licenses/commons-lang3-NOTICE.txt diff --git a/plugins/identity-shiro/build.gradle b/plugins/identity-shiro/build.gradle index 223a69f9eb353..6479e1300be15 100644 --- a/plugins/identity-shiro/build.gradle +++ b/plugins/identity-shiro/build.gradle @@ -24,7 +24,7 @@ dependencies { implementation 'commons-beanutils:commons-beanutils:1.11.0' implementation 'commons-logging:commons-logging:1.2' - implementation 'commons-lang:commons-lang:2.6' + implementation "org.apache.commons:commons-lang3:${versions.commonslang}" implementation 'org.passay:passay:1.6.3' diff --git a/plugins/identity-shiro/licenses/commons-lang-2.6.jar.sha1 b/plugins/identity-shiro/licenses/commons-lang-2.6.jar.sha1 deleted file mode 100644 index 4ee9249d2b76f..0000000000000 --- a/plugins/identity-shiro/licenses/commons-lang-2.6.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -0ce1edb914c94ebc388f086c6827e8bdeec71ac2 \ No newline at end of file diff --git a/plugins/identity-shiro/licenses/commons-lang3-3.18.0.jar.sha1 b/plugins/identity-shiro/licenses/commons-lang3-3.18.0.jar.sha1 new file mode 100644 index 0000000000000..a1a6598bd4f1b --- /dev/null +++ b/plugins/identity-shiro/licenses/commons-lang3-3.18.0.jar.sha1 @@ -0,0 +1 @@ +fb14946f0e39748a6571de0635acbe44e7885491 \ No newline at end of file diff --git a/plugins/identity-shiro/licenses/commons-lang-LICENSE.txt b/plugins/identity-shiro/licenses/commons-lang3-LICENSE.txt similarity index 100% rename from plugins/identity-shiro/licenses/commons-lang-LICENSE.txt rename to plugins/identity-shiro/licenses/commons-lang3-LICENSE.txt diff --git a/plugins/identity-shiro/licenses/commons-lang3-NOTICE.txt b/plugins/identity-shiro/licenses/commons-lang3-NOTICE.txt new file mode 100644 index 0000000000000..780ac0edb3c94 --- /dev/null +++ b/plugins/identity-shiro/licenses/commons-lang3-NOTICE.txt @@ -0,0 +1,5 @@ +Apache Commons Lang +Copyright 2001-2022 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (https://www.apache.org/). From 95b5c99cebbf821494ef66b859bb528c3b21a856 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 3 Sep 2025 13:00:14 -0400 Subject: [PATCH 2/3] Add to CHANGELOG Signed-off-by: Craig Perkins --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de3e44d987407..9360bc36b3031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Bump `org.jsoup:jsoup` from 1.20.1 to 1.21.2 ([#19207](https://github.com/opensearch-project/OpenSearch/pull/19207)) - Bump `org.apache.hadoop:hadoop-minicluster` from 3.4.1 to 3.4.2 ([#19203](https://github.com/opensearch-project/OpenSearch/pull/19203)) - Bump `com.maxmind.geoip2:geoip2` from 4.3.1 to 4.4.0 ([#19205](https://github.com/opensearch-project/OpenSearch/pull/19205)) +- Replace commons-lang:commons-lang with org.apache.commons:commons-lang3 ([#19229](https://github.com/opensearch-project/OpenSearch/pull/19229)) ### Deprecated From bb274093140c22ef7f721a8a4a180baf9730e7ab Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 3 Sep 2025 15:39:53 -0400 Subject: [PATCH 3/3] Create a shim around commons-lang3 StringUtils Signed-off-by: Craig Perkins --- .../licenses/javax.inject-1.jar.sha1 | 2 +- .../licenses/jaxb-impl-2.2.3-1.jar.sha1 | 2 +- .../licenses/jersey-client-1.13.jar.sha1 | 2 +- .../licenses/jersey-core-1.13.jar.sha1 | 2 +- .../licenses/jersey-json-1.13.jar.sha1 | 2 +- .../org/apache/commons/lang/StringUtils.java | 49 +++++++++++++++++++ 6 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 plugins/discovery-azure-classic/src/main/java/org/apache/commons/lang/StringUtils.java diff --git a/plugins/discovery-azure-classic/licenses/javax.inject-1.jar.sha1 b/plugins/discovery-azure-classic/licenses/javax.inject-1.jar.sha1 index 7ef3c707b3c68..c2fa85f1e9bca 100644 --- a/plugins/discovery-azure-classic/licenses/javax.inject-1.jar.sha1 +++ b/plugins/discovery-azure-classic/licenses/javax.inject-1.jar.sha1 @@ -1 +1 @@ -6975da39a7040257bd51d21a231b76c915872d38 +6975da39a7040257bd51d21a231b76c915872d38 \ No newline at end of file diff --git a/plugins/discovery-azure-classic/licenses/jaxb-impl-2.2.3-1.jar.sha1 b/plugins/discovery-azure-classic/licenses/jaxb-impl-2.2.3-1.jar.sha1 index 79fe55d773670..39eee596d0ad5 100644 --- a/plugins/discovery-azure-classic/licenses/jaxb-impl-2.2.3-1.jar.sha1 +++ b/plugins/discovery-azure-classic/licenses/jaxb-impl-2.2.3-1.jar.sha1 @@ -1 +1 @@ -56baae106392040a45a06d4a41099173425da1e6 +56baae106392040a45a06d4a41099173425da1e6 \ No newline at end of file diff --git a/plugins/discovery-azure-classic/licenses/jersey-client-1.13.jar.sha1 b/plugins/discovery-azure-classic/licenses/jersey-client-1.13.jar.sha1 index 6244c693f44fb..20eb511fff6f2 100644 --- a/plugins/discovery-azure-classic/licenses/jersey-client-1.13.jar.sha1 +++ b/plugins/discovery-azure-classic/licenses/jersey-client-1.13.jar.sha1 @@ -1 +1 @@ -0ec38c57a78940bf5f8f5971307ca89406849647 +0ec38c57a78940bf5f8f5971307ca89406849647 \ No newline at end of file diff --git a/plugins/discovery-azure-classic/licenses/jersey-core-1.13.jar.sha1 b/plugins/discovery-azure-classic/licenses/jersey-core-1.13.jar.sha1 index ee2aa99db3798..de9879f57dce3 100644 --- a/plugins/discovery-azure-classic/licenses/jersey-core-1.13.jar.sha1 +++ b/plugins/discovery-azure-classic/licenses/jersey-core-1.13.jar.sha1 @@ -1 +1 @@ -4326a56dc6b2d67b7313905c353e1af225bb164f +4326a56dc6b2d67b7313905c353e1af225bb164f \ No newline at end of file diff --git a/plugins/discovery-azure-classic/licenses/jersey-json-1.13.jar.sha1 b/plugins/discovery-azure-classic/licenses/jersey-json-1.13.jar.sha1 index 266f2fc5ed7b2..8fc51031bb260 100644 --- a/plugins/discovery-azure-classic/licenses/jersey-json-1.13.jar.sha1 +++ b/plugins/discovery-azure-classic/licenses/jersey-json-1.13.jar.sha1 @@ -1 +1 @@ -f7346cce2c0e73afd39e2783c173ee134f79a0f9 +f7346cce2c0e73afd39e2783c173ee134f79a0f9 \ No newline at end of file diff --git a/plugins/discovery-azure-classic/src/main/java/org/apache/commons/lang/StringUtils.java b/plugins/discovery-azure-classic/src/main/java/org/apache/commons/lang/StringUtils.java new file mode 100644 index 0000000000000..38b4bb98412fe --- /dev/null +++ b/plugins/discovery-azure-classic/src/main/java/org/apache/commons/lang/StringUtils.java @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.apache.commons.lang; + +import java.util.Collection; +import java.util.Iterator; + +/** + * Minimal shim to satisfy Azure Classic which expects commons-lang 2.x. + * Delegates to commons-lang3. + */ +public final class StringUtils { + private StringUtils() {} + + // === Overloads Azure Classic expects (commons-lang 2.x API) === + public static String join(final Collection collection, final String separator) { + if (collection == null) return null; + return org.apache.commons.lang3.StringUtils.join(collection, separator); + } + + public static String join(final Iterator iterator, final String separator) { + if (iterator == null) return null; + return org.apache.commons.lang3.StringUtils.join(iterator, separator); + } + + public static String join(final Object[] array, final String separator) { + if (array == null) return null; + return org.apache.commons.lang3.StringUtils.join(array, separator); + } + + public static String join(final Iterable iterable, final String separator) { + if (iterable == null) return null; + return org.apache.commons.lang3.StringUtils.join(iterable, separator); + } + + public static boolean isBlank(final String s) { + return org.apache.commons.lang3.StringUtils.isBlank(s); + } + + public static boolean isEmpty(final String s) { + return org.apache.commons.lang3.StringUtils.isEmpty(s); + } +}