From 58e1e125daaa0aebf8c5ffaa82af48821a1ccf2d Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 4 Dec 2025 10:27:20 -0500 Subject: [PATCH 01/61] Simplify XML FSP (#731) * Simplify XML FSP * Simplify XML FSP --- src/changes/changes.xml | 2 +- .../text/lookup/StringLookupFactory.java | 5 ++--- .../commons/text/lookup/XmlStringLookup.java | 19 ++++++------------- .../text/lookup/XmlStringLookupTest.java | 15 +++++---------- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f8912d2005..9a4b221ebc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -53,7 +53,7 @@ The type attribute can be add,update,fix,remove. Fix Apache RAT plugin console warnings. Fix site XML to use version 2.0.0 XML schema. Removed unreachable threshold verification code in src/main/java/org/apache/commons/text/similarity #730. - Enable secure processing for the XML parser in XmlStringLookup #729. + Enable secure processing for the XML parser in XmlStringLookup in case the underlying JAXP implementation doesn't #729. Add experimental CycloneDX VEX file #683. Add Damerau-Levenshtein distance #687. diff --git a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java index 863baa7f34..699b7deab7 100644 --- a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java +++ b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java @@ -1718,15 +1718,14 @@ public StringLookup xmlStringLookup(final Map factoryFeatures) *
  • {@code "com/domain/document.xml:/path/to/node"}
  • * *

    - * Secure processing is enabled by default and can be overridden with the system property {@code "XmlStringLookup.secure"} set to {@code false}. The secure - * boolean String parsing follows the syntax defined by {@link Boolean#parseBoolean(String)}. + * Secure processing is enabled by default and can be overridden with this constructor. *

    *

    * Using a {@link StringLookup} from the {@link StringLookupFactory} fenced by the current directory ({@code Paths.get("")}): *

    * *
    -     * StringLookupFactory.INSTANCE.xmlStringLookup(map, Pathe.get("")).lookup("com/domain/document.xml:/path/to/node");
    +     * StringLookupFactory.INSTANCE.xmlStringLookup(map, Path.get("")).lookup("com/domain/document.xml:/path/to/node");
          * 
    *

    * To use a {@link StringLookup} fenced by the current directory, use: diff --git a/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java b/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java index 85747eebc2..ee33441993 100644 --- a/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java @@ -30,7 +30,6 @@ import javax.xml.xpath.XPathFactory; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.SystemProperties; import org.w3c.dom.Document; /** @@ -42,8 +41,7 @@ *

  • {@code "com/domain/document.xml:/path/to/node"}
  • * *

    - * Secure processing is enabled by default and can be overridden with the system property {@code "XmlStringLookup.secure"} set to {@code false}. The secure - * boolean String parsing follows the syntax defined by {@link Boolean#parseBoolean(String)}. + * Secure processing is enabled by default and can be overridden with {@link StringLookupFactory#xmlStringLookup(Map, Path...)}. *

    * * @since 1.5 @@ -72,14 +70,13 @@ final class XmlStringLookup extends AbstractPathFencedLookup { } /** - * Defines the singleton for this class with secure processing enabled. + * Defines the singleton for this class with secure processing enabled by default. + *

    + * Secure processing is enabled by default and can be overridden with {@link StringLookupFactory#xmlStringLookup(Map, Path...)}. + *

    */ static final XmlStringLookup INSTANCE = new XmlStringLookup(DEFAULT_XML_FEATURES, DEFAULT_XPATH_FEATURES, (Path[]) null); - private static boolean isSecure() { - return SystemProperties.getBoolean(XmlStringLookup.class, "secure", () -> true); - } - /** * Defines XPath factory features. */ @@ -113,8 +110,7 @@ private static boolean isSecure() { *
  • {@code "com/domain/document.xml:/path/to/node"}
  • * *

    - * Secure processing is enabled by default. The secure boolean String parsing follows the syntax defined by {@link Boolean#parseBoolean(String)}. The secure - * value in the key overrides instance settings given in the constructor. + * Secure processing is enabled by default and can be overridden with {@link StringLookupFactory#xmlStringLookup(Map, Path...)}. *

    * * @param key the key to be looked up, may be null. @@ -130,7 +126,6 @@ public String lookup(final String key) { if (keyLen != KEY_PARTS_LEN) { throw IllegalArgumentExceptions.format("Bad XML key format '%s'; the expected format is 'DocumentPath:XPath'.", key); } - final boolean secure = isSecure(); final String documentPath = keys[0]; final String xpath = StringUtils.substringAfterLast(key, SPLIT_CH); final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); @@ -138,14 +133,12 @@ public String lookup(final String key) { for (final Entry p : xmlFactoryFeatures.entrySet()) { dbFactory.setFeature(p.getKey(), p.getValue()); } - dbFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, secure); try (InputStream inputStream = Files.newInputStream(getPath(documentPath))) { final Document doc = dbFactory.newDocumentBuilder().parse(inputStream); final XPathFactory xpFactory = XPathFactory.newInstance(); for (final Entry p : xPathFactoryFeatures.entrySet()) { xpFactory.setFeature(p.getKey(), p.getValue()); } - xpFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, secure); return xpFactory.newXPath().evaluate(xpath, doc); } } catch (final Exception e) { diff --git a/src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java index f0cc50ba96..7327bca7ef 100644 --- a/src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java @@ -69,7 +69,6 @@ void testExternalEntityOff() { } @Test - @SetSystemProperty(key = "XmlStringLookup.secure", value = "false") void testExternalEntityOn() { final String key = DOC_DIR + "document-entity-ref.xml:/document/content"; assertEquals(DATA, new XmlStringLookup(EMPTY_MAP, EMPTY_MAP).apply(key).trim()); @@ -79,16 +78,14 @@ void testExternalEntityOn() { @Test void testInterpolatorExternalDtdOff() { final StringSubstitutor stringSubstitutor = StringSubstitutor.createInterpolator(); - assertThrows(IllegalArgumentException.class, () -> stringSubstitutor.replace("${xml:" + DOC_DIR - + "document-external-dtd.xml:/document/content}")); + assertThrows(IllegalArgumentException.class, () -> stringSubstitutor.replace("${xml:" + DOC_DIR + "document-external-dtd.xml:/document/content}")); } @Test - @SetSystemProperty(key = "XmlStringLookup.secure", value = "false") + @SetSystemProperty(key = "javax.xml.accessExternalDTD", value = "file") void testInterpolatorExternalDtdOn() { final StringSubstitutor stringSubstitutor = StringSubstitutor.createInterpolator(); - assertEquals("This is an external entity.", - stringSubstitutor.replace("${xml:" + DOC_DIR + "document-external-dtd.xml:/document/content}").trim()); + assertEquals("This is an external entity.", stringSubstitutor.replace("${xml:" + DOC_DIR + "document-external-dtd.xml:/document/content}").trim()); } @Test @@ -98,7 +95,7 @@ void testInterpolatorExternalEntityOff() { } @Test - @SetSystemProperty(key = "XmlStringLookup.secure", value = "false") + @SetSystemProperty(key = "javax.xml.accessExternalDTD", value = "file") void testInterpolatorExternalEntityOffOverride() { final StringSubstitutor stringSubstitutor = StringSubstitutor.createInterpolator(); assertEquals(DATA, stringSubstitutor.replace("${xml:" + DOC_DIR + "document-entity-ref.xml:/document/content}").trim()); @@ -111,11 +108,9 @@ void testInterpolatorExternalEntityOn() { } @Test - @SetSystemProperty(key = "XmlStringLookup.secure", value = "true") void testInterpolatorExternalEntityOnOverride() { final StringSubstitutor stringSubstitutor = StringSubstitutor.createInterpolator(); - assertThrows(IllegalArgumentException.class, - () -> stringSubstitutor.replace("${xml:" + DOC_DIR + "document-entity-ref.xml:/document/content}")); + assertThrows(IllegalArgumentException.class, () -> stringSubstitutor.replace("${xml:" + DOC_DIR + "document-entity-ref.xml:/document/content}")); } @Test From c6e17ec24cc8374eb12676b717bf797f41b6e539 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 4 Dec 2025 10:42:56 -0500 Subject: [PATCH 02/61] Use direct access - Javadoc - Test deprecated and not --- .../commons/text/similarity/JaroWinklerDistance.java | 3 ++- .../commons/text/similarity/JaroWinklerDistanceTest.java | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java b/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java index 8bd8d7b7a8..e2e3d0df3f 100644 --- a/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java +++ b/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java @@ -36,7 +36,8 @@ public class JaroWinklerDistance implements EditDistance { * @param first the first string to be matched. * @param second the second string to be matched. * @return array containing: matches, half transpositions, and prefix - * @deprecated Deprecated as of 1.7. This method will be removed in 2.0, and moved to a Jaro Winkler similarity class. TODO see TEXT-104. + * @deprecated Deprecated as of 1.7, use {@link JaroWinklerSimilarity#matches(CharSequence, CharSequence)}. This method will be removed in 2.0. TODO see + * TEXT-104. */ @Deprecated protected static int[] matches(final CharSequence first, final CharSequence second) { diff --git a/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java index 2d63394d16..0f4ee10c04 100644 --- a/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java +++ b/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java @@ -108,7 +108,13 @@ void testGetJaroWinklerDistance_StringString() { @Test void testMatches() { - assertArrayEquals(new int[]{2, 0, 2}, distance.matches("ab", "aba")); + assertArrayEquals(new int[]{2, 0, 2}, JaroWinklerSimilarity.matches("ab", "aba")); + } + + @SuppressWarnings("deprecation") + @Test + void testMatchesDeprecated() { + assertArrayEquals(new int[]{2, 0, 2}, JaroWinklerDistance.matches("ab", "aba")); } } From 502c4c41be5671681b58a9b50297f99737e8ea93 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 4 Dec 2025 15:53:32 +0000 Subject: [PATCH 03/61] Prepare for the next release candidate --- README.md | 6 ++-- RELEASE-NOTES.txt | 59 ++++++++++++++++++++++++++++++-- src/changes/changes.xml | 4 +-- src/changes/release-notes.vm | 2 +- src/site/xdoc/download_text.xml | 28 +++++++-------- src/site/xdoc/issue-tracking.xml | 2 +- src/site/xdoc/mail-lists.xml | 2 +- 7 files changed, 79 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 81333cf313..3cd07a15d7 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Apache Commons Text [![Java CI](https://github.com/apache/commons-text/actions/workflows/maven.yml/badge.svg)](https://github.com/apache/commons-text/actions/workflows/maven.yml) [![Maven Central](https://img.shields.io/maven-central/v/org.apache.commons/commons-text?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.commons/commons-text) -[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-text/1.14.0.svg)](https://javadoc.io/doc/org.apache.commons/commons-text/1.14.0) +[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-text/1.15.0.svg)](https://javadoc.io/doc/org.apache.commons/commons-text/1.15.0) [![CodeQL](https://github.com/apache/commons-text/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/commons-text/actions/workflows/codeql-analysis.yml) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/commons-text/badge)](https://api.securityscorecards.dev/projects/github.com/apache/commons-text) @@ -69,7 +69,7 @@ Alternatively, you can pull it from the central Maven repositories: org.apache.commons commons-text - 1.14.0 + 1.15.0 ``` @@ -90,7 +90,7 @@ There are some guidelines which will make applying PRs easier for us: + Respect the existing code style for each file. + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change. + Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running `mvn`. -+ Before you pushing a PR, run `mvn` (by itself), this runs the default goal, which contains all build checks. ++ Before you push a PR, run `mvn` (without arguments). This runs the default goal which contains all build checks. + To see the code coverage report, regardless of coverage failures, run `mvn clean site -Dcommons.jacoco.haltOnFailure=false -Pjacoco` If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas). diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index f3e1471648..f299b31453 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -14,8 +14,63 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Apache Commons Text 1.15.0 Release Notes +---------------------------------------- + +The Apache Commons Text team is pleased to announce the release of Apache Commons Text 1.15.0. + +Apache Commons Text is a set of utility functions and reusable components for processing +and manipulating text in a Java environment. + +Release 1.15.0. This is a feature and maintenance release. Java 8 or later is required. + + +New features +------------ + +* Add experimental CycloneDX VEX file #683. Thanks to Piotr P. Karwasz, Gary Gregory. +* TEXT-235: Add Damerau-Levenshtein distance #687. Thanks to LorgeN, Gary Gregory. +* Add unit tests to increase coverage #719. Thanks to Michael Hausegger, Gary Gregory. +* Add new test for CharSequenceTranslator#with() #725. Thanks to Michael Hausegger, Gary Gregory. +* Add tests and assertions to org.apache.commons.text.similarity to get to 100% code coverage #727, #728. Thanks to Michael Hausegger. + +Fixed Bugs +---------- + +* Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...). Thanks to Gary Gregory. +* TEXT-236: Inserting at the end of a TextStringBuilder throws a StringIndexOutOfBoundsException. Thanks to Pierre Post, Sumit Bera, Alex Herbert, Gary Gregory. +* Fix TextStringBuilderTest.testAppendToCharBuffer() to use proper argument type #724. Thanks to Michael Hausegger. +* Fix Apache RAT plugin console warnings. Thanks to Gary Gregory. +* Fix site XML to use version 2.0.0 XML schema. Thanks to Gary Gregory. +* Removed unreachable threshold verification code in src/main/java/org/apache/commons/text/similarity #730. Thanks to Michael Hausegger. +* Enable secure processing for the XML parser in XmlStringLookup in case the underlying JAXP implementation doesn't #729. Thanks to 김민재 (minjas0507), Gary Gregory, Piotr Karwasz. + +Changes +------- + +* Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726. Thanks to Gary Gregory. +* Bump commons.bytebuddy.version from 1.17.6 to 1.18.2 #696, #722. Thanks to Gary Gregory. +* Bump graalvm.version from 24.2.2 to 25.0.1 #703, #716. Thanks to Gary Gregory, Dependabot. +* Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.20.0. Thanks to Gary Gregory. +* Bump commons-io:commons-io from 2.20.0 to 2.21.0. Thanks to Gary Gregory. + + +Historical list of changes: https://commons.apache.org/proper/commons-text/changes.html + +For complete information on Apache Commons Text, including instructions on how to submit bug reports, +patches, or suggestions for improvement, see the Apache Commons Text website: + +https://commons.apache.org/proper/commons-text + +Download page: https://commons.apache.org/proper/commons-text/download_text.cgi + +Have fun! +-Apache Commons Team + +----------------------------------------------------------------------------- + Apache Commons Text 1.14.0 Release Notes ------------------------------------------------- +---------------------------------------- The Apache Commons Text team is pleased to announce the release of Apache Commons Text 1.14.0. @@ -327,7 +382,7 @@ New features * TEXT-207: Add DoubleFormat utility. * TEXT-190: Document negative limit for WordUtils abbreviate method Thanks to Benjamin Bing. -* TEXT-188: Speed up LevenshteinDistance with threshold by exiting early Thanks to Jakob Vesterstrm. +* TEXT-188: Speed up LevenshteinDistance with threshold by exiting early Thanks to Jakob Vesterstrøm. * TEXT-185: Release Notes page hasn't been updated for 1.9 release yet. Thanks to Larry West, Gary Gregory. * Add StrBuilder.isNotEmpty(). Thanks to Gary Gregory. diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9a4b221ebc..3f2071af29 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -45,7 +45,7 @@ The type attribute can be add,update,fix,remove. Apache Commons Text Changes - + Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...). Inserting at the end of a TextStringBuilder throws a StringIndexOutOfBoundsException. @@ -53,7 +53,7 @@ The type attribute can be add,update,fix,remove. Fix Apache RAT plugin console warnings. Fix site XML to use version 2.0.0 XML schema. Removed unreachable threshold verification code in src/main/java/org/apache/commons/text/similarity #730. - Enable secure processing for the XML parser in XmlStringLookup in case the underlying JAXP implementation doesn't #729. + Enable secure processing for the XML parser in XmlStringLookup in case the underlying JAXP implementation doesn't #729. Add experimental CycloneDX VEX file #683. Add Damerau-Levenshtein distance #687. diff --git a/src/changes/release-notes.vm b/src/changes/release-notes.vm index c9f6686a7e..35e7a381b8 100644 --- a/src/changes/release-notes.vm +++ b/src/changes/release-notes.vm @@ -32,7 +32,7 @@ See the License for the specific language governing permissions and limitations under the License. ${project.name} ${version} Release Notes ------------------------------------------------- +---------------------------------------- The ${developmentTeam} is pleased to announce the release of ${project.name} ${version}. diff --git a/src/site/xdoc/download_text.xml b/src/site/xdoc/download_text.xml index 4f7cbc7c3a..e2a425aa83 100644 --- a/src/site/xdoc/download_text.xml +++ b/src/site/xdoc/download_text.xml @@ -58,7 +58,7 @@ limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> Download Apache Commons Text Apache Commons Team @@ -115,32 +115,32 @@ limitations under the License.

    -
    +
    - - - + + + - - - + + +
    commons-text-1.14.0-bin.tar.gzsha512pgpcommons-text-1.15.0-bin.tar.gzsha512pgp
    commons-text-1.14.0-bin.zipsha512pgpcommons-text-1.15.0-bin.zipsha512pgp
    - - - + + + - - - + + +
    commons-text-1.14.0-src.tar.gzsha512pgpcommons-text-1.15.0-src.tar.gzsha512pgp
    commons-text-1.14.0-src.zipsha512pgpcommons-text-1.15.0-src.zipsha512pgp
    diff --git a/src/site/xdoc/issue-tracking.xml b/src/site/xdoc/issue-tracking.xml index 9ef2de7e3f..83219a0dd5 100644 --- a/src/site/xdoc/issue-tracking.xml +++ b/src/site/xdoc/issue-tracking.xml @@ -43,7 +43,7 @@ limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> Apache Commons Text Issue tracking Apache Commons Team diff --git a/src/site/xdoc/mail-lists.xml b/src/site/xdoc/mail-lists.xml index c8734db5fb..806e21bb19 100644 --- a/src/site/xdoc/mail-lists.xml +++ b/src/site/xdoc/mail-lists.xml @@ -41,7 +41,7 @@ limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd"> Apache Commons Text Mailing Lists Apache Commons Team From 04e937470d3679cc163df85d82d5b6d2e3e71128 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 4 Dec 2025 15:55:50 +0000 Subject: [PATCH 04/61] Prepare for the release candidate 1.15.0 RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bcab4f571a..325a76ce79 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 93 commons-text - 1.15.0-SNAPSHOT + 1.15.0 Apache Commons Text Apache Commons Text is a set of utility functions and reusable components for processing and manipulating text in a Java environment. @@ -33,7 +33,7 @@ ISO-8859-1 UTF-8 - 2025-07-24T12:03:40Z + 2025-12-04T15:53:46Z 1.8 1.8 text From e680120e74a56e51ecff52713cb5167cbcc47867 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 5 Dec 2025 07:33:40 -0500 Subject: [PATCH 05/61] Fix benchmarks --- pom.xml | 36 +++++++++++++++++-- .../LongestCommonSubsequencePerformance.java | 8 ++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index bcab4f571a..f159e87218 100644 --- a/pom.xml +++ b/pom.xml @@ -598,13 +598,45 @@ + benchmark true org.apache + + + org.openjdk.jmh + jmh-core + ${commons.jmh.version} + test + + + org.openjdk.jmh + jmh-generator-annprocess + ${commons.jmh.version} + test + + + org.apache.commons + commons-collections4 + 4.5.0 + test + + + + + maven-compiler-plugin + ${commons.compiler.version} + + + **/* + + + + org.codehaus.mojo exec-maven-plugin @@ -620,12 +652,12 @@ java -classpath - + org.openjdk.jmh.Main -rf json -rff - target/jmh-result.${benchmark}.json + target/jmh-result.json ${benchmark} diff --git a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java index a810e1167c..eef5f9d30e 100644 --- a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java +++ b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java @@ -134,7 +134,7 @@ public void setup() { } @Benchmark - void testLCS(final InputData data) { + public void testLCS(final InputData data) { final LongestCommonSubsequence lcs = new LongestCommonSubsequence(); for (final Pair input : data.inputs) { lcs.longestCommonSubsequence(input.getLeft(), input.getRight()); @@ -142,7 +142,7 @@ void testLCS(final InputData data) { } @Benchmark - void testLCSBaseline(final InputData data) { + public void testLCSBaseline(final InputData data) { final BaselineLongestCommonSubsequence lcs = new BaselineLongestCommonSubsequence(); for (final Pair input : data.inputs) { lcs.longestCommonSubsequence(input.getLeft(), input.getRight()); @@ -150,7 +150,7 @@ void testLCSBaseline(final InputData data) { } @Benchmark - void testLCSLen(final InputData data) { + public void testLCSLen(final InputData data) { final LongestCommonSubsequence lcs = new LongestCommonSubsequence(); for (final Pair input : data.inputs) { lcs.apply(input.getLeft(), input.getRight()); @@ -158,7 +158,7 @@ void testLCSLen(final InputData data) { } @Benchmark - void testLCSLenBaseline(final InputData data) { + public void testLCSLenBaseline(final InputData data) { final BaselineLongestCommonSubsequence lcs = new BaselineLongestCommonSubsequence(); for (final Pair input : data.inputs) { lcs.apply(input.getLeft(), input.getRight()); From d6d521ad37e07e0a71fb4170f7be468287cc0229 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 5 Dec 2025 08:19:57 -0500 Subject: [PATCH 06/61] Fix benchmark Add license header --- pom.xml | 7 +++- .../LongestCommonSubsequencePerformance.java | 33 +++++++++---------- .../commons/text/lcs-perf-analysis-inputs.csv | 16 ++++++++- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index f159e87218..8790371545 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,12 @@ ${jmh.version} test + + org.apache.commons + commons-csv + 1.14.1 + test + clean verify apache-rat:check japicmp:cmp checkstyle:check pmd:check spotbugs:check javadoc:javadoc @@ -149,7 +155,6 @@ src/site/resources/download_text.cgi src/site/resources/release-notes/RELEASE-NOTES-*.txt src/test/resources/org/apache/commons/text/stringEscapeUtilsTestData.txt - src/test/resources/org/apache/commons/text/lcs-perf-analysis-inputs.csv src/test/resources/org/apache/commons/text/oss-fuzz/** diff --git a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java index eef5f9d30e..49d1318ed3 100644 --- a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java +++ b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java @@ -16,16 +16,14 @@ */ package org.apache.commons.text.jmh; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; -import java.io.UncheckedIOException; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.TimeUnit; +import org.apache.commons.csv.CSVFormat; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.text.similarity.LongestCommonSubsequence; @@ -114,22 +112,21 @@ public static class InputData { final List> inputs = new ArrayList<>(); @Setup(Level.Trial) - public void setup() { + public void setup() throws IOException { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - try (InputStream is = classLoader.getResourceAsStream("org/apache/commons/text/lcs-perf-analysis-inputs.csv"); - InputStreamReader isr = new InputStreamReader(Objects.requireNonNull(is)); - BufferedReader br = new BufferedReader(isr)) { - String line; - while ((line = br.readLine()) != null && !line.trim().isEmpty()) { - line = line.trim(); - final int indexOfComma = line.indexOf(','); - final String inputA = line.substring(0, indexOfComma); - final String inputB = line.substring(1 + indexOfComma); - this.inputs.add(ImmutablePair.of(inputA, inputB)); - } - } catch (final IOException exception) { - throw new UncheckedIOException(exception.getMessage(), exception); - } + CSVFormat.DEFAULT.builder().setCommentMarker('#').setTrim(true).get() + .parse(new InputStreamReader( + Objects.requireNonNull(classLoader.getResourceAsStream("org/apache/commons/text/lcs-perf-analysis-inputs.csv")))) + .forEach(record -> { + final String line = record.get(0); + final int indexOfComma = line.indexOf(','); + if (indexOfComma < 0) { + throw new IllegalStateException("Invalid input line: " + line); + } + final String inputA = line.substring(0, indexOfComma); + final String inputB = line.substring(1 + indexOfComma); + this.inputs.add(ImmutablePair.of(inputA, inputB)); + }); } } diff --git a/src/test/resources/org/apache/commons/text/lcs-perf-analysis-inputs.csv b/src/test/resources/org/apache/commons/text/lcs-perf-analysis-inputs.csv index 53610d3579..8253e4f6be 100644 --- a/src/test/resources/org/apache/commons/text/lcs-perf-analysis-inputs.csv +++ b/src/test/resources/org/apache/commons/text/lcs-perf-analysis-inputs.csv @@ -1,4 +1,18 @@ -"This is test data for a JMH (the Java Microbenchmark Harness) which is used from the class org.apache.commons.text.jmh.LongestCommonSubsequencePerformance." +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"This is test data for a JMH (the Java Microbenchmark Harness), which is used from the class org.apache.commons.text.jmh.LongestCommonSubsequencePerformance." "The quick brown fox jumps over the lazy dog. A man, a plan, a canal, Panama. Was it a car or a cat I saw? Step on no pets. Rats live on no evil star." "Here, the field iterations will be populated with appropriate values from the @Param annotation by the JMH when it is passed to the benchmark method. The @Setup annotated method is invoked before each invocation of the benchmark and creates a new Hasher ensuring isolation. When the execution is finished, we'll get a result similar to the one below: When running microbenchmarks, it's very important to be aware of optimizations. Otherwise, they may affect the","benchmark results in a very misleading way. To make matters a bit more concrete, let's consider an example: We expect object allocation costs more than doing nothing at all. However, if we run the benchmarks: Apparently finding a place in the TLAB, creating and initializing an object is almost free! Just by looking at these numbers, we should know that something does not quite add up here." "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. This code is free software; you can redistribute it and/or modify it published by the Free Software Foundation. Oracle designates this This code is distributed in the hope that it will be useful, but WITHOUT FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License You should have received a copy of the GNU General Public License version","Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? under the terms of the GNU General Public License version 2 only, as particular file as subject to the *Classpath* exception as provided ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or version 2 for more details (a copy is included in the LICENSE file that 2 along with this work; if not, write to the Free Software Foundation," From d98c3d74640f737d08bf13c105bba19611e97f80 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 5 Dec 2025 15:06:23 -0500 Subject: [PATCH 07/61] Bump github/codeql-action from 4.31.6 to 4.31.7 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b47769e0ee..c928d7b1b4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 + uses: github/codeql-action/init@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 + uses: github/codeql-action/autobuild@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 + uses: github/codeql-action/analyze@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index bcb94cd7f5..cefcc23f34 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 + uses: github/codeql-action/upload-sarif@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 with: sarif_file: results.sarif From 6ffa7c2703ebf069e0df2cbb0ca9aafab4274ff9 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 5 Dec 2025 17:03:18 -0500 Subject: [PATCH 08/61] Ask for details on AI usage in creating a pull request --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4cbe168c3e..9ff35c83e7 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -23,7 +23,7 @@ Before you push a pull request, review this list: - [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project. - [ ] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI). -- [ ] I used AI to create any part of, or all of, this pull request. +- [ ] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? - [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. - [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. From d38b9c23e1dcd1682ce37c90466a7fda40882aad Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 6 Dec 2025 11:40:24 -0500 Subject: [PATCH 09/61] Add NetBean IDE metadata files to .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 03ca919d66..c5860d17e9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ site-content .externalToolBuilders /.checkstyle /.DS_Store + +# NetBeans files +nb-configuration.xml +nbactions.xml From df4916e11b96662c99dfca61fb1e31f5c1e715c7 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 7 Dec 2025 07:17:34 -0500 Subject: [PATCH 10/61] Normalize spelling --- .../java/org/apache/commons/text/similarity/package-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/text/similarity/package-info.java b/src/main/java/org/apache/commons/text/similarity/package-info.java index 3a2273ff1b..a0cdec2daa 100644 --- a/src/main/java/org/apache/commons/text/similarity/package-info.java +++ b/src/main/java/org/apache/commons/text/similarity/package-info.java @@ -37,7 +37,7 @@ * * *

    The {@link org.apache.commons.text.similarity.CosineDistance Cosine Distance} - * utilises a {@link org.apache.commons.text.similarity.RegexTokenizer regular expression tokenizer (\w+)}. + * utilizes a {@link org.apache.commons.text.similarity.RegexTokenizer regular expression tokenizer (\w+)}. * And the {@link org.apache.commons.text.similarity.LevenshteinDistance Levenshtein Distance}'s * behavior can be changed to take into consideration a maximum throughput.

    * From 001fc65a0c5c4e2fdc337094243db517ac1bbf8f Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 7 Dec 2025 22:18:19 +0000 Subject: [PATCH 11/61] Bump to next development version --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 325a76ce79..a3e1315e0a 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 93 commons-text - 1.15.0 + 1.15.1-SNAPSHOT Apache Commons Text Apache Commons Text is a set of utility functions and reusable components for processing and manipulating text in a Java environment. @@ -33,7 +33,7 @@ ISO-8859-1 UTF-8 - 2025-12-04T15:53:46Z + 2025-12-07T22:18:14Z 1.8 1.8 text From 8b2c08751d4b8838ebbee7ad91f53c1f2ef0e677 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 7 Dec 2025 22:19:24 +0000 Subject: [PATCH 12/61] Updates for the next release --- src/changes/changes.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3f2071af29..547a6d5f1d 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -45,6 +45,11 @@ The type attribute can be add,update,fix,remove. Apache Commons Text Changes
    + + + + + Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...). From e7ab51e35c30af2f668ccd504bcee7301668614f Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 7 Dec 2025 23:02:27 +0000 Subject: [PATCH 13/61] Updates for the next release --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 42cbea80c3..f795a65026 100644 --- a/pom.xml +++ b/pom.xml @@ -39,8 +39,8 @@ text text org.apache.commons.text - 1.15.0 - 1.15.1 + 1.15.01 + 1.15.2 (Java 8+) TEXT 12318221 @@ -61,7 +61,7 @@ - 1.14.0 + 1.15.0 RC1 true scm:svn:https://dist.apache.org/repos/dist/dev/commons/${commons.componentid} From 3d40bb3765f3f9838de4fe0321325d0438affae1 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Tue, 9 Dec 2025 10:12:23 -0500 Subject: [PATCH 14/61] Fix spelling in comments --- src/test/java/org/apache/commons/text/StrBuilderTest.java | 2 +- .../java/org/apache/commons/text/TextStringBuilderTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java index 338768f4f5..c27cf469fc 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java @@ -1894,7 +1894,7 @@ void testSubSequenceIntInt() { // End index greater than length() assertThrows(IndexOutOfBoundsException.class, () -> sb.subSequence(2, sb.length() + 1)); - // Start index greater then end index + // Start index greater than end index assertThrows(IndexOutOfBoundsException.class, () -> sb.subSequence(3, 2)); // Normal cases diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java index 3317543f73..ff2cc7d00b 100644 --- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java +++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java @@ -2190,7 +2190,7 @@ void testSubSequenceIntInt() { // End index greater than length() assertThrows(IndexOutOfBoundsException.class, () -> sb.subSequence(2, sb.length() + 1)); - // Start index greater then end index + // Start index greater than end index assertThrows(IndexOutOfBoundsException.class, () -> sb.subSequence(3, 2)); // Normal cases From 9e34d3d2b2f58c35937477d859042920cdaf3a00 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Fri, 12 Dec 2025 13:49:13 +0100 Subject: [PATCH 15/61] Add more test coverage (#732) * Enable test which can be enabled now * Ensure test does not fail on non-US default locale * Cover a few lines/branches Add some more tests to cover a bit more. Also apply some IDE-suggestions, assert-order, simplify assertions. * Adjust based on review comments Remove added @Deprecated Remove comments which silence warnings in IDEs Inline local variables * Revert "Ensure test does not fail on non-US default locale" This reverts commit 5a6af9ed28cc7523044150a5b57b109fbfc28cd8. * Some more minor adjustments of added tests based on code review --- .../org/apache/commons/text/OssFuzzTest.java | Bin 16930 -> 16771 bytes .../commons/text/StringSubstitutorTest.java | 8 ++++- .../commons/text/TextStringBuilderTest.java | 7 ++++ .../apache/commons/text/WordUtilsTest.java | 28 +++++++++++++++- .../text/lookup/StringLookupFactoryTest.java | 13 ++++++++ .../similarity/IntersectionResultTest.java | 5 ++- .../similarity/LevenshteinResultsTest.java | 16 +++++++++ .../LongestCommonSubsequenceTest.java | 4 +++ .../translate/CharSequenceTranslatorTest.java | 18 ++++++++-- .../text/translate/OctalUnescaperTest.java | 31 ++++++++++++++++++ .../translate/SinglePassTranslatorTest.java | 14 ++++++-- .../text/translate/UnicodeUnescaperTest.java | 5 +++ 12 files changed, 142 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/apache/commons/text/OssFuzzTest.java b/src/test/java/org/apache/commons/text/OssFuzzTest.java index 0b4e1a555ab1e9c074ea7fcebda4e188184551da..c3772e5a372d8e65be74c83afeb17071e84024fa 100644 GIT binary patch delta 30 mcmZ3~!r0u*xFMN&au@UE$p(&+n^&;-*i6=R44XW`aS{Nt5etO? delta 89 zcmZo}W?a<5xFMOD(U%%PKaJD5!lV)2@+< results.length; i++) { @@ -45,6 +45,9 @@ void testEquals() { for (int j = 0; j < results.length; j++) { Assertions.assertEquals(results[i].equals(results[j]), i == j); } + + Assertions.assertFalse(results[i].equals(null), "Should not be Equal to null"); + Assertions.assertNotEquals("Test", results[i], "Should not be Equal to a different type of object"); } } diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java index af8f5d92ba..ac93db0605 100644 --- a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java +++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java @@ -40,6 +40,15 @@ void testEqualsReturningFalse() { assertFalse(levenshteinResults.equals(levenshteinResultsTwo)); } + @Test + void testEqualsDifferentDistance() { + final Integer integerOne = 1662; + final Integer integerTwo = 1164; + final LevenshteinResults levenshteinResults = new LevenshteinResults(integerOne, integerOne, integerOne, integerOne); + final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerTwo, integerOne, integerOne, integerOne); + assertFalse(levenshteinResults.equals(levenshteinResultsTwo)); + } + @Test void testEqualsSameObject() { final Integer integer = 1662; @@ -62,4 +71,11 @@ void testEqualsWithNull() { assertFalse(levenshteinResults.equals(null)); } + @Test + void testEqualsWithDifferentObject() { + final Integer integer = -647; + final LevenshteinResults levenshteinResults = new LevenshteinResults(integer, null, null, integer); + assertFalse(levenshteinResults.equals("Test")); + } + } diff --git a/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java b/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java index 2ca0a4b994..8063c911e7 100644 --- a/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java +++ b/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java @@ -89,6 +89,8 @@ void testLogestCommonSubsequence() { assertEquals("", subject.logestCommonSubsequence("", "")); assertEquals("", subject.logestCommonSubsequence("left", "")); assertEquals("", subject.logestCommonSubsequence("", "right")); + assertEquals("", subject.logestCommonSubsequence("l", "a")); + assertEquals("", subject.logestCommonSubsequence("left", "a")); assertEquals("fog", subject.logestCommonSubsequence("frog", "fog")); assertEquals("", subject.logestCommonSubsequence("fly", "ant")); assertEquals("h", subject.logestCommonSubsequence("elephant", "hippo")); @@ -106,6 +108,8 @@ void testLongestCommonSubsequence() { assertEquals("", subject.longestCommonSubsequence("", "")); assertEquals("", subject.longestCommonSubsequence("left", "")); assertEquals("", subject.longestCommonSubsequence("", "right")); + assertEquals("", subject.longestCommonSubsequence("l", "a")); + assertEquals("", subject.longestCommonSubsequence("left", "a")); assertEquals("fog", subject.longestCommonSubsequence("frog", "fog")); assertEquals("", subject.longestCommonSubsequence("fly", "ant")); assertEquals("h", subject.longestCommonSubsequence("elephant", "hippo")); diff --git a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java index 7585f71df1..3bb3328377 100644 --- a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java +++ b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java @@ -17,9 +17,11 @@ package org.apache.commons.text.translate; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; +import java.io.UncheckedIOException; import java.io.Writer; import org.junit.jupiter.api.Test; @@ -46,8 +48,20 @@ void testWith() throws IOException { final CharSequenceTranslator charSequenceTranslatorThree = new TestCharSequenceTranslator(); final CharSequenceTranslator aggregatedTranslator = charSequenceTranslatorOne.with(charSequenceTranslatorTwo, charSequenceTranslatorThree); aggregatedTranslator.translate("", 0, null); - assertTrue(aggregatedTranslator instanceof AggregateTranslator); + assertInstanceOf(AggregateTranslator.class, aggregatedTranslator); assertEquals(3, translateInvocationCounter); } + @Test + void testIOException() { + final CharSequenceTranslator translator = new CharSequenceTranslator() { + @Override + public int translate(CharSequence input, int index, Writer writer) throws IOException { + throw new IOException("Test exception"); + } + }; + + assertThrows(UncheckedIOException.class, + () -> translator.translate(".")); + } } diff --git a/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java b/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java index e9b78b44b7..1f7d4b7be3 100644 --- a/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java +++ b/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java @@ -38,6 +38,10 @@ void testBetween() { result = oue.translate(input); assertEquals("\377", result, "Failed to unescape octal characters via the between method"); + input = "\\777"; + result = oue.translate(input); + assertEquals("\777", result, "Failed to unescape octal characters via the between method"); + input = "\\377 and"; result = oue.translate(input); assertEquals("\377 and", result, "Failed to unescape octal characters via the between method"); @@ -79,4 +83,31 @@ void testBetween() { assertEquals("\\999", result, "Failed to ignore an out of range octal character via the between method"); } + @Test + void testInvalid() { + final OctalUnescaper oue = new OctalUnescaper(); + final String input = "\\4a"; + final String result = oue.translate(input); + assertEquals("\4a", result, "Failed to unescape octal characters via the between method"); + } + + @Test + void testHighLowSurrogate() { + final OctalUnescaper oue = new OctalUnescaper(); + String input = "\\377\uD800and"; + String result = oue.translate(input); + assertEquals("\377\uD800and", result, "Failed to unescape octal characters via the between method"); + + input = "\\377\uD83D\uDE80and"; + result = oue.translate(input); + assertEquals("\377\uD83D\uDE80and", result, "Failed to unescape octal characters via the between method"); + + input = "\\377\uD83D\uDC00and"; + result = oue.translate(input); + assertEquals("\377\uD83D\uDC00and", result, "Failed to unescape octal characters via the between method"); + + input = "\\377\uD83D"; + result = oue.translate(input); + assertEquals("\377\uD83D", result, "Failed to unescape octal characters via the between method"); + } } diff --git a/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java index 37e6fdebd0..12ade3f325 100644 --- a/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java +++ b/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java @@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import java.io.IOException; import java.io.StringWriter; import java.io.Writer; @@ -34,7 +33,7 @@ class SinglePassTranslatorTest { private final SinglePassTranslator dummyTranslator = new SinglePassTranslator() { @Override - void translateWhole(final CharSequence input, final Writer writer) throws IOException { + void translateWhole(final CharSequence input, final Writer writer) { // noop } }; @@ -63,4 +62,15 @@ void testTranslateThrowsIllegalArgumentException() { assertThrows(IllegalArgumentException.class, () -> dummyTranslator.translate("(,Fk", 647, null)); } + @Test + void testTranslateThrowsIllegalArgumentExceptionWithNonAnonymousClass() { + assertThrows(IllegalArgumentException.class, () -> new TestTranslator().translate("(,Fk", 647, null)); + } + + private static final class TestTranslator extends SinglePassTranslator { + @Override + void translateWhole(final CharSequence input, final Writer writer) { + // noop + } + } } diff --git a/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java b/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java index cd106c66c4..f20d710678 100644 --- a/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java +++ b/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java @@ -49,4 +49,9 @@ void testUuuuu() { final String result = escaper.translate(input); assertEquals("G", result, "Failed to unescape Unicode characters with many 'u' characters"); } + + @Test + void testTooShort() { + assertThrows(IllegalArgumentException.class, () -> new UnicodeUnescaper().translate("\\u")); + } } From 94200bc822aa17d93d07286672ed3aaa96a0fe24 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 07:58:33 -0500 Subject: [PATCH 16/61] Bump the level of test coverage checks. See: Improve test coverage #732. --- pom.xml | 9 +++++---- src/changes/changes.xml | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index f795a65026..17345d6bdc 100644 --- a/pom.xml +++ b/pom.xml @@ -72,13 +72,14 @@ commons.releaseManagerKey --> + true 1.00 - 0.97 - 0.98 + 0.99 + 0.99 0.95 - 0.94 - 0.98 + 0.99 + 0.97
    diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 547a6d5f1d..5be0355c4b 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -47,8 +47,10 @@ The type attribute can be add,update,fix,remove. + Improve test coverage #732. + Bump the level of test coverage checks. From 2f36f016a3ff14523ab66f1ec4137d02c9e4f193 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 08:17:31 -0500 Subject: [PATCH 17/61] Bump github/codeql-action from 4.31.7 to 4.31.8 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c928d7b1b4..8223940b02 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 + uses: github/codeql-action/init@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 + uses: github/codeql-action/autobuild@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 + uses: github/codeql-action/analyze@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index cefcc23f34..217e1d4180 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7 + uses: github/codeql-action/upload-sarif@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 with: sarif_file: results.sarif From f63330b8c6dae451199242168abb282078b519ab Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 14:17:18 -0500 Subject: [PATCH 18/61] Sort members --- .../text/lookup/StringLookupFactoryTest.java | 28 +++++++++---------- .../similarity/LevenshteinResultsTest.java | 22 +++++++-------- .../translate/CharSequenceTranslatorTest.java | 22 +++++++-------- .../text/translate/OctalUnescaperTest.java | 16 +++++------ .../translate/SinglePassTranslatorTest.java | 14 +++++----- .../text/translate/UnicodeUnescaperTest.java | 10 +++---- 6 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/test/java/org/apache/commons/text/lookup/StringLookupFactoryTest.java b/src/test/java/org/apache/commons/text/lookup/StringLookupFactoryTest.java index 43e6f237f1..caeccd8289 100644 --- a/src/test/java/org/apache/commons/text/lookup/StringLookupFactoryTest.java +++ b/src/test/java/org/apache/commons/text/lookup/StringLookupFactoryTest.java @@ -103,6 +103,12 @@ void testAddDefaultStringLookupsNull() { StringLookupFactory.INSTANCE.addDefaultStringLookups(null); } + @Test + void testClear() { + // this will clear out the global cache in ConstantStringLookup + StringLookupFactory.clear(); + } + /** * Tests that we return the singleton. */ @@ -229,6 +235,14 @@ void testDefaultStringLookupsHolder_multipleLookups() { // @formatter:on } + /** + * Tests that we return the singleton. + */ + @Test + void testDeprecatedSingletons() { + assertSame(StringLookupFactory.INSTANCE_BASE64_DECODER, StringLookupFactory.INSTANCE.base64StringLookup()); + } + /** * Tests that we return the singleton. */ @@ -257,14 +271,6 @@ void testSingletons() { assertSame(XmlEncoderStringLookup.INSTANCE, stringLookupFactory.xmlEncoderStringLookup()); } - /** - * Tests that we return the singleton. - */ - @Test - void testDeprecatedSingletons() { - assertSame(StringLookupFactory.INSTANCE_BASE64_DECODER, StringLookupFactory.INSTANCE.base64StringLookup()); - } - @Test void testXmlStringLookup() { final StringLookupFactory stringLookupFactory = StringLookupFactory.INSTANCE; @@ -286,10 +292,4 @@ void testXmlStringLookupExternalEntityOn() { final String key = XmlStringLookupTest.DOC_DIR + "document-entity-ref.xml:/document/content"; assertEquals(XmlStringLookupTest.DATA, StringLookupFactory.INSTANCE.xmlStringLookup(XmlStringLookupTest.EMPTY_MAP).apply(key).trim()); } - - @Test - void testClear() { - // this will clear out the global cache in ConstantStringLookup - StringLookupFactory.clear(); - } } diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java index ac93db0605..d72f91f9c4 100644 --- a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java +++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java @@ -32,20 +32,20 @@ void testEqualsDifferenceInSubstitutionCount() { } @Test - void testEqualsReturningFalse() { + void testEqualsDifferentDistance() { final Integer integerOne = 1662; final Integer integerTwo = 1164; final LevenshteinResults levenshteinResults = new LevenshteinResults(integerOne, integerOne, integerOne, integerOne); - final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerOne, integerOne, integerTwo, integerTwo); + final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerTwo, integerOne, integerOne, integerOne); assertFalse(levenshteinResults.equals(levenshteinResultsTwo)); } @Test - void testEqualsDifferentDistance() { + void testEqualsReturningFalse() { final Integer integerOne = 1662; final Integer integerTwo = 1164; final LevenshteinResults levenshteinResults = new LevenshteinResults(integerOne, integerOne, integerOne, integerOne); - final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerTwo, integerOne, integerOne, integerOne); + final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerOne, integerOne, integerTwo, integerTwo); assertFalse(levenshteinResults.equals(levenshteinResultsTwo)); } @@ -56,6 +56,13 @@ void testEqualsSameObject() { assertTrue(levenshteinResults.equals(levenshteinResults)); } + @Test + void testEqualsWithDifferentObject() { + final Integer integer = -647; + final LevenshteinResults levenshteinResults = new LevenshteinResults(integer, null, null, integer); + assertFalse(levenshteinResults.equals("Test")); + } + @Test void testEqualsWithNonNull() { final Integer integer = 1; @@ -71,11 +78,4 @@ void testEqualsWithNull() { assertFalse(levenshteinResults.equals(null)); } - @Test - void testEqualsWithDifferentObject() { - final Integer integer = -647; - final LevenshteinResults levenshteinResults = new LevenshteinResults(integer, null, null, integer); - assertFalse(levenshteinResults.equals("Test")); - } - } diff --git a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java index 3bb3328377..894fc877b1 100644 --- a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java +++ b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java @@ -41,17 +41,6 @@ public int translate(final CharSequence input, final int index, final Writer wri //Used to count translate invocations private int translateInvocationCounter; - @Test - void testWith() throws IOException { - final CharSequenceTranslator charSequenceTranslatorOne = new TestCharSequenceTranslator(); - final CharSequenceTranslator charSequenceTranslatorTwo = new TestCharSequenceTranslator(); - final CharSequenceTranslator charSequenceTranslatorThree = new TestCharSequenceTranslator(); - final CharSequenceTranslator aggregatedTranslator = charSequenceTranslatorOne.with(charSequenceTranslatorTwo, charSequenceTranslatorThree); - aggregatedTranslator.translate("", 0, null); - assertInstanceOf(AggregateTranslator.class, aggregatedTranslator); - assertEquals(3, translateInvocationCounter); - } - @Test void testIOException() { final CharSequenceTranslator translator = new CharSequenceTranslator() { @@ -64,4 +53,15 @@ public int translate(CharSequence input, int index, Writer writer) throws IOExce assertThrows(UncheckedIOException.class, () -> translator.translate(".")); } + + @Test + void testWith() throws IOException { + final CharSequenceTranslator charSequenceTranslatorOne = new TestCharSequenceTranslator(); + final CharSequenceTranslator charSequenceTranslatorTwo = new TestCharSequenceTranslator(); + final CharSequenceTranslator charSequenceTranslatorThree = new TestCharSequenceTranslator(); + final CharSequenceTranslator aggregatedTranslator = charSequenceTranslatorOne.with(charSequenceTranslatorTwo, charSequenceTranslatorThree); + aggregatedTranslator.translate("", 0, null); + assertInstanceOf(AggregateTranslator.class, aggregatedTranslator); + assertEquals(3, translateInvocationCounter); + } } diff --git a/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java b/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java index 1f7d4b7be3..2dd9cefa3a 100644 --- a/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java +++ b/src/test/java/org/apache/commons/text/translate/OctalUnescaperTest.java @@ -83,14 +83,6 @@ void testBetween() { assertEquals("\\999", result, "Failed to ignore an out of range octal character via the between method"); } - @Test - void testInvalid() { - final OctalUnescaper oue = new OctalUnescaper(); - final String input = "\\4a"; - final String result = oue.translate(input); - assertEquals("\4a", result, "Failed to unescape octal characters via the between method"); - } - @Test void testHighLowSurrogate() { final OctalUnescaper oue = new OctalUnescaper(); @@ -110,4 +102,12 @@ void testHighLowSurrogate() { result = oue.translate(input); assertEquals("\377\uD83D", result, "Failed to unescape octal characters via the between method"); } + + @Test + void testInvalid() { + final OctalUnescaper oue = new OctalUnescaper(); + final String input = "\\4a"; + final String result = oue.translate(input); + assertEquals("\4a", result, "Failed to unescape octal characters via the between method"); + } } diff --git a/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java index 12ade3f325..1a66bc1973 100644 --- a/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java +++ b/src/test/java/org/apache/commons/text/translate/SinglePassTranslatorTest.java @@ -30,6 +30,13 @@ */ class SinglePassTranslatorTest { + private static final class TestTranslator extends SinglePassTranslator { + @Override + void translateWhole(final CharSequence input, final Writer writer) { + // noop + } + } + private final SinglePassTranslator dummyTranslator = new SinglePassTranslator() { @Override @@ -66,11 +73,4 @@ void testTranslateThrowsIllegalArgumentException() { void testTranslateThrowsIllegalArgumentExceptionWithNonAnonymousClass() { assertThrows(IllegalArgumentException.class, () -> new TestTranslator().translate("(,Fk", 647, null)); } - - private static final class TestTranslator extends SinglePassTranslator { - @Override - void translateWhole(final CharSequence input, final Writer writer) { - // noop - } - } } diff --git a/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java b/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java index f20d710678..2879f56c1e 100644 --- a/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java +++ b/src/test/java/org/apache/commons/text/translate/UnicodeUnescaperTest.java @@ -34,6 +34,11 @@ void testLessThanFour() { assertThrows(IllegalArgumentException.class, () -> escaper.translate(input)); } + @Test + void testTooShort() { + assertThrows(IllegalArgumentException.class, () -> new UnicodeUnescaper().translate("\\u")); + } + // Requested in LANG-507 @Test void testUPlus() { @@ -49,9 +54,4 @@ void testUuuuu() { final String result = escaper.translate(input); assertEquals("G", result, "Failed to unescape Unicode characters with many 'u' characters"); } - - @Test - void testTooShort() { - assertThrows(IllegalArgumentException.class, () -> new UnicodeUnescaper().translate("\\u")); - } } From 1e8c3f704d2f15d343a910c6192985a59d4b664f Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 14:19:45 -0500 Subject: [PATCH 19/61] Use final --- .../java/org/apache/commons/text/StringSubstitutorTest.java | 2 +- .../commons/text/translate/CharSequenceTranslatorTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java index 4022fc3da1..83544c9490 100644 --- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java +++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java @@ -1088,7 +1088,7 @@ void testSubstitutePreserveEscape() throws IOException { @Test void testToString() { final StringSubstitutor s = new StringSubstitutor(null, "prefix", "suffix"); - String str = s.toString(); + final String str = s.toString(); assertTrue(str.contains("\"prefix\""), "Had: " + str); } } diff --git a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java index 894fc877b1..cd16956cd3 100644 --- a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java +++ b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java @@ -45,7 +45,7 @@ public int translate(final CharSequence input, final int index, final Writer wri void testIOException() { final CharSequenceTranslator translator = new CharSequenceTranslator() { @Override - public int translate(CharSequence input, int index, Writer writer) throws IOException { + public int translate(final CharSequence input, final int index, final Writer writer) throws IOException { throw new IOException("Test exception"); } }; From 70e527e723307dd26b790382632fb152d45cd1fb Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 14:21:16 -0500 Subject: [PATCH 20/61] Don't use @Deprecated on test methods --- .../java/org/apache/commons/text/StrBuilderAppendInsertTest.java | 1 - src/test/java/org/apache/commons/text/StrBuilderTest.java | 1 - src/test/java/org/apache/commons/text/StrLookupTest.java | 1 - src/test/java/org/apache/commons/text/StrMatcherTest.java | 1 - src/test/java/org/apache/commons/text/StrSubstitutorTest.java | 1 - src/test/java/org/apache/commons/text/StrTokenizerTest.java | 1 - .../commons/text/similarity/LongestCommonSubsequenceTest.java | 1 - 7 files changed, 7 deletions(-) diff --git a/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java b/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java index 15a8313e97..05e64ae8df 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderAppendInsertTest.java @@ -35,7 +35,6 @@ * * @deprecated This class will be removed in 2.0. */ -@Deprecated class StrBuilderAppendInsertTest { /** The system line separator. */ diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java index c27cf469fc..6ae331e931 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java @@ -45,7 +45,6 @@ * * @deprecated This class will be removed in 2.0. */ -@Deprecated class StrBuilderTest { private static final class MockReadable implements Readable { diff --git a/src/test/java/org/apache/commons/text/StrLookupTest.java b/src/test/java/org/apache/commons/text/StrLookupTest.java index 125737a4a6..3b74af62b8 100644 --- a/src/test/java/org/apache/commons/text/StrLookupTest.java +++ b/src/test/java/org/apache/commons/text/StrLookupTest.java @@ -32,7 +32,6 @@ * * @deprecated This class will be removed in 2.0. */ -@Deprecated class StrLookupTest { @Test diff --git a/src/test/java/org/apache/commons/text/StrMatcherTest.java b/src/test/java/org/apache/commons/text/StrMatcherTest.java index f20264aba2..43cd3163f5 100644 --- a/src/test/java/org/apache/commons/text/StrMatcherTest.java +++ b/src/test/java/org/apache/commons/text/StrMatcherTest.java @@ -26,7 +26,6 @@ * * @deprecated This class will be removed in 2.0. */ -@Deprecated class StrMatcherTest { private static final char[] BUFFER1 = "0,1\t2 3\n\r\f\u0000'\"".toCharArray(); diff --git a/src/test/java/org/apache/commons/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/text/StrSubstitutorTest.java index b4c3065033..ebefd2a568 100644 --- a/src/test/java/org/apache/commons/text/StrSubstitutorTest.java +++ b/src/test/java/org/apache/commons/text/StrSubstitutorTest.java @@ -39,7 +39,6 @@ * * @deprecated This class will be removed in 2.0. */ -@Deprecated class StrSubstitutorTest { private Map values; diff --git a/src/test/java/org/apache/commons/text/StrTokenizerTest.java b/src/test/java/org/apache/commons/text/StrTokenizerTest.java index 59ca3467f4..25731b0574 100644 --- a/src/test/java/org/apache/commons/text/StrTokenizerTest.java +++ b/src/test/java/org/apache/commons/text/StrTokenizerTest.java @@ -37,7 +37,6 @@ * * @deprecated This class will be removed in 2.0. */ -@Deprecated class StrTokenizerTest { private static final String CSV_SIMPLE_FIXTURE = "A,b,c"; diff --git a/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java b/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java index 8063c911e7..f7d64874de 100644 --- a/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java +++ b/src/test/java/org/apache/commons/text/similarity/LongestCommonSubsequenceTest.java @@ -84,7 +84,6 @@ void testGettingLongestCommonSubsequenceStringNull() { } @Test - @Deprecated void testLogestCommonSubsequence() { assertEquals("", subject.logestCommonSubsequence("", "")); assertEquals("", subject.logestCommonSubsequence("left", "")); From a78023d2782b40dd1f9b1fe719fe1f5eac5f8851 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 14:23:11 -0500 Subject: [PATCH 21/61] Use static imports only for JUnit assertions --- .../lookup/Base64DecoderStringLookupTest.java | 11 ++++++---- .../lookup/Base64EncoderStringLookupTest.java | 11 ++++++---- .../lookup/BiFunctionStringLookupTest.java | 21 +++++++++++-------- .../text/lookup/BiStringLookupTest.java | 5 +++-- .../lookup/ConstantStringLookupBasicTest.java | 15 +++++++------ .../text/lookup/ConstantStringLookupTest.java | 20 ++++++++++-------- .../text/lookup/DateStringLookupTest.java | 4 ++-- .../text/lookup/DnsStringLookupTest.java | 20 +++++++++++------- .../EnvironmentVariableStringLookupTest.java | 13 +++++++----- .../text/lookup/FileStringLookupTest.java | 15 ++++++------- .../text/lookup/FunctionStringLookupTest.java | 15 +++++++------ .../InetAddressStringLookupLocalHostTest.java | 18 +++++++++------- ...ddressStringLookupLoopbackAddressTest.java | 18 +++++++++------- .../lookup/InterpolatorStringLookupTest.java | 5 ++--- .../lookup/JavaPlatformStringLookupTest.java | 7 ++++--- .../text/lookup/NullStringLookupTest.java | 10 +++++---- .../lookup/PropertiesStringLookupTest.java | 19 +++++++++-------- .../ResourceBundleStringLookupTest.java | 11 +++++----- .../text/lookup/ScriptStringLookupTest.java | 15 +++++++------ .../SystemPropertyStringLookupTest.java | 11 ++++++---- .../lookup/UrlDecoderStringLookupTest.java | 14 +++++++------ .../lookup/UrlEncoderStringLookupTest.java | 10 +++++---- .../text/lookup/UrlStringLookupTest.java | 15 +++++++------ .../lookup/XmlDecoderStringLookupTest.java | 11 ++++++---- .../lookup/XmlEncoderStringLookupTest.java | 11 ++++++---- 25 files changed, 191 insertions(+), 134 deletions(-) diff --git a/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java index c5eac76e24..99cbeeaad4 100644 --- a/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,18 +30,18 @@ class Base64DecoderStringLookupTest { @Test void test() { - Assertions.assertEquals("HelloWorld!", StringLookupFactory.INSTANCE_BASE64_DECODER.apply("SGVsbG9Xb3JsZCE=")); + assertEquals("HelloWorld!", StringLookupFactory.INSTANCE_BASE64_DECODER.apply("SGVsbG9Xb3JsZCE=")); } @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_BASE64_DECODER.apply(null)); + assertNull(StringLookupFactory.INSTANCE_BASE64_DECODER.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_BASE64_DECODER.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_BASE64_DECODER.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java index df4d320df8..b6741bb074 100644 --- a/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,18 +30,18 @@ class Base64EncoderStringLookupTest { @Test void test() { - Assertions.assertEquals("SGVsbG9Xb3JsZCE=", StringLookupFactory.INSTANCE_BASE64_ENCODER.apply("HelloWorld!")); + assertEquals("SGVsbG9Xb3JsZCE=", StringLookupFactory.INSTANCE_BASE64_ENCODER.apply("HelloWorld!")); } @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_BASE64_ENCODER.apply(null)); + assertNull(StringLookupFactory.INSTANCE_BASE64_ENCODER.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_BASE64_ENCODER.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_BASE64_ENCODER.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java index e6f9337a8b..e73f64f7ee 100644 --- a/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java @@ -17,13 +17,16 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -71,25 +74,25 @@ void testBiFunctionForNestedMap() { // Use map final BiStringLookup> stringLookup = StringLookupFactory.INSTANCE .biFunctionStringLookup(nestedMapBiFunction); - Assertions.assertEquals(rootValue2, stringLookup.lookup(rootKey2, rootMap)); - Assertions.assertEquals(subValue, stringLookup.lookup(rootKey + SEPARATOR + subKey, rootMap)); - Assertions.assertEquals(subSubValue, + assertEquals(rootValue2, stringLookup.lookup(rootKey2, rootMap)); + assertEquals(subValue, stringLookup.lookup(rootKey + SEPARATOR + subKey, rootMap)); + assertEquals(subSubValue, stringLookup.lookup(rootKey + SEPARATOR + subKeyMap + SEPARATOR + subSubKey, rootMap)); } @Test void testConcurrentHashMapNull() { - Assertions.assertNull(BiFunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); + assertNull(BiFunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); } @Test void testHashMapNull() { - Assertions.assertNull(BiFunctionStringLookup.on(new HashMap<>()).apply(null)); + assertNull(BiFunctionStringLookup.on(new HashMap<>()).apply(null)); } @Test void testNullBiFunction() { - Assertions.assertNull(BiFunctionStringLookup.on((BiFunction) null).apply(null)); + assertNull(BiFunctionStringLookup.on((BiFunction) null).apply(null)); } @Test @@ -98,13 +101,13 @@ void testOne() { final String value = "value"; final Map map = new HashMap<>(); map.put(key, value); - Assertions.assertEquals(value, FunctionStringLookup.on(map).apply(key)); + assertEquals(value, FunctionStringLookup.on(map).apply(key)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(BiFunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); + assertFalse(BiFunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java index 5aee02abb2..a54b35dbbf 100644 --- a/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java @@ -17,7 +17,8 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.junit.jupiter.api.Test; /** @@ -27,7 +28,7 @@ class BiStringLookupTest { @Test void testDefaultMethod() { - Assertions.assertEquals("a", ((BiStringLookup) key -> key).lookup("a", "b")); + assertEquals("a", ((BiStringLookup) key -> key).lookup("a", "b")); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java index f3a4bbfeb4..d438abac97 100644 --- a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java @@ -17,8 +17,11 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -55,12 +58,12 @@ public void beforeEach() { @Test void testNull() { - Assertions.assertNull(ConstantStringLookup.INSTANCE.apply(null)); + assertNull(ConstantStringLookup.INSTANCE.apply(null)); } @Test void testNullClassFetch() { - Assertions.assertNull(new ConstantStringLookup() { + assertNull(new ConstantStringLookup() { @Override protected Class fetchClass(final String className) throws ClassNotFoundException { return null; @@ -70,20 +73,20 @@ protected Class fetchClass(final String className) throws ClassNotFoundExcept @Test void testNullValue() { - Assertions.assertEquals(NULL_STRING_FIXTURE, ConstantStringLookup.INSTANCE + assertEquals(NULL_STRING_FIXTURE, ConstantStringLookup.INSTANCE .apply(ConstantStringLookupBasicTest.class.getName() + ".NULL_STRING_FIXTURE")); } @Test void testOne() { - Assertions.assertEquals(STRING_FIXTURE, + assertEquals(STRING_FIXTURE, ConstantStringLookup.INSTANCE.apply(ConstantStringLookupBasicTest.class.getName() + ".STRING_FIXTURE")); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(ConstantStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(ConstantStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java index 49d252acd8..fccc45d788 100644 --- a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java @@ -16,10 +16,12 @@ */ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + import java.awt.event.KeyEvent; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -71,7 +73,7 @@ void testLookupCache() { */ @Test void testLookupConstant() { - Assertions.assertEquals(FIELD, stringLookup.apply(variable("FIELD")), "Wrong value of constant"); + assertEquals(FIELD, stringLookup.apply(variable("FIELD")), "Wrong value of constant"); } /** @@ -79,7 +81,7 @@ void testLookupConstant() { */ @Test void testLookupInvalidSyntax() { - Assertions.assertNull(stringLookup.apply("InvalidVariableName"), + assertNull(stringLookup.apply("InvalidVariableName"), "Non null return value for invalid variable name"); } @@ -88,7 +90,7 @@ void testLookupInvalidSyntax() { */ @Test void testLookupNonExisting() { - Assertions.assertNull(stringLookup.apply(variable("NO_FIELD")), + assertNull(stringLookup.apply(variable("NO_FIELD")), "Non null return value for non existing constant"); } @@ -99,8 +101,8 @@ void testLookupNonExisting() { void testLookupNonString() { final String ref = KeyEvent.class.getName() + ".VK_ESCAPE"; final String expected = Integer.toString(KeyEvent.VK_ESCAPE); - Assertions.assertEquals(expected, stringLookup.apply(ref), "Wrong result of first lookup"); - Assertions.assertEquals(expected, stringLookup.apply(ref), "Wrong result of 2nd lookup"); + assertEquals(expected, stringLookup.apply(ref), "Wrong result of first lookup"); + assertEquals(expected, stringLookup.apply(ref), "Wrong result of 2nd lookup"); } /** @@ -108,7 +110,7 @@ void testLookupNonString() { */ @Test void testLookupNull() { - Assertions.assertNull(stringLookup.apply(null), "Non null return value for null variable"); + assertNull(stringLookup.apply(null), "Non null return value for null variable"); } /** @@ -116,7 +118,7 @@ void testLookupNull() { */ @Test void testLookupPrivate() { - Assertions.assertNull(stringLookup.apply(variable("PRIVATE_FIELD")), + assertNull(stringLookup.apply(variable("PRIVATE_FIELD")), "Non null return value for non accessible field"); } @@ -125,7 +127,7 @@ void testLookupPrivate() { */ @Test void testLookupUnknownClass() { - Assertions.assertNull(stringLookup.apply("org.apache.commons.configuration.NonExistingConfig." + FIELD), + assertNull(stringLookup.apply("org.apache.commons.configuration.NonExistingConfig." + FIELD), "Non null return value for unknown class"); } diff --git a/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java index cd358a34b0..e09e8aa599 100644 --- a/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java @@ -18,6 +18,7 @@ package org.apache.commons.text.lookup; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -26,7 +27,6 @@ import java.text.SimpleDateFormat; import java.util.Date; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -62,7 +62,7 @@ void testFormat() { @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(DateStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(DateStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java index c1ce322b16..b62dee6aa5 100644 --- a/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java @@ -17,10 +17,14 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.net.InetAddress; import java.net.UnknownHostException; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -31,28 +35,28 @@ class DnsStringLookupTest { @Test void testAddressFromHostAddress() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getHostAddress(), + assertEquals(localHost.getHostAddress(), DnsStringLookup.INSTANCE.apply("address|" + localHost.getHostAddress())); } @Test void testAddressFromHostName() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getHostAddress(), + assertEquals(localHost.getHostAddress(), DnsStringLookup.INSTANCE.apply("address|" + localHost.getHostName())); } @Test void testCanonicalNameFromHostAddress() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getCanonicalHostName(), + assertEquals(localHost.getCanonicalHostName(), DnsStringLookup.INSTANCE.apply("canonical-name|" + localHost.getHostAddress())); } @Test void testCanonicalNameFromHostName() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getCanonicalHostName(), + assertEquals(localHost.getCanonicalHostName(), DnsStringLookup.INSTANCE.apply("canonical-name|" + localHost.getHostName())); } @@ -66,18 +70,18 @@ void testName() throws UnknownHostException { matched = true; } } - Assertions.assertTrue(matched); + assertTrue(matched); } @Test void testNull() { - Assertions.assertNull(DnsStringLookup.INSTANCE.apply(null)); + assertNull(DnsStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(DnsStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(DnsStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java index 2dd798087d..346adf154c 100644 --- a/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java @@ -17,8 +17,11 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.apache.commons.lang3.SystemUtils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -28,24 +31,24 @@ class EnvironmentVariableStringLookupTest { @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(null)); + assertNull(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(null)); } @Test void testOne() { if (SystemUtils.IS_OS_WINDOWS) { final String key = "PATH"; - Assertions.assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); + assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); } else if (SystemUtils.IS_OS_LINUX) { final String key = "USER"; - Assertions.assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); + assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); } } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java index acfaae7a9a..d87be3ae1a 100644 --- a/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java @@ -18,6 +18,8 @@ package org.apache.commons.text.lookup; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; @@ -28,7 +30,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringSubstitutor; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -44,7 +45,7 @@ public static String readDocumentFixtureString() throws IOException { } public static void testFence(final String expectedString, final FileStringLookup fileStringLookup) { - Assertions.assertEquals(expectedString, fileStringLookup.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); + assertEquals(expectedString, fileStringLookup.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); assertThrows(IllegalArgumentException.class, () -> fileStringLookup.apply("UTF-8:/src/test/resources/org/apache/commons/text/document.properties")); assertThrows(IllegalArgumentException.class, () -> fileStringLookup.apply("UTF-8:../src/test/resources/org/apache/commons/text/document.properties")); } @@ -73,19 +74,19 @@ void testDefaultInstanceMissingFilePart() { @Test void testDefaultInstanceNull() { - Assertions.assertNull(FileStringLookup.INSTANCE.apply(null)); + assertNull(FileStringLookup.INSTANCE.apply(null)); } @Test void testDefaultInstanceOne() throws Exception { final String expectedString = readDocumentFixtureString(); - Assertions.assertEquals(expectedString, FileStringLookup.INSTANCE.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); + assertEquals(expectedString, FileStringLookup.INSTANCE.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); } @Test void testDefaultInstanceToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(FileStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(FileStringLookup.INSTANCE.toString().isEmpty()); } @Test @@ -120,13 +121,13 @@ void testFenceCurrentDirPlusOne() throws Exception { @Test void testFenceEmptyOne() throws Exception { final String expectedString = readDocumentFixtureString(); - Assertions.assertEquals(expectedString, new FileStringLookup().apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); + assertEquals(expectedString, new FileStringLookup().apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); } @Test void testFenceNullOne() throws Exception { final String expectedString = readDocumentFixtureString(); - Assertions.assertEquals(expectedString, + assertEquals(expectedString, new FileStringLookup((Path[]) null).apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); } diff --git a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java index c9f297336a..92ff7ac3c1 100644 --- a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java @@ -17,12 +17,15 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -32,17 +35,17 @@ class FunctionStringLookupTest { @Test void testConcurrentHashMapNull() { - Assertions.assertNull(FunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); + assertNull(FunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); } @Test void testHashMapNull() { - Assertions.assertNull(FunctionStringLookup.on(new HashMap<>()).apply(null)); + assertNull(FunctionStringLookup.on(new HashMap<>()).apply(null)); } @Test void testNullFunction() { - Assertions.assertNull(FunctionStringLookup.on((Function) null).apply(null)); + assertNull(FunctionStringLookup.on((Function) null).apply(null)); } @Test @@ -51,13 +54,13 @@ void testOne() { final String value = "value"; final Map map = new HashMap<>(); map.put(key, value); - Assertions.assertEquals(value, FunctionStringLookup.on(map).apply(key)); + assertEquals(value, FunctionStringLookup.on(map).apply(key)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(FunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); + assertFalse(FunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java index 762f10621d..8f2aad3cb2 100644 --- a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java +++ b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java @@ -17,10 +17,14 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.net.InetAddress; import java.net.UnknownHostException; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -30,33 +34,33 @@ class InetAddressStringLookupLocalHostTest { @Test void testAddress() throws UnknownHostException { - Assertions.assertEquals(InetAddress.getLocalHost().getHostAddress(), InetAddressStringLookup.LOCAL_HOST.apply("address")); + assertEquals(InetAddress.getLocalHost().getHostAddress(), InetAddressStringLookup.LOCAL_HOST.apply("address")); } @Test void testBadKey() { - Assertions.assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOCAL_HOST.apply("FOO")); + assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOCAL_HOST.apply("FOO")); } @Test void testCanonicalName() throws UnknownHostException { - Assertions.assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), InetAddressStringLookup.LOCAL_HOST.apply("canonical-name")); + assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), InetAddressStringLookup.LOCAL_HOST.apply("canonical-name")); } @Test void testName() throws UnknownHostException { - Assertions.assertEquals(InetAddress.getLocalHost().getHostName(), InetAddressStringLookup.LOCAL_HOST.apply("name")); + assertEquals(InetAddress.getLocalHost().getHostName(), InetAddressStringLookup.LOCAL_HOST.apply("name")); } @Test void testNull() { - Assertions.assertNull(InetAddressStringLookup.LOCAL_HOST.apply(null)); + assertNull(InetAddressStringLookup.LOCAL_HOST.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(InetAddressStringLookup.LOCAL_HOST.toString().isEmpty()); + assertFalse(InetAddressStringLookup.LOCAL_HOST.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java index 282ea6dc48..b69c002edd 100644 --- a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java +++ b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java @@ -17,9 +17,13 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.net.InetAddress; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -29,33 +33,33 @@ class InetAddressStringLookupLoopbackAddressTest { @Test void testAddress() { - Assertions.assertEquals(InetAddress.getLoopbackAddress().getHostAddress(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("address")); + assertEquals(InetAddress.getLoopbackAddress().getHostAddress(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("address")); } @Test void testBadKey() { - Assertions.assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOOPACK_ADDRESS.apply("FOO")); + assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOOPACK_ADDRESS.apply("FOO")); } @Test void testCanonicalName() { - Assertions.assertEquals(InetAddress.getLoopbackAddress().getCanonicalHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("canonical-name")); + assertEquals(InetAddress.getLoopbackAddress().getCanonicalHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("canonical-name")); } @Test void testName() { - Assertions.assertEquals(InetAddress.getLoopbackAddress().getHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("name")); + assertEquals(InetAddress.getLoopbackAddress().getHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("name")); } @Test void testNull() { - Assertions.assertNull(InetAddressStringLookup.LOOPACK_ADDRESS.apply(null)); + assertNull(InetAddressStringLookup.LOOPACK_ADDRESS.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(InetAddressStringLookup.LOOPACK_ADDRESS.toString().isEmpty()); + assertFalse(InetAddressStringLookup.LOOPACK_ADDRESS.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java index 6b49df48b0..631538a606 100644 --- a/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java @@ -27,7 +27,6 @@ import java.util.Map; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -115,12 +114,12 @@ void testLookupWithNullDefaultInterpolator() { @Test void testNull() { - Assertions.assertNull(InterpolatorStringLookup.INSTANCE.apply(null)); + assertNull(InterpolatorStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(new InterpolatorStringLookup().toString().isEmpty()); + assertFalse(new InterpolatorStringLookup().toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java index 759e4d5c54..3f08165340 100644 --- a/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java @@ -17,11 +17,12 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.commons.lang3.ArrayUtils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -41,13 +42,13 @@ void testMain() { @Test void testNull() { - Assertions.assertNull(JavaPlatformStringLookup.INSTANCE.apply(null)); + assertNull(JavaPlatformStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(JavaPlatformStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(JavaPlatformStringLookup.INSTANCE.toString().isEmpty()); } @Test diff --git a/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java index 2612de2d47..768d894dce 100644 --- a/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java @@ -17,7 +17,9 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,14 +29,14 @@ class NullStringLookupTest { @Test void test() { - Assertions.assertNull(StringLookupFactory.INSTANCE_NULL.apply("EverythingIsNull")); - Assertions.assertNull(StringLookupFactory.INSTANCE_NULL.apply(null)); + assertNull(StringLookupFactory.INSTANCE_NULL.apply("EverythingIsNull")); + assertNull(StringLookupFactory.INSTANCE_NULL.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_NULL.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_NULL.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java index a9a3f86f74..9991056eab 100644 --- a/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java @@ -18,6 +18,8 @@ package org.apache.commons.text.lookup; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.nio.file.Path; @@ -27,7 +29,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringSubstitutor; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -131,10 +132,10 @@ void testMissingKey() { @Test void testNull() { - Assertions.assertNull(PropertiesStringLookup.INSTANCE.apply(null)); - Assertions.assertNull(new PropertiesStringLookup().apply(null)); - Assertions.assertNull(new PropertiesStringLookup(NULL_PATH_ARRAY).apply(null)); - Assertions.assertNull(new PropertiesStringLookup(CURRENT_PATH).apply(null)); + assertNull(PropertiesStringLookup.INSTANCE.apply(null)); + assertNull(new PropertiesStringLookup().apply(null)); + assertNull(new PropertiesStringLookup(NULL_PATH_ARRAY).apply(null)); + assertNull(new PropertiesStringLookup(CURRENT_PATH).apply(null)); } @Test @@ -149,10 +150,10 @@ void testOne() { @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(PropertiesStringLookup.INSTANCE.toString().isEmpty()); - Assertions.assertFalse(new PropertiesStringLookup().toString().isEmpty()); - Assertions.assertFalse(new PropertiesStringLookup(NULL_PATH_ARRAY).toString().isEmpty()); - Assertions.assertFalse(new PropertiesStringLookup(CURRENT_PATH).toString().isEmpty()); + assertFalse(PropertiesStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(new PropertiesStringLookup().toString().isEmpty()); + assertFalse(new PropertiesStringLookup(NULL_PATH_ARRAY).toString().isEmpty()); + assertFalse(new PropertiesStringLookup(CURRENT_PATH).toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java index b3721f24d6..21520a8959 100644 --- a/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java @@ -17,6 +17,8 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; @@ -24,7 +26,6 @@ import java.util.ResourceBundle; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -39,7 +40,7 @@ class ResourceBundleStringLookupTest { void testAny() { final String bundleName = TEST_RESOURCE_BUNDLE; final String bundleKey = KEY; - Assertions.assertEquals(ResourceBundle.getBundle(bundleName).getString(bundleKey), + assertEquals(ResourceBundle.getBundle(bundleName).getString(bundleKey), ResourceBundleStringLookup.INSTANCE.apply(AbstractStringLookup.toLookupKey(bundleName, bundleKey))); } @@ -77,19 +78,19 @@ void testMissingKeyInSpec() { @Test void testNull() { - Assertions.assertNull(ResourceBundleStringLookup.INSTANCE.apply(null)); + assertNull(ResourceBundleStringLookup.INSTANCE.apply(null)); } @Test void testOne() { - Assertions.assertEquals(ResourceBundle.getBundle(TEST_RESOURCE_BUNDLE).getString(KEY), + assertEquals(ResourceBundle.getBundle(TEST_RESOURCE_BUNDLE).getString(KEY), new ResourceBundleStringLookup(TEST_RESOURCE_BUNDLE).apply(KEY)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(ResourceBundleStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(ResourceBundleStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java index 92e4189650..d61987c3a8 100644 --- a/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java @@ -17,11 +17,14 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import javax.script.ScriptEngineManager; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -48,17 +51,17 @@ void testNoScript() { @Test void testNull() { - Assertions.assertNull(ScriptStringLookup.INSTANCE.apply(null)); + assertNull(ScriptStringLookup.INSTANCE.apply(null)); } @Test void testOne() { - Assertions.assertEquals("Hello World!", ScriptStringLookup.INSTANCE.apply(JS_NAME + ":\"Hello World!\"")); + assertEquals("Hello World!", ScriptStringLookup.INSTANCE.apply(JS_NAME + ":\"Hello World!\"")); } @Test void testSanityCheck() { - Assertions.assertNotNull(new ScriptEngineManager().getEngineByName(JS_NAME), JS_NAME); + assertNotNull(new ScriptEngineManager().getEngineByName(JS_NAME), JS_NAME); } @Test @@ -68,14 +71,14 @@ void testScriptMissingColon() { @Test void testScriptUsingMultipleColons() { - Assertions.assertEquals("It Works", + assertEquals("It Works", ScriptStringLookup.INSTANCE.apply(JS_NAME + ":true ? \"It Works\" : \"It Does Not Work\" ")); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(ScriptStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(ScriptStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java index 84ae67e2c5..7e71681edb 100644 --- a/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,19 +30,19 @@ class SystemPropertyStringLookupTest { @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(null)); + assertNull(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.toString().isEmpty()); } @Test void testUserName() { final String key = "user.name"; - Assertions.assertEquals(System.getProperty(key), StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(key)); + assertEquals(System.getProperty(key), StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(key)); } } diff --git a/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java index b0a87bb5f2..a6b218b80a 100644 --- a/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java @@ -17,6 +17,9 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -24,7 +27,6 @@ import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -36,7 +38,7 @@ class UrlDecoderStringLookupTest { @Test void testAllPercent() { - Assertions.assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World%21")); + assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World%21")); } @Test @@ -49,23 +51,23 @@ void testExceptionGettingString() throws UnsupportedEncodingException { @Test void testExclamation() { - Assertions.assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World!")); + assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World!")); } @Test void testNull() { - Assertions.assertNull(UrlDecoderStringLookup.INSTANCE.apply(null)); + assertNull(UrlDecoderStringLookup.INSTANCE.apply(null)); } @Test void testPlus() { - Assertions.assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello+World!")); + assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello+World!")); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(UrlDecoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(UrlDecoderStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java index 0b4eb7572b..4805d094bc 100644 --- a/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java @@ -17,6 +17,9 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -24,7 +27,6 @@ import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -36,7 +38,7 @@ class UrlEncoderStringLookupTest { @Test void test() { - Assertions.assertEquals(DATA, UrlEncoderStringLookup.INSTANCE.apply("Hello World!")); + assertEquals(DATA, UrlEncoderStringLookup.INSTANCE.apply("Hello World!")); } @Test @@ -49,13 +51,13 @@ void testExceptionGettingString() throws UnsupportedEncodingException { @Test void testNull() { - Assertions.assertNull(UrlEncoderStringLookup.INSTANCE.apply(null)); + assertNull(UrlEncoderStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(UrlEncoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(UrlEncoderStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java index e69fb60d4e..916e67cf82 100644 --- a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java @@ -17,6 +17,10 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.net.URI; @@ -25,7 +29,6 @@ import java.nio.file.Path; import java.nio.file.Paths; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -55,13 +58,13 @@ void testFileScheme() throws Exception { // System.out.println(uri); final byte[] expectedBytes = Files.readAllBytes(path); final String expectedString = new String(expectedBytes, StandardCharsets.UTF_8); - Assertions.assertEquals(expectedString, UrlStringLookup.INSTANCE.apply("UTF-8:" + uri.toString())); + assertEquals(expectedString, UrlStringLookup.INSTANCE.apply("UTF-8:" + uri.toString())); } @Test void testHttpScheme() { - Assertions.assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.apache.org")); - Assertions.assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.google.com")); + assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.apache.org")); + assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.google.com")); } @Test @@ -71,13 +74,13 @@ void testMissingUrl() { @Test void testNull() { - Assertions.assertNull(UrlStringLookup.INSTANCE.apply(null)); + assertNull(UrlStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(UrlStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(UrlStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java index d378f59673..117c6f38b7 100644 --- a/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -29,18 +32,18 @@ class XmlDecoderStringLookupTest { @Test void testDecode() { - Assertions.assertEquals(DATA, XmlDecoderStringLookup.INSTANCE.apply("<element>")); + assertEquals(DATA, XmlDecoderStringLookup.INSTANCE.apply("<element>")); } @Test void testNull() { - Assertions.assertNull(XmlDecoderStringLookup.INSTANCE.apply(null)); + assertNull(XmlDecoderStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(XmlDecoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(XmlDecoderStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java index b597fc1484..219cd6ed12 100644 --- a/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -29,18 +32,18 @@ class XmlEncoderStringLookupTest { @Test void testDecode() { - Assertions.assertEquals(DATA, XmlEncoderStringLookup.INSTANCE.apply("")); + assertEquals(DATA, XmlEncoderStringLookup.INSTANCE.apply("")); } @Test void testNull() { - Assertions.assertNull(XmlEncoderStringLookup.INSTANCE.apply(null)); + assertNull(XmlEncoderStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(XmlEncoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(XmlEncoderStringLookup.INSTANCE.toString().isEmpty()); } } From 88e375d5622cacc5c927fd71806b1d06febbbfc7 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 14:27:49 -0500 Subject: [PATCH 22/61] Bump actions/cache from 4.3.0 to 5.0.1 --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8223940b02..b1cc918df2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: false - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From 86963d1b3caf5024e99a5a161ad4168823b58803 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 12 Dec 2025 14:48:51 -0500 Subject: [PATCH 23/61] Reduce vertical whitespace --- src/changes/changes.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 5be0355c4b..dcbfe45203 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -320,7 +320,6 @@ The type attribute can be add,update,fix,remove. [build] maven-pmd-plugin 3.12.0 -> 3.13.0. [build] org.mockito 3.3.3 -> 3.4.4. - commons-text web page missing "RELEASE-NOTES-1.7.txt" (doc) Fixed wrong value for Jaro-Winkler example #117 @@ -330,7 +329,6 @@ The type attribute can be add,update,fix,remove. Expand Javadoc for StringSubstitutor and friends. [site] checkstyle.version 8.21 -> 8.23. - WordUtils.wrap must calculate offset increment from wrapOn pattern length Jaro Winkler Distance refers to similarity @@ -348,14 +346,12 @@ The type attribute can be add,update,fix,remove. Update tests from org.assertj:assertj-core 3.12.1 to 3.12.2. Update site from com.puppycrawl.tools:checkstyle 8.18 to 8.21. - Add the resource string bundle string lookup to the default set of lookups Add StringLookupFactory methods for the URL encoder and decoder string lookups org.apache.commons.text.lookup.StringLookupFactory.interpolatorStringLookup() should reuse a singleton instance Add a Base64 encoder string lookup. - Improve JaccardSimilarity computational cost JSON escaping incorrect for the delete control character @@ -372,7 +368,6 @@ The type attribute can be add,update,fix,remove. Add URL encoder and decoder string lookups. Add constant string lookup like the one in Apache Commons Configuration. - StringEscapeUtils#unescapeJson does not unescape double quotes and forward slash Remove mention of SQL escaping from user guide @@ -380,7 +375,6 @@ The type attribute can be add,update,fix,remove. Allow full customization with new API org.apache.commons.text.lookup.StringLookupFactory.interpolatorStringLookup(Map<String, StringLookup>, StringLookup, boolean). WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. - Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility Build failure with java 9-ea+159 @@ -391,7 +385,6 @@ The type attribute can be add,update,fix,remove. Add a local host string lookup: LocalHostStringLookup StrLookup API confusing - Upversion commons-lang to 3.7 Exception thrown in ExtendedMessageFormat using quotes with custom registry @@ -412,7 +405,6 @@ The type attribute can be add,update,fix,remove. Add StrLookup.resourceBundleLookup(ResourceBundle) Typo in LongestCommonSubsequence#logestCommonSubsequence - WordUtils should use toXxxxCase(int) rather than toXxxxCase(char) WordUtils.abbreviate support @@ -422,7 +414,6 @@ The type attribute can be add,update,fix,remove. Correct round issue in Jaro Winkler implementation Similar to LANG-1025, clirr fails site build. - Fixing the 200 checkstyle errors present in 1.0-beta-1 Mutable fields should be private - Incorporate suggestions from RC2 into 1.0 release Naming packages org.apache.commons.text.beta @@ -483,6 +473,5 @@ The type attribute can be add,update,fix,remove. Add Hamming distance Incorporate String algorithms from Commons Lang - From 4746223a5f14308b47c5adfac132b26aa69fbd25 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 17 Dec 2025 07:51:19 -0500 Subject: [PATCH 24/61] Bump github/codeql-action from 4.31.8 to 4.31.9 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b1cc918df2..d7e8c4a82c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 + uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 + uses: github/codeql-action/autobuild@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 + uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 217e1d4180..48e22b5942 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8 + uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 with: sarif_file: results.sarif From 788a011760c7308ad2bbce20b20056b5e292a35d Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 19 Dec 2025 13:51:57 -0500 Subject: [PATCH 25/61] Bump actions/upload-artifact from 5.0.0 to 6.0.0 --- .github/workflows/scorecards-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 48e22b5942..3c49b0d632 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -57,7 +57,7 @@ jobs: publish_results: true - name: "Upload artifact" - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0 with: name: SARIF file path: results.sarif From a6caa498edb8d17f7a78d7ebfe7279986985e212 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 21 Dec 2025 15:41:22 -0500 Subject: [PATCH 26/61] Javadoc --- .../org/apache/commons/text/similarity/EditDistance.java | 8 ++++---- .../commons/text/similarity/ObjectSimilarityScore.java | 4 ++-- .../apache/commons/text/similarity/SimilarityScore.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/text/similarity/EditDistance.java b/src/main/java/org/apache/commons/text/similarity/EditDistance.java index 2b81d8d9c2..77b735dbd2 100644 --- a/src/main/java/org/apache/commons/text/similarity/EditDistance.java +++ b/src/main/java/org/apache/commons/text/similarity/EditDistance.java @@ -27,10 +27,10 @@ * the set {@code S}: *

    *
      - *
    • {@code d(x,y) >= 0}, non-negativity or separation axiom
    • - *
    • {@code d(x,y) == 0}, if and only if, {@code x == y}
    • - *
    • {@code d(x,y) == d(y,x)}, symmetry, and
    • - *
    • {@code d(x,z) <= d(x,y) + d(y,z)}, the triangle inequality
    • + *
    • {@code d(x, y) >= 0}, non-negativity or separation axiom
    • + *
    • {@code d(x, y) == 0}, if and only if, {@code x == y}
    • + *
    • {@code d(x, y) == d(y, x)}, symmetry, and
    • + *
    • {@code d(x, z) <= d(x, y) + d(y, z)}, the triangle inequality
    • *
    * * diff --git a/src/main/java/org/apache/commons/text/similarity/ObjectSimilarityScore.java b/src/main/java/org/apache/commons/text/similarity/ObjectSimilarityScore.java index 393518aed7..21ce3afbcb 100644 --- a/src/main/java/org/apache/commons/text/similarity/ObjectSimilarityScore.java +++ b/src/main/java/org/apache/commons/text/similarity/ObjectSimilarityScore.java @@ -30,8 +30,8 @@ * A similarity score is the function {@code d: [X * X] -> [0, INFINITY)} with the following properties: *

    *
      - *
    • {@code d(x,y) >= 0}, non-negativity or separation axiom
    • - *
    • {@code d(x,y) == d(y,x)}, symmetry.
    • + *
    • {@code d(x, y) >= 0}, non-negativity or separation axiom
    • + *
    • {@code d(x, y) == d(y, x)}, symmetry.
    • *
    * *

    diff --git a/src/main/java/org/apache/commons/text/similarity/SimilarityScore.java b/src/main/java/org/apache/commons/text/similarity/SimilarityScore.java index 4a2f7de7e3..dcd1dbaf46 100644 --- a/src/main/java/org/apache/commons/text/similarity/SimilarityScore.java +++ b/src/main/java/org/apache/commons/text/similarity/SimilarityScore.java @@ -27,8 +27,8 @@ * following properties: *

    *
      - *
    • {@code d(x,y) >= 0}, non-negativity or separation axiom
    • - *
    • {@code d(x,y) == d(y,x)}, symmetry.
    • + *
    • {@code d(x, y) >= 0}, non-negativity or separation axiom
    • + *
    • {@code d(x, y) == d(y, x)}, symmetry.
    • *
    *

    * Notice, these are two of the properties that contribute to {@code d} being a metric. From 23d232af1331e15b3d752ffbaa18eae91e0fbb52 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 29 Dec 2025 08:52:06 -0500 Subject: [PATCH 27/61] Bump notice file end year from 2025 to 2026 --- NOTICE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE.txt b/NOTICE.txt index 0c73fbda69..167fda3832 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Commons Text -Copyright 2014-2025 The Apache Software Foundation +Copyright 2014-2026 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (https://www.apache.org/). From deef0f66abf905b9e4630cac24f46060aca694ed Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 31 Dec 2025 18:06:25 -0500 Subject: [PATCH 28/61] Javadoc: Empty Javadoc line before the 1st tag. --- src/main/java/org/apache/commons/text/StrTokenizer.java | 1 + src/main/java/org/apache/commons/text/TextRandomProvider.java | 1 + src/main/java/org/apache/commons/text/WordUtils.java | 1 + .../org/apache/commons/text/translate/SinglePassTranslator.java | 1 + 4 files changed, 4 insertions(+) diff --git a/src/main/java/org/apache/commons/text/StrTokenizer.java b/src/main/java/org/apache/commons/text/StrTokenizer.java index 66ede10fd3..9d757234e5 100644 --- a/src/main/java/org/apache/commons/text/StrTokenizer.java +++ b/src/main/java/org/apache/commons/text/StrTokenizer.java @@ -389,6 +389,7 @@ public StrTokenizer(final String input, final StrMatcher delim, final StrMatcher /** * Unsupported ListIterator operation. + * * @param obj this parameter ignored. * @throws UnsupportedOperationException always. */ diff --git a/src/main/java/org/apache/commons/text/TextRandomProvider.java b/src/main/java/org/apache/commons/text/TextRandomProvider.java index 84eb843db3..82477d6b89 100644 --- a/src/main/java/org/apache/commons/text/TextRandomProvider.java +++ b/src/main/java/org/apache/commons/text/TextRandomProvider.java @@ -39,6 +39,7 @@ * .build(); * } * + * * @since 1.1 */ public interface TextRandomProvider extends IntUnaryOperator { diff --git a/src/main/java/org/apache/commons/text/WordUtils.java b/src/main/java/org/apache/commons/text/WordUtils.java index ca41c6c3c3..720ca5f98c 100644 --- a/src/main/java/org/apache/commons/text/WordUtils.java +++ b/src/main/java/org/apache/commons/text/WordUtils.java @@ -779,6 +779,7 @@ public static String wrap(final String str, * "flammable\ninflammable" * * + * * @param str the String to be word wrapped, may be null. * @param wrapLength the column to wrap the words at, less than 1 is treated as 1. * @param newLineStr the string to insert for a new line, {@code null} uses the system property line separator. diff --git a/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java b/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java index 90dd7f23bc..2fd4f67100 100644 --- a/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java +++ b/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java @@ -37,6 +37,7 @@ private String getClassName() { /** * {@inheritDoc} + * * @throws IllegalArgumentException if {@code index != 0}. */ @Override From 02a5aa15b5a77d0048430483806f41f0637e8528 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jan 2026 16:55:27 -0500 Subject: [PATCH 29/61] Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 (#734) Bumps `commons.bytebuddy.version` from 1.18.2 to 1.18.3. Updates `net.bytebuddy:byte-buddy` from 1.18.2 to 1.18.3 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.18.2...byte-buddy-1.18.3) Updates `net.bytebuddy:byte-buddy-agent` from 1.18.2 to 1.18.3 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.18.2...byte-buddy-1.18.3) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-version: 1.18.3 dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: net.bytebuddy:byte-buddy-agent dependency-version: 1.18.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 17345d6bdc..d79a4eeb05 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-text site-content 3.20.0 - 1.18.2 + 1.18.3 1.6 false 1.37 From a911fd8c119860fc17a97d2036ab6275893067e4 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 1 Jan 2026 16:56:10 -0500 Subject: [PATCH 30/61] Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734 --- src/changes/changes.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index dcbfe45203..fe4bfb9e16 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -51,6 +51,7 @@ The type attribute can be add,update,fix,remove. Bump the level of test coverage checks. + Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734. From 5504c26dacf6a51701c949e47ab1c981cb4018b3 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 2 Jan 2026 17:39:04 -0500 Subject: [PATCH 31/61] Format XML --- src/changes/changes.xml | 831 ++++++++++++++++++++-------------------- 1 file changed, 415 insertions(+), 416 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index fe4bfb9e16..b45a1061c8 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -37,10 +37,8 @@ and commit The type attribute can be add,update,fix,remove. --> - - + Apache Commons Text Changes @@ -53,369 +51,370 @@ The type attribute can be add,update,fix,remove. Bump the level of test coverage checks. Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734. - - - Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...). - Inserting at the end of a TextStringBuilder throws a StringIndexOutOfBoundsException. - Fix TextStringBuilderTest.testAppendToCharBuffer() to use proper argument type #724. - Fix Apache RAT plugin console warnings. - Fix site XML to use version 2.0.0 XML schema. - Removed unreachable threshold verification code in src/main/java/org/apache/commons/text/similarity #730. - Enable secure processing for the XML parser in XmlStringLookup in case the underlying JAXP implementation doesn't #729. - - Add experimental CycloneDX VEX file #683. - Add Damerau-Levenshtein distance #687. - Add unit tests to increase coverage #719. - Add new test for CharSequenceTranslator#with() #725. - Add tests and assertions to org.apache.commons.text.similarity to get to 100% code coverage #727, #728. - - Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726. - Bump commons.bytebuddy.version from 1.17.6 to 1.18.2 #696, #722. - Bump graalvm.version from 24.2.2 to 25.0.1 #703, #716. - Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.20.0. - Bump commons-io:commons-io from 2.20.0 to 2.21.0. - - - - Fix PMD UnnecessaryFullyQualifiedName in StringLookupFactory. - Fix PMD UnnecessaryFullyQualifiedName in DefaultStringLookupsHolder. - Fix PMD UnnecessaryFullyQualifiedName in PropertiesStringLookup. - Fix PMD UnnecessaryFullyQualifiedName in JavaPlatformStringLookup. - Fix PMD UnnecessaryFullyQualifiedName in StringSubstitutor. - Fix PMD UnnecessaryFullyQualifiedName in StrSubstitutor. - Fix PMD UnnecessaryFullyQualifiedName in AlphabetConverter. - Fix PMD AvoidBranchingStatementAsLastInLoop in TextStringBuilder. - Fix PMD AvoidBranchingStatementAsLastInLoop in StrBuilder. - org.apache.commons.text.translate.LookupTranslator.LookupTranslator(Map CharSequence>) now throws NullPointerException instead of java.security.InvalidParameterException. - - Interface StringLookup now extends UnaryOperator<String>. - Interface TextRandomProvider extends IntUnaryOperator. - Add RandomStringGenerator.Builder.usingRandom(IntUnaryOperator). - Add PMD check to default Maven goal. - Add org.apache.commons.text.RandomStringGenerator.Builder.setAccumulate(boolean). - - Bump org.apache.commons:commons-parent from 81 to 85 #668. - Bump commons-io:commons-io from 2.18.0 to 2.20.0. - Bump graalvm.version from 24.2.0 to 24.2.2 #665, #681. - Bump commons.bytebuddy.version from 1.17.5 to 1.17.6 (#677). - Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 #680. - - - - Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80). - Deprecate EntityArrays.EntityArrays(). - StringLookupFactory.DefaultStringLookupsHolder.createDefaultStringLookups() maps DefaultStringLookup.LOCAL_HOST twice instead of once for LOCAL_HOST and LOOPBACK_ADDRESS. - - - Bump org.apache.commons:commons-parent from 79 to 81. - Bump commons.bytebuddy.version from 1.16.1 to 1.17.5 #643, #659, #660. - Bump graalvm.version from 24.1.2 to 24.2.0 #653. - - - - Add StringLookupFactory.loopbackAddressStringLookup(). - Add StringLookupFactory.KEY_LOOPBACK_ADDRESS. - Add DefaultStringLookup.LOOPBACK_ADDRESS. - Add richer inputs in package org.apache.commons.text.similarity with SimilarityInput. - Add HammingDistance.apply(SimilarityInput, SimilarityInput). - Add JaccardDistance.apply(SimilarityInput, SimilarityInput). - Add JaccardSimilarity.apply(SimilarityInput, SimilarityInput). - Add JaroWinklerDistance.apply(SimilarityInput, SimilarityInput). - Add JaroWinklerSimilarity.apply(SimilarityInput, SimilarityInput). - Add LevenshteinDetailedDistance.apply(SimilarityInput, SimilarityInput). - Add LevenshteinDistance.apply(SimilarityInput, SimilarityInput). - - Fix build on Java 22. - Fix build on Java 23-ea. - Make package-private constructor private: StrLookup.MapStrLookup.MapStrLookup(Map). - Make package-private constructor private: StrLookup.SystemPropertiesStrLookup.SystemPropertiesStrLookup(). - Make package-private class private and final: MapStrLookup. - Make package-private class private: StrMatcher.CharMatcher. - Make package-private class private: StrMatcher.CharSetMatcher. - Make package-private class private: StrMatcher.NoMatcher. - Make package-private class private: StrMatcher.StringMatcher. - Make package-private class private: StrMatcher.TrimMatcher. - Make package-private class private and final: IntersectionSimilarity.BagCount. - Make package-private class private and final: IntersectionSimilarity.TinyCount. - Deprecate LevenshteinDistance.LevenshteinDistance() in favor of LevenshteinDistance.getDefaultInstance(). - Deprecate LevenshteinDetailedDistance.LevenshteinDetailedDistance() in favor of LevenshteinDetailedDistance.getDefaultInstance(). - Improve StrBuilder documentation for new line text. - Improve TextStringBuilder documentation for new line text #547. - Required OSGi Import-Package version numbers in MANIFEST.MF #627. - - Bump org.apache.commons:commons-parent from 69 to 78 #542, #557, #571, #581, #584, #593, #600, #603, #614. - Bump tests on Java >= 22 org.graalvm.*:* from 24.0.0 to 24.1.1 #592, #610. - Bump commons.bytebuddy.version from 1.14.13 to 1.16.1 #538, #548, #553, #565, #579, #582, #585, #596, #597, #604, #612, #620, #623, #625, #640. - Bump SpotBugs from 4.8.3 to 4.8.5. - Bump org.assertj:assertj-core from 3.25.3 to 3.26.3 #554, #566. - Bump org.codehaus.mojo:taglist-maven-plugin from 3.0.0 to 3.2.1 #564, #611. - Bump org.apache.commons:commons-rng-simple from 1.5 to 1.6 #568. - Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #569, #575, #586. - Bump commons-io:commons-io from 2.16.1 to 2.18.0 #594, #628. - - - - Add StringLookupFactory.fileStringLookup(Path...) and deprecated fileStringLookup(). - Add StringLookupFactory.propertiesStringLookup(Path...) and deprecated propertiesStringLookup(). - Add StringLookupFactory.xmlStringLookup(Map, Path...) and deprecated xmlStringLookup() and xmlStringLookup(Map). - Add StringLookupFactory.builder() for fencing Path resolution of the file, properties and XML lookups. - Add DoubleFormat.Builder.get() as Builder now implements Supplier. - - WordUtils.containsAllWords​() may throw PatternSyntaxException. - Fix regression for determining whitespace in WordUtils #519. - Deprecate Builder in favor of Supplier. - - Bump commons-lang3 from 3.13.0 to 3.14.0. - Bump commons.bytebuddy.version from 1.14.9 to 1.14.13 #476, #482, #505, #521. - Bump org.codehaus.mojo:exec-maven-plugin from 3.1.0 to 3.2.0 #474, #508. - Bump commons-io from 2.15.0 to 2.16.1 #522, #527. - Bump commons-parent from 64 to 69 #524. - Bump org.assertj:assertj-core from 3.24.2 to 3.25.3. - - - - Fix StringTokenizer.getTokenList to return an independent modifiable list - Fix Javadoc for StringEscapeUtils.escapeHtml4 #382 - TextStringBuidler#hashCode() allocates a String on each call #387. - Fix Bundle-SymbolicName to use the package name org.apache.commons.text - Add and use a package-private singleton for RegexTokenizer. - Add and use a package-private singleton for CosineSimilarity. - Add and use a package-private singleton for LongestCommonSubsequence. - Add and use a package-private singleton for JaroWinklerSimilarity. - Add and use a package-private singleton for JaccardSimilarity. - [StepSecurity] ci: Harden GitHub Actions #428. - Improve AlphabetConverter Javadoc #429. - Fix exception message in IntersectionResult to make set-theoretic sense #438. - Add null-check in RandomStringGenerator#Builder#selectFrom() to avoid NullPointerException #434. - Add null-check in RandomStringGenerator#Builder#withinRange() to avoid NullPointerException. - Fix TextStringBuilder to over-allocate when ensuring capacity #452. - Constructor for ResourceBundleStringLookup should be private instead of package-private. - Constructor for UrlDecoderStringLookup should be private instead of package-private. - Constructor for UrlEncoderStringLookup should be private instead of package-private. - Javadoc of org.apache.commons.text.lookup.DefaultStringLookup.XML is incorrect. - Update DoubleFormat to state it is based on Double.toString. #467. - - Set SecureProcessing feature in XmlStringLookup by default. - Add StringLookupFactory.xmlStringLookup(Map<String, Boolean>...). - Add @FunctionalInterface to FormatFactory. - Add RandomStringGenerator.builder(). - Add XmlEncoderStringLookup/XmlDecoderStringLookup #449. - Add StringSubstitutor.toString(). - - Bump actions/cache. - Bump actions/setup-java. - Bump actions/checkout. - Bump pmd from 6.49.0 to 6.52.0 #364. - Bump commons-rng-simple from 1.4 to 1.5 #370. - Bump spotbugs-maven-plugin from 4.7.2.0 to 4.7.3.6 #371, #385. - Bump spotbugs from 4.7.2 to 4.7.3 #373. - Bump mockito-inline from 4.8.0 to 4.11.0 #380, #389, #396, #400. - Bump jmh.version from 1.35 to 1.37 #388. - Bump commons-parent from 54 to 64 #392, #401. - Bump assertj-core from 3.23.1 to 3.24.2 #405, #410. - Bump maven-checkstyle-plugin from 3.2.0 to 3.2.1 #407. - Bump commons-io from 2.11.0 to 2.15.0. - Bump commons-lang3 from 3.12.0 to 3.13.0. - - - - Fix CaseUtils when the input string contains only delimiters - Add GraalVM test dependencies to fix test failures with Java 15. - Incorrect values for Jaccard similarity with empty strings. - StringSubstitutor map constructor throws NPE on 1.9 with null map. - JaroWinklerDistance returns the same values as JaroWinklerSimilarity. - Correct Javadoc in FileStringLookup. - Minor Improvements #192, #196. - Use StringUtils.INDEX_NOT_FOUND constant. - Remove redundant local variable. - Replace lambda with method reference. - Simplify statements. - Replace statement lambda with expression lambda. - Use static class inner class in tests. - Simplify assertion. - Extract duplicate code. - Set void return method. - Remove unused exception from TextStringBuilder.readFrom(CharBuffer). This preserves binary compatibility but not source compatibility. - StrBuilder.StrBuilderReader.skip(long): Throw an exception when an implicit narrowing conversion in a compound assignment would result in information loss or a numeric error such as an overflows. - TextStringBuilder.TextStringBuilderReader.skip(long): Throw an exception when an implicit narrowing conversion in a compound assignment would result in information loss or a numeric error such as an overflows. - TextStringBuilder.equals whatever the capacity is #281. - A More Efficient Implementation for Calculating Size of Longest Common Subsequence. - LookupTranslator returns count of chars consumed, not of codepoints consumed. - Use Math.min() call instead of doing it manually. #335. - TextStringBuilder: Throw OutOfMemoryError instead of NegativeArraySizeException. - TextStringBuilder: Can't grow to sizes up to Integer.MAX_VALUE. - Make default string lookups configurable via system property. Remove dns, url, and script lookups from defaults. If these lookups are required for use in StringSubstitutor.createInterpolator(), they must be enabled via system property. See StringLookupFactory for details. - - Add DoubleFormat utility. - Document negative limit for WordUtils abbreviate method - Speed up LevenshteinDistance with threshold by exiting early - Release Notes page hasn't been updated for 1.9 release yet. - Add StrBuilder.isNotEmpty(). - - Bump actions/setup-java from v1.4.0 to 3 #147, #156, #155, #172, #215, #314. - Bump github/codeql-action from 1 to 2 #319. - Bump checkstyle from 8.34 to 9.3, #141, #168, #182, #188, #193, #201, #208, #211, #228, #235, #245, #253, #255, #262, #270, #280, #287, #299, #315, #321. - Bump spotbugs-maven-plugin from 4.0.0 to 4.7.2.0, #144, #150, #167, #176, #194, #210, #223, #250, #268, #273, #277, #278, #286, #293, #303, #320, #325, #338, #344, #354. - Bump spotbugs from 4.1.3 to 4.7.2 #175, 189, #209, #218, #247, #256, #264, #275, #284, #289, #296, #306, #355. - Bump mockito-inline from 3.4.4 to 4.8.0, #143, #148, #149, #152, #153, #154, #158, #159, #166, #177, #180, #187, #195, #197, #207, #216, #231, #236, #237, #243, #258, #259, #260, #261, #272, #285, #291, #305, #317, #330, #331, #347, #352. - Bump junit-jupiter from 5.6.2 to 5.9.1 #163, #204, #232, #265, #269, #288, #343, #357. - Bump assertj-core from 3.16.1 to 3.23.1 #151, #157, #160, #178, #184, #199, #244, #267, #294. - Bump commons-io from 2.7 to 2.11.0 #161 #251. - Bump commons-parent from 51 to 54 #145, #358. - Bump maven-pmd-plugin from 3.13.0 to 3.19.0 #186, #263, #302, #334, #349, #353. - Bump pmd from 6.42.0 to 6.46.0. - Bump graalvm.version from 20.2.0 to 22.0.0.2 #185, #198, #206, #227, #252, #276, #295, #300. - Bump commons.japicmp.version from 0.14.3 to 0.16.0. - Bump commons.jacoco.version 0.8.5 to 0.8.8; fixes Java 15 build. - Bump maven-checkstyle-plugin from 3.1.1 to 3.2.0 #202, #348. - Bump commons-lang3 3.11 -> 3.12.0. - Bump commons.javadoc.version from 3.2.0 to 3.4.1. - Bump commons.project-info.version from 3.1.0 to 3.1.2. - Bump jmh.version from 1.32 to 1.35 #254, #292, #313. - Bump commons-rng-simple from 1.3 to 1.4 #266. - Bump taglist-maven-plugin from 2.4 to 3.0.0 #297. - Bump commons.pmd-impl.version from 6.44.0 to 6.49.0 #323, #336, #345, #350. - Bump exec-maven-plugin from 3.0.0 to 3.1.0 #340. - - - Removed non-existing parameter from Javadocs and spelled out parameters in throws. - StringEscapeUtils.unescapeCsv doesn't remove quotes at begin and end of string. - ScriptStringLookup does not accept ":" #126. - StringSubstitutor incorrectly removes some escape characters. - Fix Javadocs #135. - Fix typos #137. - Make ConstantStringLookup.constantCache final #136. - Simplify if in CaseUtils #134. - [javadoc] Fix compiler warnings in Java code example in Javadoc #124. - Update from Apache Commons Lang 3.9 to 3.11. - Add StringMatcher.size(). - Refactor TextStringBuilder.readFrom(Readable), extracting readFrom(CharBuffer) and readFrom(Reader). - Add BiStringLookup and implementation BiFunctionStringLookup. - Add org.apache.commons.text.StringSubstitutor.StringSubstitutor(StringSubstitutor). - Add org.apache.commons.text.TextStringBuilder.TextStringBuilder(CharSequence). - Add org.apache.commons.text.TextStringBuilder.drainChar(int). - Add org.apache.commons.text.TextStringBuilder.drainChars(int, int, char[]. int). - Add org.apache.commons.text.TextStringBuilder.isNotEmpty(). - Add org.apache.commons.text.TextStringBuilder.isReallocated(). - Add org.apache.commons.text.TextStringBuilder.readFrom(Reader, int). - Add org.apache.commons.text.TextStringBuilder.set(String). - Add org.apache.commons.text.TextStringBuilder.wrap(char[]). - Add org.apache.commons.text.TextStringBuilder.wrap(char[], int). - Add org.apache.commons.text.io.StringSubstitutorReader. - Add org.apache.commons.text.lookup.StringLookupFactory.functionStringLookup(Function<String, V>). - Add org.apache.commons.text.matcher.StringMatcher.isMatch(CharSequence, int). - Add org.apache.commons.text.matcher.StringMatcher.isMatch(CharSequence, int, int, int). - Add org.apache.commons.text.matcher.StringMatcherFactory.andMatcher(StringMatcher...). - Add org.apache.commons.text.matcher.StringMatcherFactory.stringMatcher(char...). - [build] Skip clirr since we use JApiCmp. - [test] junit-jupiter 5.5.1 -> 5.5.2. - [test] org.assertj:assertj-core 3.13.2 -> 3.16.1. - [build] com.puppycrawl.tools:checkstyle 8.23 -> 8.34. - [build] Update JUnit from 5.5.2 to 5.6.2. - [build] commons.jacoco.version 0.8.4 -> 0.8.5. - [build] commons.javadoc.version 3.1.1 -> 3.2.0. - [build] commons.japicmp.version 0.14.1 -> 0.14.3. - [build] checkstyle.plugin.version 3.1.0 -> 3.1.1. - [build] checkstyle.version 8.27 -> 8.33. - [build] org.apache.commons:commons-parent 48 -> 51. - [build] maven-pmd-plugin 3.12.0 -> 3.13.0. - [build] org.mockito 3.3.3 -> 3.4.4. - - - commons-text web page missing "RELEASE-NOTES-1.7.txt" - (doc) Fixed wrong value for Jaro-Winkler example #117 - Add helper factory method org.apache.commons.text.StringSubstitutor.createInterpolator(). - Add String lookup for host names and IP addresses (DnsStringLookup). - StringLookupFactory.addDefaultStringLookups(Map) does not convert keys to lower case. - Expand Javadoc for StringSubstitutor and friends. - [site] checkstyle.version 8.21 -> 8.23. - - - WordUtils.wrap must calculate offset increment from wrapOn pattern length - Jaro Winkler Distance refers to similarity - Add an enum to the lookup package that lists all StringLookups - Add a toggle to throw an exception when a variable is unknown in StringSubstitutor - TextStringBuilder append sub-sequence not consistent with Appendable. - Fix possible infinite loop in WordUtils.wrap for a regex pattern that would trigger on a match of 0 length - Make prefixSet in LookupTranslator a BitSet - Fix the RegexTokenizer to use a static Pattern - Remove rounding from JaccardDistance and JaccardSimilarity - Fix the JaroWinklerSimilarity to use StringUtils.equals to test for CharSequence equality - Add a generic IntersectionSimilarity measure - Update Apache Commons Lang from 3.8.1 to 3.9. - ResourceBundleStringLookup.lookup(String) throws MissingResourceException instead of returning null. - Update tests from org.assertj:assertj-core 3.12.1 to 3.12.2. - Update site from com.puppycrawl.tools:checkstyle 8.18 to 8.21. - - - Add the resource string bundle string lookup to the default set of lookups - Add StringLookupFactory methods for the URL encoder and decoder string lookups - org.apache.commons.text.lookup.StringLookupFactory.interpolatorStringLookup() should reuse a singleton instance - Add a Base64 encoder string lookup. - - - Improve JaccardSimilarity computational cost - JSON escaping incorrect for the delete control character - Fixes JaroWinklerDistance: Wrong results due to precision of transpositions - JaroWinklerDistance: Calculation deviates from definition - Update Apache Commons Lang from 3.7 to 3.8.1 - Add a XML file XPath string lookup. - Add a Properties file string lookup. - Add a script string lookup. - Add a file string lookup. - Add a URL string lookup. - Add a Base64 string lookup. - Add org.apache.commons.text.lookup.StringLookupFactory.resourceBundleStringLookup(String). - Add URL encoder and decoder string lookups. - Add constant string lookup like the one in Apache Commons Configuration. - - - StringEscapeUtils#unescapeJson does not unescape double quotes and forward slash - Remove mention of SQL escaping from user guide - Update Java requirement from version 7 to 8. - Allow full customization with new API org.apache.commons.text.lookup.StringLookupFactory.interpolatorStringLookup(Map<String, StringLookup>, StringLookup, boolean). - WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. - - - Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility - Build failure with java 9-ea+159 - Add an interpolator string lookup: StringLookupFactory#interpolatorStringLookup() - Add a StrSubstitutor replacement based on interfaces: StringSubstitutor - Add a StrBuilder replacement based on the StringMatcher interface: TextStringBuilder - Add a StrTokenizer replacement based on the StringMatcher interface: StringTokenizer - Add a local host string lookup: LocalHostStringLookup - StrLookup API confusing - - - Upversion commons-lang to 3.7 - Exception thrown in ExtendedMessageFormat using quotes with custom registry - StringEscapeUtils#UnEscapeJson doesn't recognize escape signs correctly - StrSubstitutor: Ability to turn off substitution in values - RandomStringGenerator able to pass multiple ranges to .withinRange() - Deprecate isDelimiter and use HashSets for delimiter checks - WordUtils.initials support for UTF-16 surrogate pairs - WordUtils should treat an empty delimiter array as no delimiters - Update RandomStringGenerator to accept a list of valid characters - Add CharacterPredicates for ASCII letters (uppercase/lowercase) and arabic numerals - Added CaseUtils class with camel case conversion support - RandomStringGenerator should be able to generate a String with a random length - Update commons-lang dependency to version 3.6 - Document that commons-csv should be used in preference to CsvTranslators - NumericEntityUnescaper.options - fix TODO - RandomStringGenerator claims to be immutable, but isn't - Add StrLookup.resourceBundleLookup(ResourceBundle) - Typo in LongestCommonSubsequence#logestCommonSubsequence - - - WordUtils should use toXxxxCase(int) rather than toXxxxCase(char) - WordUtils.abbreviate support - Putting WordUtils back in to the codebase - Add RandomStringGenerator - RandomStringGenerator: allow users to provide source of randomness - Correct round issue in Jaro Winkler implementation - Similar to LANG-1025, clirr fails site build. - - + + Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...). + Inserting at the end of a TextStringBuilder throws a StringIndexOutOfBoundsException. + Fix TextStringBuilderTest.testAppendToCharBuffer() to use proper argument type #724. + Fix Apache RAT plugin console warnings. + Fix site XML to use version 2.0.0 XML schema. + Removed unreachable threshold verification code in src/main/java/org/apache/commons/text/similarity #730. + Enable secure processing for the XML parser in XmlStringLookup in case the underlying JAXP implementation doesn't #729. + + Add experimental CycloneDX VEX file #683. + Add Damerau-Levenshtein distance #687. + Add unit tests to increase coverage #719. + Add new test for CharSequenceTranslator#with() #725. + Add tests and assertions to org.apache.commons.text.similarity to get to 100% code coverage #727, #728. + + Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726. + Bump commons.bytebuddy.version from 1.17.6 to 1.18.2 #696, #722. + Bump graalvm.version from 24.2.2 to 25.0.1 #703, #716. + Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.20.0. + Bump commons-io:commons-io from 2.20.0 to 2.21.0. + + + + Fix PMD UnnecessaryFullyQualifiedName in StringLookupFactory. + Fix PMD UnnecessaryFullyQualifiedName in DefaultStringLookupsHolder. + Fix PMD UnnecessaryFullyQualifiedName in PropertiesStringLookup. + Fix PMD UnnecessaryFullyQualifiedName in JavaPlatformStringLookup. + Fix PMD UnnecessaryFullyQualifiedName in StringSubstitutor. + Fix PMD UnnecessaryFullyQualifiedName in StrSubstitutor. + Fix PMD UnnecessaryFullyQualifiedName in AlphabetConverter. + Fix PMD AvoidBranchingStatementAsLastInLoop in TextStringBuilder. + Fix PMD AvoidBranchingStatementAsLastInLoop in StrBuilder. + org.apache.commons.text.translate.LookupTranslator.LookupTranslator(Map CharSequence>) now throws NullPointerException instead of java.security.InvalidParameterException. + + Interface StringLookup now extends UnaryOperator<String>. + Interface TextRandomProvider extends IntUnaryOperator. + Add RandomStringGenerator.Builder.usingRandom(IntUnaryOperator). + Add PMD check to default Maven goal. + Add org.apache.commons.text.RandomStringGenerator.Builder.setAccumulate(boolean). + + Bump org.apache.commons:commons-parent from 81 to 85 #668. + Bump commons-io:commons-io from 2.18.0 to 2.20.0. + Bump graalvm.version from 24.2.0 to 24.2.2 #665, #681. + Bump commons.bytebuddy.version from 1.17.5 to 1.17.6 (#677). + Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 #680. + + + + Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80). + Deprecate EntityArrays.EntityArrays(). + StringLookupFactory.DefaultStringLookupsHolder.createDefaultStringLookups() maps DefaultStringLookup.LOCAL_HOST twice instead of once for LOCAL_HOST and LOOPBACK_ADDRESS. + + + Bump org.apache.commons:commons-parent from 79 to 81. + Bump commons.bytebuddy.version from 1.16.1 to 1.17.5 #643, #659, #660. + Bump graalvm.version from 24.1.2 to 24.2.0 #653. + + + + Add StringLookupFactory.loopbackAddressStringLookup(). + Add StringLookupFactory.KEY_LOOPBACK_ADDRESS. + Add DefaultStringLookup.LOOPBACK_ADDRESS. + Add richer inputs in package org.apache.commons.text.similarity with SimilarityInput. + Add HammingDistance.apply(SimilarityInput, SimilarityInput). + Add JaccardDistance.apply(SimilarityInput, SimilarityInput). + Add JaccardSimilarity.apply(SimilarityInput, SimilarityInput). + Add JaroWinklerDistance.apply(SimilarityInput, SimilarityInput). + Add JaroWinklerSimilarity.apply(SimilarityInput, SimilarityInput). + Add LevenshteinDetailedDistance.apply(SimilarityInput, SimilarityInput). + Add LevenshteinDistance.apply(SimilarityInput, SimilarityInput). + + Fix build on Java 22. + Fix build on Java 23-ea. + Make package-private constructor private: StrLookup.MapStrLookup.MapStrLookup(Map). + Make package-private constructor private: StrLookup.SystemPropertiesStrLookup.SystemPropertiesStrLookup(). + Make package-private class private and final: MapStrLookup. + Make package-private class private: StrMatcher.CharMatcher. + Make package-private class private: StrMatcher.CharSetMatcher. + Make package-private class private: StrMatcher.NoMatcher. + Make package-private class private: StrMatcher.StringMatcher. + Make package-private class private: StrMatcher.TrimMatcher. + Make package-private class private and final: IntersectionSimilarity.BagCount. + Make package-private class private and final: IntersectionSimilarity.TinyCount. + Deprecate LevenshteinDistance.LevenshteinDistance() in favor of LevenshteinDistance.getDefaultInstance(). + Deprecate LevenshteinDetailedDistance.LevenshteinDetailedDistance() in favor of LevenshteinDetailedDistance.getDefaultInstance(). + Improve StrBuilder documentation for new line text. + Improve TextStringBuilder documentation for new line text #547. + Required OSGi Import-Package version numbers in MANIFEST.MF #627. + + Bump org.apache.commons:commons-parent from 69 to 78 #542, #557, #571, #581, #584, #593, #600, #603, #614. + Bump tests on Java >= 22 org.graalvm.*:* from 24.0.0 to 24.1.1 #592, #610. + Bump commons.bytebuddy.version from 1.14.13 to 1.16.1 #538, #548, #553, #565, #579, #582, #585, #596, #597, #604, #612, #620, #623, #625, #640. + Bump SpotBugs from 4.8.3 to 4.8.5. + Bump org.assertj:assertj-core from 3.25.3 to 3.26.3 #554, #566. + Bump org.codehaus.mojo:taglist-maven-plugin from 3.0.0 to 3.2.1 #564, #611. + Bump org.apache.commons:commons-rng-simple from 1.5 to 1.6 #568. + Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #569, #575, #586. + Bump commons-io:commons-io from 2.16.1 to 2.18.0 #594, #628. + + + + Add StringLookupFactory.fileStringLookup(Path...) and deprecated fileStringLookup(). + Add StringLookupFactory.propertiesStringLookup(Path...) and deprecated propertiesStringLookup(). + Add StringLookupFactory.xmlStringLookup(Map, Path...) and deprecated xmlStringLookup() and xmlStringLookup(Map). + Add StringLookupFactory.builder() for fencing Path resolution of the file, properties and XML lookups. + Add DoubleFormat.Builder.get() as Builder now implements Supplier. + + WordUtils.containsAllWords​() may throw PatternSyntaxException. + Fix regression for determining whitespace in WordUtils #519. + Deprecate Builder in favor of Supplier. + + Bump commons-lang3 from 3.13.0 to 3.14.0. + Bump commons.bytebuddy.version from 1.14.9 to 1.14.13 #476, #482, #505, #521. + Bump org.codehaus.mojo:exec-maven-plugin from 3.1.0 to 3.2.0 #474, #508. + Bump commons-io from 2.15.0 to 2.16.1 #522, #527. + Bump commons-parent from 64 to 69 #524. + Bump org.assertj:assertj-core from 3.24.2 to 3.25.3. + + + + Fix StringTokenizer.getTokenList to return an independent modifiable list + Fix Javadoc for StringEscapeUtils.escapeHtml4 #382 + TextStringBuidler#hashCode() allocates a String on each call #387. + Fix Bundle-SymbolicName to use the package name org.apache.commons.text + Add and use a package-private singleton for RegexTokenizer. + Add and use a package-private singleton for CosineSimilarity. + Add and use a package-private singleton for LongestCommonSubsequence. + Add and use a package-private singleton for JaroWinklerSimilarity. + Add and use a package-private singleton for JaccardSimilarity. + [StepSecurity] ci: Harden GitHub Actions #428. + Improve AlphabetConverter Javadoc #429. + Fix exception message in IntersectionResult to make set-theoretic sense #438. + Add null-check in RandomStringGenerator#Builder#selectFrom() to avoid NullPointerException #434. + Add null-check in RandomStringGenerator#Builder#withinRange() to avoid NullPointerException. + Fix TextStringBuilder to over-allocate when ensuring capacity #452. + Constructor for ResourceBundleStringLookup should be private instead of package-private. + Constructor for UrlDecoderStringLookup should be private instead of package-private. + Constructor for UrlEncoderStringLookup should be private instead of package-private. + Javadoc of org.apache.commons.text.lookup.DefaultStringLookup.XML is incorrect. + Update DoubleFormat to state it is based on Double.toString. #467. + + Set SecureProcessing feature in XmlStringLookup by default. + Add StringLookupFactory.xmlStringLookup(Map<String, Boolean>...). + Add @FunctionalInterface to FormatFactory. + Add RandomStringGenerator.builder(). + Add XmlEncoderStringLookup/XmlDecoderStringLookup #449. + Add StringSubstitutor.toString(). + + Bump actions/cache. + Bump actions/setup-java. + Bump actions/checkout. + Bump pmd from 6.49.0 to 6.52.0 #364. + Bump commons-rng-simple from 1.4 to 1.5 #370. + Bump spotbugs-maven-plugin from 4.7.2.0 to 4.7.3.6 #371, #385. + Bump spotbugs from 4.7.2 to 4.7.3 #373. + Bump mockito-inline from 4.8.0 to 4.11.0 #380, #389, #396, #400. + Bump jmh.version from 1.35 to 1.37 #388. + Bump commons-parent from 54 to 64 #392, #401. + Bump assertj-core from 3.23.1 to 3.24.2 #405, #410. + Bump maven-checkstyle-plugin from 3.2.0 to 3.2.1 #407. + Bump commons-io from 2.11.0 to 2.15.0. + Bump commons-lang3 from 3.12.0 to 3.13.0. + + + + Fix CaseUtils when the input string contains only delimiters + Add GraalVM test dependencies to fix test failures with Java 15. + Incorrect values for Jaccard similarity with empty strings. + StringSubstitutor map constructor throws NPE on 1.9 with null map. + JaroWinklerDistance returns the same values as JaroWinklerSimilarity. + Correct Javadoc in FileStringLookup. + Minor Improvements #192, #196. + Use StringUtils.INDEX_NOT_FOUND constant. + Remove redundant local variable. + Replace lambda with method reference. + Simplify statements. + Replace statement lambda with expression lambda. + Use static class inner class in tests. + Simplify assertion. + Extract duplicate code. + Set void return method. + Remove unused exception from TextStringBuilder.readFrom(CharBuffer). This preserves binary compatibility but not source compatibility. + StrBuilder.StrBuilderReader.skip(long): Throw an exception when an implicit narrowing conversion in a compound assignment would result in information loss or a numeric error such as an overflows. + TextStringBuilder.TextStringBuilderReader.skip(long): Throw an exception when an implicit narrowing conversion in a compound assignment would result in information loss or a numeric error such as an overflows. + TextStringBuilder.equals whatever the capacity is #281. + A More Efficient Implementation for Calculating Size of Longest Common Subsequence. + LookupTranslator returns count of chars consumed, not of codepoints consumed. + Use Math.min() call instead of doing it manually. #335. + TextStringBuilder: Throw OutOfMemoryError instead of NegativeArraySizeException. + TextStringBuilder: Can't grow to sizes up to Integer.MAX_VALUE. + Make default string lookups configurable via system property. Remove dns, url, and script lookups from defaults. If these lookups are required for use in StringSubstitutor.createInterpolator(), they must be enabled via system property. See StringLookupFactory for details. + + Add DoubleFormat utility. + Document negative limit for WordUtils abbreviate method + Speed up LevenshteinDistance with threshold by exiting early + Release Notes page hasn't been updated for 1.9 release yet. + Add StrBuilder.isNotEmpty(). + + Bump actions/setup-java from v1.4.0 to 3 #147, #156, #155, #172, #215, #314. + Bump github/codeql-action from 1 to 2 #319. + Bump checkstyle from 8.34 to 9.3, #141, #168, #182, #188, #193, #201, #208, #211, #228, #235, #245, #253, #255, #262, #270, #280, #287, #299, #315, #321. + Bump spotbugs-maven-plugin from 4.0.0 to 4.7.2.0, #144, #150, #167, #176, #194, #210, #223, #250, #268, #273, #277, #278, #286, #293, #303, #320, #325, #338, #344, #354. + Bump spotbugs from 4.1.3 to 4.7.2 #175, 189, #209, #218, #247, #256, #264, #275, #284, #289, #296, #306, #355. + Bump mockito-inline from 3.4.4 to 4.8.0, #143, #148, #149, #152, #153, #154, #158, #159, #166, #177, #180, #187, #195, #197, #207, #216, #231, #236, #237, #243, #258, #259, #260, #261, #272, #285, #291, #305, #317, #330, #331, #347, #352. + Bump junit-jupiter from 5.6.2 to 5.9.1 #163, #204, #232, #265, #269, #288, #343, #357. + Bump assertj-core from 3.16.1 to 3.23.1 #151, #157, #160, #178, #184, #199, #244, #267, #294. + Bump commons-io from 2.7 to 2.11.0 #161 #251. + Bump commons-parent from 51 to 54 #145, #358. + Bump maven-pmd-plugin from 3.13.0 to 3.19.0 #186, #263, #302, #334, #349, #353. + Bump pmd from 6.42.0 to 6.46.0. + Bump graalvm.version from 20.2.0 to 22.0.0.2 #185, #198, #206, #227, #252, #276, #295, #300. + Bump commons.japicmp.version from 0.14.3 to 0.16.0. + Bump commons.jacoco.version 0.8.5 to 0.8.8; fixes Java 15 build. + Bump maven-checkstyle-plugin from 3.1.1 to 3.2.0 #202, #348. + Bump commons-lang3 3.11 -> 3.12.0. + Bump commons.javadoc.version from 3.2.0 to 3.4.1. + Bump commons.project-info.version from 3.1.0 to 3.1.2. + Bump jmh.version from 1.32 to 1.35 #254, #292, #313. + Bump commons-rng-simple from 1.3 to 1.4 #266. + Bump taglist-maven-plugin from 2.4 to 3.0.0 #297. + Bump commons.pmd-impl.version from 6.44.0 to 6.49.0 #323, #336, #345, #350. + Bump exec-maven-plugin from 3.0.0 to 3.1.0 #340. + + + Removed non-existing parameter from Javadocs and spelled out parameters in throws. + StringEscapeUtils.unescapeCsv doesn't remove quotes at begin and end of string. + ScriptStringLookup does not accept ":" #126. + StringSubstitutor incorrectly removes some escape characters. + Fix Javadocs #135. + Fix typos #137. + Make ConstantStringLookup.constantCache final #136. + Simplify if in CaseUtils #134. + [javadoc] Fix compiler warnings in Java code example in Javadoc #124. + Update from Apache Commons Lang 3.9 to 3.11. + Add StringMatcher.size(). + Refactor TextStringBuilder.readFrom(Readable), extracting readFrom(CharBuffer) and readFrom(Reader). + Add BiStringLookup and implementation BiFunctionStringLookup. + Add org.apache.commons.text.StringSubstitutor.StringSubstitutor(StringSubstitutor). + Add org.apache.commons.text.TextStringBuilder.TextStringBuilder(CharSequence). + Add org.apache.commons.text.TextStringBuilder.drainChar(int). + Add org.apache.commons.text.TextStringBuilder.drainChars(int, int, char[]. int). + Add org.apache.commons.text.TextStringBuilder.isNotEmpty(). + Add org.apache.commons.text.TextStringBuilder.isReallocated(). + Add org.apache.commons.text.TextStringBuilder.readFrom(Reader, int). + Add org.apache.commons.text.TextStringBuilder.set(String). + Add org.apache.commons.text.TextStringBuilder.wrap(char[]). + Add org.apache.commons.text.TextStringBuilder.wrap(char[], int). + Add org.apache.commons.text.io.StringSubstitutorReader. + Add org.apache.commons.text.lookup.StringLookupFactory.functionStringLookup(Function<String, V>). + Add org.apache.commons.text.matcher.StringMatcher.isMatch(CharSequence, int). + Add org.apache.commons.text.matcher.StringMatcher.isMatch(CharSequence, int, int, int). + Add org.apache.commons.text.matcher.StringMatcherFactory.andMatcher(StringMatcher...). + Add org.apache.commons.text.matcher.StringMatcherFactory.stringMatcher(char...). + [build] Skip clirr since we use JApiCmp. + [test] junit-jupiter 5.5.1 -> 5.5.2. + [test] org.assertj:assertj-core 3.13.2 -> 3.16.1. + [build] com.puppycrawl.tools:checkstyle 8.23 -> 8.34. + [build] Update JUnit from 5.5.2 to 5.6.2. + [build] commons.jacoco.version 0.8.4 -> 0.8.5. + [build] commons.javadoc.version 3.1.1 -> 3.2.0. + [build] commons.japicmp.version 0.14.1 -> 0.14.3. + [build] checkstyle.plugin.version 3.1.0 -> 3.1.1. + [build] checkstyle.version 8.27 -> 8.33. + [build] org.apache.commons:commons-parent 48 -> 51. + [build] maven-pmd-plugin 3.12.0 -> 3.13.0. + [build] org.mockito 3.3.3 -> 3.4.4. + + + commons-text web page missing "RELEASE-NOTES-1.7.txt" + (doc) Fixed wrong value for Jaro-Winkler example #117 + Add helper factory method org.apache.commons.text.StringSubstitutor.createInterpolator(). + Add String lookup for host names and IP addresses (DnsStringLookup). + StringLookupFactory.addDefaultStringLookups(Map) does not convert keys to lower case. + Expand Javadoc for StringSubstitutor and friends. + [site] checkstyle.version 8.21 -> 8.23. + + + WordUtils.wrap must calculate offset increment from wrapOn pattern length + Jaro Winkler Distance refers to similarity + Add an enum to the lookup package that lists all StringLookups + Add a toggle to throw an exception when a variable is unknown in StringSubstitutor + TextStringBuilder append sub-sequence not consistent with Appendable. + Fix possible infinite loop in WordUtils.wrap for a regex pattern that would trigger on a match of 0 length + Make prefixSet in LookupTranslator a BitSet + Fix the RegexTokenizer to use a static Pattern + Remove rounding from JaccardDistance and JaccardSimilarity + Fix the JaroWinklerSimilarity to use StringUtils.equals to test for CharSequence equality + Add a generic IntersectionSimilarity measure + Update Apache Commons Lang from 3.8.1 to 3.9. + ResourceBundleStringLookup.lookup(String) throws MissingResourceException instead of returning null. + Update tests from org.assertj:assertj-core 3.12.1 to 3.12.2. + Update site from com.puppycrawl.tools:checkstyle 8.18 to 8.21. + + + Add the resource string bundle string lookup to the default set of lookups + Add StringLookupFactory methods for the URL encoder and decoder string lookups + org.apache.commons.text.lookup.StringLookupFactory.interpolatorStringLookup() should reuse a singleton instance + Add a Base64 encoder string lookup. + + + Improve JaccardSimilarity computational cost + JSON escaping incorrect for the delete control character + Fixes JaroWinklerDistance: Wrong results due to precision of transpositions + JaroWinklerDistance: Calculation deviates from definition + Update Apache Commons Lang from 3.7 to 3.8.1 + Add a XML file XPath string lookup. + Add a Properties file string lookup. + Add a script string lookup. + Add a file string lookup. + Add a URL string lookup. + Add a Base64 string lookup. + Add org.apache.commons.text.lookup.StringLookupFactory.resourceBundleStringLookup(String). + Add URL encoder and decoder string lookups. + Add constant string lookup like the one in Apache Commons Configuration. + + + StringEscapeUtils#unescapeJson does not unescape double quotes and forward slash + Remove mention of SQL escaping from user guide + Update Java requirement from version 7 to 8. + Allow full customization with new API org.apache.commons.text.lookup.StringLookupFactory.interpolatorStringLookup(Map<String, StringLookup>, StringLookup, boolean). + WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. + + + Add Automatic-Module-Name MANIFEST entry for Java 9 compatibility + Build failure with java 9-ea+159 + Add an interpolator string lookup: StringLookupFactory#interpolatorStringLookup() + Add a StrSubstitutor replacement based on interfaces: StringSubstitutor + Add a StrBuilder replacement based on the StringMatcher interface: TextStringBuilder + Add a StrTokenizer replacement based on the StringMatcher interface: StringTokenizer + Add a local host string lookup: LocalHostStringLookup + StrLookup API confusing + + + Upversion commons-lang to 3.7 + Exception thrown in ExtendedMessageFormat using quotes with custom registry + StringEscapeUtils#UnEscapeJson doesn't recognize escape signs correctly + StrSubstitutor: Ability to turn off substitution in values + RandomStringGenerator able to pass multiple ranges to .withinRange() + Deprecate isDelimiter and use HashSets for delimiter checks + WordUtils.initials support for UTF-16 surrogate pairs + WordUtils should treat an empty delimiter array as no delimiters + Update RandomStringGenerator to accept a list of valid characters + Add CharacterPredicates for ASCII letters (uppercase/lowercase) and arabic numerals + Added CaseUtils class with camel case conversion support + RandomStringGenerator should be able to generate a String with a random length + Update commons-lang dependency to version 3.6 + Document that commons-csv should be used in preference to CsvTranslators + NumericEntityUnescaper.options - fix TODO + RandomStringGenerator claims to be immutable, but isn't + Add StrLookup.resourceBundleLookup(ResourceBundle) + Typo in LongestCommonSubsequence#logestCommonSubsequence + + + WordUtils should use toXxxxCase(int) rather than toXxxxCase(char) + WordUtils.abbreviate support + Putting WordUtils back in to the codebase + Add RandomStringGenerator + RandomStringGenerator: allow users to provide source of randomness + Correct round issue in Jaro Winkler implementation + Similar to LANG-1025, clirr fails site build. + + - Investigate locale issue in ExtendedMessageFormatTest - Resolve PMD/CMD Violations - Escape HTML characters only once: revert - Fixing the 200 checkstyle errors present in 1.0-beta-1 - Mutable fields should be private - - - Incorporate suggestions from RC2 into 1.0 release - Naming packages org.apache.commons.text.beta - Upgrading Jacoco for Java 9-ea compatibility. - Refactor EntityArrays to have unmodifiableMaps in leu of String[][] - Prepare site for 1.0 release - Move CvsTranslators out of StringEscapeUtils and make them DRY - Remove WordUtils to be added back in an upcoming 1.X release - Possible attacks through StringEscapeUtils.escapeEcmaScrip better javadoc - Remove RandomStringGenerator to be added back in the 1.1 release - Upgrade from commons-parent version 41 to version 42 - Escape HTML characters only once - Global vs local source of randomness - Fluent API in "RandomStringBuilder" - Fix JaroWinklerDistance in the manner of LUCENE-1297 - Add LCS similarity and distance - Add class to generate random strings - Unfinished class Javadoc for CosineDistance - Consolidating since tags at 1.0, removing deprecated methods - Add a builder to StringEscapeUtils - Add shell/XSI escape/unescape support - LevenshteinDistance reduce memory consumption - Remove org.apache.commons.text.names, for later release than 1.0 - Add Jaccard Index and Jaccard Distance - Move org.apache.commons.lang3.StringEscapeUtils.java into text - Moving from commons-lang, the package org.apache.commons.lang3.text - A more complex Levenshtein distance - Add coveralls and Travis.ci integration - Add alphabet converter - Create Commons Text logo - Improve HumanNameParser - IP clearance for the names package - Write user guide - Work on the string metric, distance, and similarity definitions for the project - Human name parser - Create StringDistanceFrom class that contains a StringMetric and the "left" side string. This would have a method that accepts the "right" side string to test. - Add Cosine Similarity and Cosine Distance - Change (R) StringMetric.compare(CS left, CS right) to "apply" so that it is consistent with BiFunction. - Allow extra information (e.g. Levenshtein threshold) to be stored as (final) fields in the StringMetric instance. - Port Myers algorithm from [collections] - Add Hamming distance - Incorporate String algorithms from Commons Lang - + Investigate locale issue in ExtendedMessageFormatTest + Resolve PMD/CMD Violations + Escape HTML characters only once: revert + Fixing the 200 checkstyle errors present in 1.0-beta-1 + Mutable fields should be private + + + Incorporate suggestions from RC2 into 1.0 release + Naming packages org.apache.commons.text.beta + Upgrading Jacoco for Java 9-ea compatibility. + Refactor EntityArrays to have unmodifiableMaps in leu of String[][] + Prepare site for 1.0 release + Move CvsTranslators out of StringEscapeUtils and make them DRY + Remove WordUtils to be added back in an upcoming 1.X release + Possible attacks through StringEscapeUtils.escapeEcmaScrip better javadoc + Remove RandomStringGenerator to be added back in the 1.1 release + Upgrade from commons-parent version 41 to version 42 + Escape HTML characters only once + Global vs local source of randomness + Fluent API in "RandomStringBuilder" + Fix JaroWinklerDistance in the manner of LUCENE-1297 + Add LCS similarity and distance + Add class to generate random strings + Unfinished class Javadoc for CosineDistance + Consolidating since tags at 1.0, removing deprecated methods + Add a builder to StringEscapeUtils + Add shell/XSI escape/unescape support + LevenshteinDistance reduce memory consumption + Remove org.apache.commons.text.names, for later release than 1.0 + Add Jaccard Index and Jaccard Distance + Move org.apache.commons.lang3.StringEscapeUtils.java into text + Moving from commons-lang, the package org.apache.commons.lang3.text + A more complex Levenshtein distance + Add coveralls and Travis.ci integration + Add alphabet converter + Create Commons Text logo + Improve HumanNameParser + IP clearance for the names package + Write user guide + Work on the string metric, distance, and similarity definitions for the project + Human name parser + Create StringDistanceFrom class that contains a StringMetric and the "left" side string. This would have a method that accepts the "right" side string to test. + Add Cosine Similarity and Cosine Distance + Change (R) StringMetric.compare(CS left, CS right) to "apply" so that it is consistent with BiFunction. + Allow extra information (e.g. Levenshtein threshold) to be stored as (final) fields in the StringMetric instance. + Port Myers algorithm from [collections] + Add Hamming distance + Incorporate String algorithms from Commons Lang + From 708d06f6ddadbe97a25edf25a7380122eae117a0 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 2 Jan 2026 17:39:34 -0500 Subject: [PATCH 32/61] Bump org.apache.commons:commons-parent from 93 to 94 --- pom.xml | 2 +- src/changes/changes.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d79a4eeb05..7840ddf8bc 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.apache.commons commons-parent - 93 + 94 commons-text 1.15.1-SNAPSHOT diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b45a1061c8..aa3adb90ec 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -48,8 +48,9 @@ The type attribute can be add,update,fix,remove. Improve test coverage #732. - Bump the level of test coverage checks. - Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734. + Bump org.apache.commons:commons-parent from 93 to 94. + Bump the level of test coverage checks. + Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734. From ee55227521be8d45c3f9782392ea797d2ed1a1c5 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 2 Jan 2026 18:22:08 -0500 Subject: [PATCH 33/61] Javadoc --- src/main/java/org/apache/commons/text/diff/EditCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/text/diff/EditCommand.java b/src/main/java/org/apache/commons/text/diff/EditCommand.java index ddcfbedec3..247f5c0bcd 100644 --- a/src/main/java/org/apache/commons/text/diff/EditCommand.java +++ b/src/main/java/org/apache/commons/text/diff/EditCommand.java @@ -17,7 +17,7 @@ package org.apache.commons.text.diff; /** - * Abstract base class for all commands used to transform an objects sequence + * Abstrac class for all commands used to transform an objects sequence * into another one. *

    * When two objects sequences are compared through the From 57e2298100e616f3a8833e7c3761f5e3bd4e5e26 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 2 Jan 2026 18:36:22 -0500 Subject: [PATCH 34/61] Javadoc --- src/main/java/org/apache/commons/text/diff/EditCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/text/diff/EditCommand.java b/src/main/java/org/apache/commons/text/diff/EditCommand.java index 247f5c0bcd..30cb38c4c2 100644 --- a/src/main/java/org/apache/commons/text/diff/EditCommand.java +++ b/src/main/java/org/apache/commons/text/diff/EditCommand.java @@ -17,7 +17,7 @@ package org.apache.commons.text.diff; /** - * Abstrac class for all commands used to transform an objects sequence + * Abstract class for all commands used to transform an objects sequence * into another one. *

    * When two objects sequences are compared through the From 98a5115e8da7fabc7415e268a3a1d67cf512cf38 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 4 Jan 2026 15:27:05 -0500 Subject: [PATCH 35/61] Remove dead comments --- src/main/java/org/apache/commons/text/StringEscapeUtils.java | 2 -- src/main/java/org/apache/commons/text/StringSubstitutor.java | 1 - 2 files changed, 3 deletions(-) diff --git a/src/main/java/org/apache/commons/text/StringEscapeUtils.java b/src/main/java/org/apache/commons/text/StringEscapeUtils.java index b9ee6e0e75..dc9d544094 100644 --- a/src/main/java/org/apache/commons/text/StringEscapeUtils.java +++ b/src/main/java/org/apache/commons/text/StringEscapeUtils.java @@ -562,7 +562,6 @@ public static String escapeHtml3(final String input) { return ESCAPE_HTML3.translate(input); } - // HTML and XML /** * Escapes the characters in a {@code String} using HTML entities. * @@ -591,7 +590,6 @@ public static String escapeHtml4(final String input) { return ESCAPE_HTML4.translate(input); } - // Java and JavaScript /** * Escapes the characters in a {@code String} using Java String rules. * diff --git a/src/main/java/org/apache/commons/text/StringSubstitutor.java b/src/main/java/org/apache/commons/text/StringSubstitutor.java index d794c2999c..3667e91529 100644 --- a/src/main/java/org/apache/commons/text/StringSubstitutor.java +++ b/src/main/java/org/apache/commons/text/StringSubstitutor.java @@ -671,7 +671,6 @@ private void checkCyclicSubstitution(final String varName, final List pr throw new IllegalStateException(buf.toString()); } - // Escape /** * Returns the escape character. * From 0735a2159cbc1013cbff70a9ba8fd9c24e9022f4 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 4 Jan 2026 15:27:17 -0500 Subject: [PATCH 36/61] Javadoc Add an empty line before a Javadoc comment --- src/main/java/org/apache/commons/text/StringEscapeUtils.java | 2 ++ .../java/org/apache/commons/text/diff/StringsComparator.java | 3 +++ .../apache/commons/text/lookup/JavaPlatformStringLookup.java | 5 +++++ .../org/apache/commons/text/translate/CsvTranslators.java | 4 ++++ .../org/apache/commons/text/translate/LookupTranslator.java | 3 +++ .../org/apache/commons/text/translate/UnicodeEscaper.java | 2 ++ .../text/jmh/LongestCommonSubsequencePerformance.java | 1 + 7 files changed, 20 insertions(+) diff --git a/src/main/java/org/apache/commons/text/StringEscapeUtils.java b/src/main/java/org/apache/commons/text/StringEscapeUtils.java index dc9d544094..700ca95690 100644 --- a/src/main/java/org/apache/commons/text/StringEscapeUtils.java +++ b/src/main/java/org/apache/commons/text/StringEscapeUtils.java @@ -122,6 +122,7 @@ public String toString() { return sb.toString(); } } + /** * Translator object for unescaping backslash escaped entries. */ @@ -323,6 +324,7 @@ public int translate(final CharSequence input, final int index, final Writer wri new LookupTranslator(EntityArrays.ISO8859_1_ESCAPE), new LookupTranslator(EntityArrays.HTML40_EXTENDED_ESCAPE) ); + /** * Translator object for escaping individual Comma Separated Values. * diff --git a/src/main/java/org/apache/commons/text/diff/StringsComparator.java b/src/main/java/org/apache/commons/text/diff/StringsComparator.java index 9f9813a959..2f530650ac 100644 --- a/src/main/java/org/apache/commons/text/diff/StringsComparator.java +++ b/src/main/java/org/apache/commons/text/diff/StringsComparator.java @@ -106,14 +106,17 @@ public int getStart() { return start; } } + /** * First character sequence. */ private final String left; + /** * Second character sequence. */ private final String right; + /** * Temporary array. */ diff --git a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java index faf01ee9cb..2b280b9819 100644 --- a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java +++ b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java @@ -66,14 +66,19 @@ final class JavaPlatformStringLookup extends AbstractStringLookup { * Defines the singleton for this class. */ static final JavaPlatformStringLookup INSTANCE = new JavaPlatformStringLookup(); + /** {@code hardware} key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_HARDWARE = "hardware"; + /** {@code locale} key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_LOCALE = "locale"; + /** {@code os} key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_OS = "os"; + /** {@code runtime} key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_RUNTIME = "runtime"; + /** {@code version} key for driving {@link JavaPlatformStringLookup#lookup(String)}. */ private static final String KEY_VERSION = "version"; diff --git a/src/main/java/org/apache/commons/text/translate/CsvTranslators.java b/src/main/java/org/apache/commons/text/translate/CsvTranslators.java index 9a5f467136..b116e50eac 100644 --- a/src/main/java/org/apache/commons/text/translate/CsvTranslators.java +++ b/src/main/java/org/apache/commons/text/translate/CsvTranslators.java @@ -59,6 +59,7 @@ void translateWhole(final CharSequence input, final Writer writer) throws IOExce } } } + /** * Translator for unescaping escaped Comma Separated Value entries. */ @@ -90,10 +91,13 @@ void translateWhole(final CharSequence input, final Writer writer) throws IOExce } } } + /** Comma character. */ private static final char CSV_DELIMITER = ','; + /** Quote character. */ private static final char CSV_QUOTE = '"'; + /** Quote character converted to string. */ private static final String CSV_QUOTE_STR = String.valueOf(CSV_QUOTE); diff --git a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java index 931344c55e..18f2f09287 100644 --- a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java +++ b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java @@ -33,10 +33,13 @@ public class LookupTranslator extends CharSequenceTranslator { /** The mapping to be used in translation. */ private final Map lookupMap; + /** The first character of each key in the lookupMap. */ private final BitSet prefixSet; + /** The length of the shortest key in the lookupMap. */ private final int shortest; + /** The length of the longest key in the lookupMap. */ private final int longest; diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java b/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java index a2e2c75157..cea0dcbbaa 100644 --- a/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java +++ b/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java @@ -35,6 +35,7 @@ public class UnicodeEscaper extends CodePointTranslator { public static UnicodeEscaper above(final int codePoint) { return outsideOf(0, codePoint); } + /** * Constructs a {@code UnicodeEscaper} below the specified value (exclusive). * @@ -44,6 +45,7 @@ public static UnicodeEscaper above(final int codePoint) { public static UnicodeEscaper below(final int codePoint) { return outsideOf(codePoint, Integer.MAX_VALUE); } + /** * Constructs a {@code UnicodeEscaper} between the specified values (inclusive). * diff --git a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java index 49d1318ed3..b726616519 100644 --- a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java +++ b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java @@ -49,6 +49,7 @@ @Measurement(iterations = 5, time = 1) @Fork(value = 1, jvmArgs = {"-server", "-Xms512M", "-Xmx512M"}) public class LongestCommonSubsequencePerformance { + /** * Older implementation of LongestCommonSubsequence. * Code is copied from Apache Commons Text version 1.10.0-SNAPSHOT From 6a118b75111b30fce340498e9fc06d8bc3e6421d Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 12 Jan 2026 10:50:05 -0500 Subject: [PATCH 37/61] Bump github/codeql-action from 4.31.9 to 4.31.10 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d7e8c4a82c..c4c4c67879 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + uses: github/codeql-action/autobuild@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 3c49b0d632..30e15985e1 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 with: sarif_file: results.sarif From 6f274fc9b935a489fb631b54e556088e0890e36d Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 12 Jan 2026 11:07:45 -0500 Subject: [PATCH 38/61] Bump org.apache.commons:commons-parent from 94 to 95. --- pom.xml | 2 +- src/changes/changes.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7840ddf8bc..f0d5e42d05 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.apache.commons commons-parent - 94 + 95 commons-text 1.15.1-SNAPSHOT diff --git a/src/changes/changes.xml b/src/changes/changes.xml index aa3adb90ec..8abc4c96cd 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -48,7 +48,7 @@ The type attribute can be add,update,fix,remove. Improve test coverage #732. - Bump org.apache.commons:commons-parent from 93 to 94. + Bump org.apache.commons:commons-parent from 93 to 95. Bump the level of test coverage checks. Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734. From 111ae69d4ffd0f0847e64af53d0310a0e691b2d3 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 21 Jan 2026 07:20:45 -0500 Subject: [PATCH 39/61] Bump commons.bytebuddy.version from 1.18.3 to 1.18.4 --- pom.xml | 2 +- src/changes/changes.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f0d5e42d05..0f80e4454a 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-text site-content 3.20.0 - 1.18.3 + 1.18.4 1.6 false 1.37 diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 8abc4c96cd..ed6b40c295 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -50,7 +50,7 @@ The type attribute can be add,update,fix,remove. Bump org.apache.commons:commons-parent from 93 to 95. Bump the level of test coverage checks. - Bump commons.bytebuddy.version from 1.18.2 to 1.18.3 #734. + Bump commons.bytebuddy.version from 1.18.2 to 1.18.4 #734. From c9e8e25c57ecc2a36523f8886ecdaeca1320d933 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 21 Jan 2026 17:19:28 -0500 Subject: [PATCH 40/61] Bump org.apache.commons:commons-parent from 95 to 96 --- pom.xml | 2 +- src/changes/changes.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0f80e4454a..f2049d7fde 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.apache.commons commons-parent - 95 + 96 commons-text 1.15.1-SNAPSHOT diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ed6b40c295..9ce69c483b 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -48,7 +48,7 @@ The type attribute can be add,update,fix,remove. Improve test coverage #732. - Bump org.apache.commons:commons-parent from 93 to 95. + Bump org.apache.commons:commons-parent from 93 to 96. Bump the level of test coverage checks. Bump commons.bytebuddy.version from 1.18.2 to 1.18.4 #734. From 9eb7dd84ed38c22d18b098cfadfdfc9a12f0eb38 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 22 Jan 2026 15:40:19 +0000 Subject: [PATCH 41/61] Bump actions/setup-java from 5.1.0 to 5.2.0 --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 30ddf451ed..b9b04ad5cf 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -38,7 +38,7 @@ jobs: with: persist-credentials: false - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: distribution: 'temurin' java-version: ${{ matrix.java }} From da6c6cdfdc10df43ae0efe1678cf1cfd81b9e982 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 23 Jan 2026 07:44:40 -0500 Subject: [PATCH 42/61] Bump actions/checkout from 6.0.1 to 6.0.2 --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/maven.yml | 2 +- .github/workflows/scorecards-analysis.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c4c4c67879..cc69f53340 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,7 +45,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 1df8666044..a04da50909 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -26,6 +26,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: 'Dependency Review PR' uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2 diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b9b04ad5cf..5a77f4db9d 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -34,7 +34,7 @@ jobs: experimental: true steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up JDK ${{ matrix.java }} diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 30e15985e1..966de08b57 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -40,7 +40,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false From 71f75f212c081e160e9937287e4cb0a93ef280f2 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 26 Jan 2026 09:37:42 -0500 Subject: [PATCH 43/61] Bump github/codeql-action from 4.31.10 to 4.31.11 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cc69f53340..17321f5dd1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 + uses: github/codeql-action/init@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 + uses: github/codeql-action/autobuild@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 + uses: github/codeql-action/analyze@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 966de08b57..73762bb58c 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10 + uses: github/codeql-action/upload-sarif@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 with: sarif_file: results.sarif From a0b89c079b3af0da7bd6bdc3a8a3421182e14aa4 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Tue, 27 Jan 2026 20:41:25 -0500 Subject: [PATCH 44/61] Add Checkstyle FinalLocalVariable --- src/conf/checkstyle.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml index 7ae6627aff..0158804daa 100644 --- a/src/conf/checkstyle.xml +++ b/src/conf/checkstyle.xml @@ -85,6 +85,7 @@ + From a3e4306d56481d039d19bbb020fcffde4a5d91ce Mon Sep 17 00:00:00 2001 From: Ivan Ponomarev Date: Wed, 28 Jan 2026 11:15:12 +0000 Subject: [PATCH 45/61] TEXT-239: TextStringBuilder.append(char[], int, int) uses wrong variable in exception message (#735) * fix text-239 * fix for StrBuilder * fix checkstyle issues --- .../org/apache/commons/text/StrBuilder.java | 2 +- .../apache/commons/text/TextStringBuilder.java | 2 +- .../org/apache/commons/text/StrBuilderTest.java | 17 +++++++++++++++++ .../commons/text/TextStringBuilderTest.java | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/text/StrBuilder.java b/src/main/java/org/apache/commons/text/StrBuilder.java index fce069d001..f1df60a2a2 100644 --- a/src/main/java/org/apache/commons/text/StrBuilder.java +++ b/src/main/java/org/apache/commons/text/StrBuilder.java @@ -376,7 +376,7 @@ public StrBuilder append(final char[] chars, final int startIndex, final int len return appendNull(); } if (startIndex < 0 || startIndex > chars.length) { - throw new StringIndexOutOfBoundsException("Invalid startIndex: " + length); + throw new StringIndexOutOfBoundsException("Invalid startIndex: " + startIndex); } if (length < 0 || startIndex + length > chars.length) { throw new StringIndexOutOfBoundsException("Invalid length: " + length); diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java index b3ea8585f7..2977fa3232 100644 --- a/src/main/java/org/apache/commons/text/TextStringBuilder.java +++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java @@ -483,7 +483,7 @@ public TextStringBuilder append(final char[] chars, final int startIndex, final return appendNull(); } if (startIndex < 0 || startIndex > chars.length) { - throw new StringIndexOutOfBoundsException("Invalid startIndex: " + length); + throw new StringIndexOutOfBoundsException("Invalid startIndex: " + startIndex); } if (length < 0 || startIndex + length > chars.length) { throw new StringIndexOutOfBoundsException("Invalid length: " + length); diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java index 6ae331e931..5edfec6fc6 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java @@ -2017,4 +2017,21 @@ void testTrim() { assertEquals("a b c", sb.trim().toString()); } + @Test + void testErrorMessageShowsCorrectVariable() { + final StrBuilder sb = new StrBuilder("Hello"); + final char[] chars = {'a', 'b', 'c'}; + + StringIndexOutOfBoundsException ex = assertThrows( + StringIndexOutOfBoundsException.class, + () -> sb.append(chars, 1, 4) + ); + assertTrue(ex.getMessage().contains("length: 4")); + + ex = assertThrows( + StringIndexOutOfBoundsException.class, + () -> sb.append(chars, 7, 3) + ); + assertTrue(ex.getMessage().contains("startIndex: 7")); + } } diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java index 1900c19d68..1efbf25113 100644 --- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java +++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java @@ -2393,4 +2393,21 @@ void testWrap_CharArray_Int_Exceptions() { assertThrows(IllegalArgumentException.class, () -> TextStringBuilder.wrap(ArrayUtils.EMPTY_CHAR_ARRAY, 1)); } + @Test + void testErrorMessageShowsCorrectVariable() { + final TextStringBuilder sb = new TextStringBuilder("Hello"); + final char[] chars = {'a', 'b', 'c'}; + + StringIndexOutOfBoundsException ex = assertThrows( + StringIndexOutOfBoundsException.class, + () -> sb.append(chars, 1, 4) + ); + assertTrue(ex.getMessage().contains("length: 4")); + + ex = assertThrows( + StringIndexOutOfBoundsException.class, + () -> sb.append(chars, 7, 3) + ); + assertTrue(ex.getMessage().contains("startIndex: 7")); + } } From aa7ce204885d80b5c8d66e2b7f81401e9b2883e8 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 28 Jan 2026 06:18:09 -0500 Subject: [PATCH 46/61] [TEXT-239] TextStringBuilder.append(char[], int, int) uses wrong variable in exception message #735 Use longer lines Keep test methods in AB order --- src/changes/changes.xml | 1 + .../apache/commons/text/StrBuilderTest.java | 28 +++++++------------ .../commons/text/TextStringBuilderTest.java | 28 +++++++------------ 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9ce69c483b..4bfbe4f854 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -46,6 +46,7 @@ The type attribute can be add,update,fix,remove. Improve test coverage #732. + TextStringBuilder.append(char[], int, int) uses wrong variable in exception message #735. Bump org.apache.commons:commons-parent from 93 to 96. diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java index 5edfec6fc6..6d7de7e527 100644 --- a/src/test/java/org/apache/commons/text/StrBuilderTest.java +++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java @@ -834,6 +834,16 @@ void testEqualsIgnoreCase() { assertTrue(sb1.equalsIgnoreCase(sb2)); } + @Test + void testErrorMessageShowsCorrectVariable() { + final StrBuilder sb = new StrBuilder("Hello"); + final char[] chars = { 'a', 'b', 'c' }; + StringIndexOutOfBoundsException ex = assertThrows(StringIndexOutOfBoundsException.class, () -> sb.append(chars, 1, 4)); + assertTrue(ex.getMessage().contains("length: 4")); + ex = assertThrows(StringIndexOutOfBoundsException.class, () -> sb.append(chars, 7, 3)); + assertTrue(ex.getMessage().contains("startIndex: 7")); + } + @Test void testGetChars() { final StrBuilder sb = new StrBuilder(); @@ -2016,22 +2026,4 @@ void testTrim() { sb.clear().append("a b c"); assertEquals("a b c", sb.trim().toString()); } - - @Test - void testErrorMessageShowsCorrectVariable() { - final StrBuilder sb = new StrBuilder("Hello"); - final char[] chars = {'a', 'b', 'c'}; - - StringIndexOutOfBoundsException ex = assertThrows( - StringIndexOutOfBoundsException.class, - () -> sb.append(chars, 1, 4) - ); - assertTrue(ex.getMessage().contains("length: 4")); - - ex = assertThrows( - StringIndexOutOfBoundsException.class, - () -> sb.append(chars, 7, 3) - ); - assertTrue(ex.getMessage().contains("startIndex: 7")); - } } diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java index 1efbf25113..649fc4ea71 100644 --- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java +++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java @@ -989,6 +989,16 @@ void testEqualsIgnoreCase() { // TextStringBuilder("title".toUpperCase(turkish)))); } + @Test + void testErrorMessageShowsCorrectVariable() { + final TextStringBuilder sb = new TextStringBuilder("Hello"); + final char[] chars = { 'a', 'b', 'c' }; + StringIndexOutOfBoundsException ex = assertThrows(StringIndexOutOfBoundsException.class, () -> sb.append(chars, 1, 4)); + assertTrue(ex.getMessage().contains("length: 4")); + ex = assertThrows(StringIndexOutOfBoundsException.class, () -> sb.append(chars, 7, 3)); + assertTrue(ex.getMessage().contains("startIndex: 7")); + } + @Test void testGetChars() { final TextStringBuilder sb = new TextStringBuilder(); @@ -2392,22 +2402,4 @@ void testWrap_CharArray_Int_Exceptions() { assertThrows(IllegalArgumentException.class, () -> TextStringBuilder.wrap("abc".toCharArray(), -1)); assertThrows(IllegalArgumentException.class, () -> TextStringBuilder.wrap(ArrayUtils.EMPTY_CHAR_ARRAY, 1)); } - - @Test - void testErrorMessageShowsCorrectVariable() { - final TextStringBuilder sb = new TextStringBuilder("Hello"); - final char[] chars = {'a', 'b', 'c'}; - - StringIndexOutOfBoundsException ex = assertThrows( - StringIndexOutOfBoundsException.class, - () -> sb.append(chars, 1, 4) - ); - assertTrue(ex.getMessage().contains("length: 4")); - - ex = assertThrows( - StringIndexOutOfBoundsException.class, - () -> sb.append(chars, 7, 3) - ); - assertTrue(ex.getMessage().contains("startIndex: 7")); - } } From 428759d708570efb146d1a8352b79517201c65f0 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 28 Jan 2026 15:45:59 -0500 Subject: [PATCH 47/61] Bump github/codeql-action from 4.31.11 to 4.32.0 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 17321f5dd1..658b44aef9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 + uses: github/codeql-action/init@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 + uses: github/codeql-action/autobuild@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 + uses: github/codeql-action/analyze@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 73762bb58c..4ca0930497 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11 + uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 with: sarif_file: results.sarif From 38f06344985d89648ec15ae4cfddc6b426eb73ae Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 1 Feb 2026 07:52:00 -0500 Subject: [PATCH 48/61] Javadoc --- .../apache/commons/text/ExtendedMessageFormat.java | 9 +++++++-- .../text/similarity/LevenshteinDetailedDistance.java | 12 +++++++++--- .../commons/text/similarity/LevenshteinDistance.java | 4 +++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java index 2baac548f0..4dcd957fe5 100644 --- a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java +++ b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java @@ -33,15 +33,20 @@ /** * Extends {@link java.text.MessageFormat} to allow pluggable/additional formatting - * options for embedded format elements. Client code should specify a registry + * options for embedded format elements. + *

    + * Client code should specify a registry * of {@code FormatFactory} instances associated with {@code String} * format names. This registry will be consulted when the format elements are * parsed from the message pattern. In this way custom patterns can be specified, * and the formats supported by {@link java.text.MessageFormat} can be overridden * at the format and/or format style level (see MessageFormat). A "format element" - * embedded in the message pattern is specified (()? signifies optionality):
    + * embedded in the message pattern is specified (()? signifies optionality): + *

    + *

    * {@code {}argument-number({@code ,}format-name * ({@code ,}format-style)?)?{@code }} + *

    * *

    * format-name and format-style values are trimmed of surrounding whitespace diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java index ac7b4018aa..4b4740ea9a 100644 --- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java +++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java @@ -277,7 +277,9 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si * *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large - * strings.
    + * strings. + *

    + *

    * This implementation of the Levenshtein distance algorithm is from * http://www.merriampark.com/ldjava.htm *

    @@ -420,7 +422,9 @@ public LevenshteinDetailedDistance(final Integer threshold) { * *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large - * strings.
    + * strings. + *

    + *

    * This implementation of the Levenshtein distance algorithm is from * http://www.merriampark.com/ldjava.htm *

    @@ -463,7 +467,9 @@ public LevenshteinResults apply(final CharSequence left, final CharSequence righ * *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large - * strings.
    + * strings. + *

    + *

    * This implementation of the Levenshtein distance algorithm is from * http://www.merriampark.com/ldjava.htm *

    diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java index 8ab60eeec8..d8b9e121ae 100644 --- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java +++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java @@ -326,7 +326,9 @@ public LevenshteinDistance(final Integer threshold) { * *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large - * strings.
    + * strings. + *

    + *

    * This implementation of the Levenshtein distance algorithm is from * http://www.merriampark.com/ldjava.htm *

    From ae57a01a6828fcb7c803fadd4c7ad7747603b7e4 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 6 Feb 2026 12:35:37 +0000 Subject: [PATCH 49/61] Bump github/codeql-action from 4.32.0 to 4.32.2 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 658b44aef9..3fb81ad790 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -57,7 +57,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 + uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +68,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 + uses: github/codeql-action/autobuild@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +82,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 + uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 4ca0930497..7503f5e6b7 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 + uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 with: sarif_file: results.sarif From 272be85f7b3919c639c589cb390456e0f0bcf250 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 6 Feb 2026 09:42:24 -0500 Subject: [PATCH 50/61] Use max-parallel: 20 as asked by Apache Infra --- .github/workflows/codeql-analysis.yml | 1 + .github/workflows/maven.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3fb81ad790..858b59d146 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,6 +37,7 @@ jobs: security-events: write strategy: + max-parallel: 20 fail-fast: false matrix: language: [ 'java' ] diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5a77f4db9d..ca5362ba4e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,6 +26,7 @@ jobs: runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} strategy: + max-parallel: 20 matrix: java: [ 8, 11, 17, 21, 25 ] experimental: [false] From 8a89e0dd6cdae74a92a1622bfbcd52097a738be7 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 9 Feb 2026 13:12:21 +0000 Subject: [PATCH 51/61] Bump actions/cache from 5.0.2 to 5.0.3 --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 858b59d146..9ccfb03278 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 #v5.0.3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From 267ec52890ae636cb758f3a032751ac6bdc8084a Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 20 Feb 2026 07:42:44 -0500 Subject: [PATCH 52/61] Bump github/codeql-action from 4.32.2 to 4.32.3 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9ccfb03278..b1f4f562df 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 + uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -69,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 + uses: github/codeql-action/autobuild@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -83,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 + uses: github/codeql-action/analyze@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 7503f5e6b7..5bed385874 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 + uses: github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 with: sarif_file: results.sarif From 21a016cec7ff2ea8a54a3af06d844ed152c6e5f2 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 23 Feb 2026 10:59:18 -0500 Subject: [PATCH 53/61] Bump github/codeql-action from 4.32.0 to 4.32.4 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b1f4f562df..6c4aa3f571 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 + uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -69,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 + uses: github/codeql-action/autobuild@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -83,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 + uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 5bed385874..edcfc60f64 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3 + uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 with: sarif_file: results.sarif From 3b3d5d140c254096e0c57b315e02ef29c83793de Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 28 Feb 2026 07:54:37 -0500 Subject: [PATCH 54/61] Bump org.apache.commons:commons-parent from 96 to 97. --- pom.xml | 2 +- src/changes/changes.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f2049d7fde..9f9b598f9a 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ org.apache.commons commons-parent - 96 + 97 commons-text 1.15.1-SNAPSHOT diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 4bfbe4f854..55725d0208 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -49,7 +49,7 @@ The type attribute can be add,update,fix,remove. TextStringBuilder.append(char[], int, int) uses wrong variable in exception message #735. - Bump org.apache.commons:commons-parent from 93 to 96. + Bump org.apache.commons:commons-parent from 93 to 97. Bump the level of test coverage checks. Bump commons.bytebuddy.version from 1.18.2 to 1.18.4 #734. From 9a82768be95a3d39a547db1f77964e438b1d31b5 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 2 Mar 2026 08:34:41 -0500 Subject: [PATCH 55/61] Bump github/codeql-action from 4.32.4 to 4.32.5 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6c4aa3f571..e2ee451b4e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 + uses: github/codeql-action/init@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -69,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 + uses: github/codeql-action/autobuild@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -83,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 + uses: github/codeql-action/analyze@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index edcfc60f64..326bbf4a43 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4 + uses: github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 with: sarif_file: results.sarif From f2929c201314e005a625fadfd887d595a092c9a9 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 6 Mar 2026 07:36:39 -0500 Subject: [PATCH 56/61] Bump github/codeql-action from 4.32.5 to 4.32.6 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e2ee451b4e..4c52d9d27d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 + uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -69,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 + uses: github/codeql-action/autobuild@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -83,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 + uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 326bbf4a43..81fbc1b5e8 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5 + uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 with: sarif_file: results.sarif From 5cad5482def411bf07814ddc6e58949149e69e5f Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 9 Mar 2026 08:44:19 -0400 Subject: [PATCH 57/61] Bump actions/upload-artifact from 6.0.0 to 7.0.0 --- .github/workflows/scorecards-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 81fbc1b5e8..a35bf86eeb 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -57,7 +57,7 @@ jobs: publish_results: true - name: "Upload artifact" - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: SARIF file path: results.sarif From a55f00858246e19a4dfd3fb0ddba0700b04dc978 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 11 Mar 2026 21:52:45 -0400 Subject: [PATCH 58/61] Remove link to now malicious site --- .../LevenshteinDetailedDistance.java | 29 +------------------ .../text/similarity/LevenshteinDistance.java | 17 +---------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java index 4b4740ea9a..8ea040098d 100644 --- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java +++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java @@ -132,7 +132,7 @@ public static LevenshteinDetailedDistance getDefaultInstance() { * *

    * This implementation follows from Algorithms on Strings, Trees and Sequences by Dan Gusfield and Chas Emerick's implementation of the Levenshtein distance - * algorithm from http://www.merriampark.com/ld.htm + * algorithm. *

    * *
    @@ -271,18 +271,9 @@ private static  LevenshteinResults limitedCompare(SimilarityInput left, Si
          * 

    * *

    - * The previous implementation of the Levenshtein distance algorithm was from - * http://www.merriampark.com/ld.htm - *

    - * - *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large * strings. *

    - *

    - * This implementation of the Levenshtein distance algorithm is from - * http://www.merriampark.com/ldjava.htm - *

    * *
          * unlimitedCompare(null, *)             = Throws {@link IllegalArgumentException}
    @@ -416,18 +407,9 @@ public LevenshteinDetailedDistance(final Integer threshold) {
          * 

    * *

    - * The previous implementation of the Levenshtein distance algorithm was from - * http://www.merriampark.com/ld.htm - *

    - * - *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large * strings. *

    - *

    - * This implementation of the Levenshtein distance algorithm is from - * http://www.merriampark.com/ldjava.htm - *

    * *
          * distance.apply(null, *)             = Throws {@link IllegalArgumentException}
    @@ -461,18 +443,9 @@ public LevenshteinResults apply(final CharSequence left, final CharSequence righ
          * 

    * *

    - * The previous implementation of the Levenshtein distance algorithm was from - * http://www.merriampark.com/ld.htm - *

    - * - *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large * strings. *

    - *

    - * This implementation of the Levenshtein distance algorithm is from - * http://www.merriampark.com/ldjava.htm - *

    * *
          * distance.apply(null, *)             = Throws {@link IllegalArgumentException}
    diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
    index d8b9e121ae..479b3fadea 100644
    --- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
    +++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
    @@ -55,7 +55,7 @@ public static LevenshteinDistance getDefaultInstance() {
          *
          * 

    * This implementation follows from Algorithms on Strings, Trees and Sequences by Dan Gusfield and Chas Emerick's implementation of the Levenshtein distance - * algorithm from http://www.merriampark.com/ld.htm + * algorithm. *

    * *
    @@ -204,12 +204,6 @@ private static  int limitedCompare(SimilarityInput left, SimilarityInput

    * *

    - * The previous implementation of the Levenshtein distance algorithm was from - * - * https://web.archive.org/web/20120526085419/http://www.merriampark.com/ldjava.htm - *

    - * - *

    * This implementation only need one single-dimensional arrays of length s.length() + 1 *

    * @@ -320,18 +314,9 @@ public LevenshteinDistance(final Integer threshold) { *

    * *

    - * The previous implementation of the Levenshtein distance algorithm was from - * http://www.merriampark.com/ld.htm - *

    - * - *

    * Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large * strings. *

    - *

    - * This implementation of the Levenshtein distance algorithm is from - * http://www.merriampark.com/ldjava.htm - *

    * *
          * distance.apply(null, *)             = Throws {@link IllegalArgumentException}
    
    From 7b76a31ba0ff432df88b7c2b1f9a52401d45120c Mon Sep 17 00:00:00 2001
    From: Gary Gregory 
    Date: Fri, 13 Mar 2026 09:08:53 -0400
    Subject: [PATCH 59/61] Bump commons.bytebuddy.version from 1.18.4 to 1.18.7.
    
    ---
     pom.xml                 | 2 +-
     src/changes/changes.xml | 1 +
     2 files changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/pom.xml b/pom.xml
    index 9f9b598f9a..bc8e9a9200 100644
    --- a/pom.xml
    +++ b/pom.xml
    @@ -48,7 +48,7 @@
         https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-text
         site-content
         3.20.0
    -    1.18.4
    +    1.18.7
         1.6
         false
         1.37
    diff --git a/src/changes/changes.xml b/src/changes/changes.xml
    index 55725d0208..a3ae6cc2bc 100644
    --- a/src/changes/changes.xml
    +++ b/src/changes/changes.xml
    @@ -52,6 +52,7 @@ The  type attribute can be add,update,fix,remove.
           Bump org.apache.commons:commons-parent from 93 to 97.
           Bump the level of test coverage checks.
           Bump commons.bytebuddy.version from 1.18.2 to 1.18.4 #734.
    +      Bump commons.bytebuddy.version from 1.18.4 to 1.18.7.
         
         
           
    
    From 6e2b964ae83f0bf020b6236cb97fb85795ddfc4b Mon Sep 17 00:00:00 2001
    From: Gary Gregory 
    Date: Thu, 19 Mar 2026 23:46:54 +0000
    Subject: [PATCH 60/61] Add a reference to safe deserlialization
    
    ---
     src/site/xdoc/security.xml | 7 ++++++-
     1 file changed, 6 insertions(+), 1 deletion(-)
    
    diff --git a/src/site/xdoc/security.xml b/src/site/xdoc/security.xml
    index b211fd77bd..150584ad35 100644
    --- a/src/site/xdoc/security.xml
    +++ b/src/site/xdoc/security.xml
    @@ -114,5 +114,10 @@
                     

    - +
    +

    + For information about safe deserialization, please see Safe Deserialization. +

    +
    + From 040a75798ce48ce000ecc9af4e7e3a49690aff48 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 20 Mar 2026 17:33:07 -0700 Subject: [PATCH 61/61] Bump github/codeql-action from 4.32.6 to 4.34.0 --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/scorecards-analysis.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4c52d9d27d..e072e3dd79 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 + uses: github/codeql-action/init@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -69,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 + uses: github/codeql-action/autobuild@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -83,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 + uses: github/codeql-action/analyze@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index a35bf86eeb..7182c34001 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -64,6 +64,6 @@ jobs: retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6 + uses: github/codeql-action/upload-sarif@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4.34.0 with: sarif_file: results.sarif