*
From 73c17bcde26486817083e137221b43026a80d6a3 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 07:49:33 -0400
Subject: [PATCH 025/265] Reduce vertical whitespace
---
.../commons/text/RandomStringGenerator.java | 228 ++++++++----------
1 file changed, 94 insertions(+), 134 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index 7d1de6a234..3ec2788701 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -29,15 +29,12 @@
import org.apache.commons.lang3.Validate;
/**
- * Generates random Unicode strings containing the specified number of code points.
- * Instances are created using a builder class, which allows the
- * callers to define the properties of the generator. See the documentation for the
- * {@link Builder} class to see available properties.
+ * Generates random Unicode strings containing the specified number of code points. Instances are created using a builder class, which allows the callers to
+ * define the properties of the generator. See the documentation for the {@link Builder} class to see available properties.
*
*
* // Generates a 20 code point string, using only the letters a-z
- * RandomStringGenerator generator = RandomStringGenerator.builder()
- * .withinRange('a', 'z').build();
+ * RandomStringGenerator generator = RandomStringGenerator.builder().withinRange('a', 'z').build();
* String randomLetters = generator.generate(20);
*
*
@@ -46,16 +43,15 @@
* // Generates a 20 code point string, using only the letters a-z
* RandomStringGenerator generator = RandomStringGenerator.builder()
* .withinRange('a', 'z')
- * .usingRandom(rng::nextInt) // uses Java 8 syntax
+ * .usingRandom(rng::nextInt)
* .build();
* String randomLetters = generator.generate(20);
*
*
- * {@code RandomStringGenerator} instances are thread-safe when using the
- * default random number generator (RNG). If a custom RNG is set by calling the method
- * {@link Builder#usingRandom(TextRandomProvider) Builder.usingRandom(TextRandomProvider)}, thread-safety
- * must be ensured externally.
+ * {@code RandomStringGenerator} instances are thread-safe when using the default random number generator (RNG). If a custom RNG is set by calling the method
+ * {@link Builder#usingRandom(TextRandomProvider) Builder.usingRandom(TextRandomProvider)}, thread-safety must be ensured externally.
*
+ *
* @since 1.1
*/
public final class RandomStringGenerator {
@@ -63,24 +59,29 @@ public final class RandomStringGenerator {
/**
* A builder for generating {@code RandomStringGenerator} instances.
*
- *
The behavior of a generator is controlled by properties set by this
- * builder. Each property has a default value, which can be overridden by
- * calling the methods defined in this class, prior to calling {@link #build()}.
- *
- *
All the property setting methods return the {@code Builder} instance to allow for method chaining.
- *
- *
The minimum and maximum code point values are defined using {@link #withinRange(int, int)}. The
- * default values are {@code 0} and {@link Character#MAX_CODE_POINT} respectively.
- *
- *
The source of randomness can be set using {@link #usingRandom(TextRandomProvider)},
- * otherwise {@link ThreadLocalRandom} is used.
- *
- *
The type of code points returned can be filtered using {@link #filteredBy(CharacterPredicate...)},
- * which defines a collection of tests that are applied to the randomly generated code points.
- * The code points will only be included in the result if they pass at least one of the tests.
- * Some commonly used predicates are provided by the {@link CharacterPredicates} enum.
+ *
+ * The behavior of a generator is controlled by properties set by this builder. Each property has a default value, which can be overridden by calling the
+ * methods defined in this class, prior to calling {@link #build()}.
+ *
+ *
+ * All the property setting methods return the {@code Builder} instance to allow for method chaining.
+ *
+ *
+ * The minimum and maximum code point values are defined using {@link #withinRange(int, int)}. The default values are {@code 0} and
+ * {@link Character#MAX_CODE_POINT} respectively.
+ *
+ *
+ * The source of randomness can be set using {@link #usingRandom(TextRandomProvider)}, otherwise {@link ThreadLocalRandom} is used.
+ *
+ *
+ * The type of code points returned can be filtered using {@link #filteredBy(CharacterPredicate...)}, which defines a collection of tests that are applied
+ * to the randomly generated code points. The code points will only be included in the result if they pass at least one of the tests. Some commonly used
+ * predicates are provided by the {@link CharacterPredicates} enum.
+ *
+ *
+ * This class is not thread safe.
+ *
*
- *
This class is not thread safe.
* @since 1.1
*/
public static class Builder implements org.apache.commons.text.Builder {
@@ -146,18 +147,15 @@ public RandomStringGenerator build() {
}
/**
- * Limits the characters in the generated string to those that match at
- * least one of the predicates supplied.
+ * Limits the characters in the generated string to those that match at least one of the predicates supplied.
*
*
- * Passing {@code null} or an empty array to this method will revert to the
- * default behavior of allowing any character. Multiple calls to this
- * method will replace the previously stored predicates.
+ * Passing {@code null} or an empty array to this method will revert to the default behavior of allowing any character. Multiple calls to this method
+ * will replace the previously stored predicates.
*
*
- * @param predicates
- * the predicates, may be {@code null} or empty
- * @return {@code this}, to allow method chaining
+ * @param predicates the predicates, may be {@code null} or empty.
+ * @return {@code this}, to allow method chaining.
*/
public Builder filteredBy(final CharacterPredicate... predicates) {
if (ArrayUtils.isEmpty(predicates)) {
@@ -176,7 +174,7 @@ public Builder filteredBy(final CharacterPredicate... predicates) {
/**
* Builds a new {@code RandomStringGenerator}.
*
- * @return A new {@code RandomStringGenerator}
+ * @return A new {@code RandomStringGenerator}.
* @since 1.12.0
*/
@Override
@@ -185,18 +183,15 @@ public RandomStringGenerator get() {
}
/**
- * Limits the characters in the generated string to those who match at
- * supplied list of Character.
+ * Limits the characters in the generated string to those who match at supplied list of Character.
*
*
- * Passing {@code null} or an empty array to this method will revert to the
- * default behavior of allowing any character. Multiple calls to this
- * method will replace the previously stored Character.
+ * Passing {@code null} or an empty array to this method will revert to the default behavior of allowing any character. Multiple calls to this method
+ * will replace the previously stored Character.
*
*
- * @param chars set of predefined Characters for random string generation
- * the Character can be, may be {@code null} or empty
- * @return {@code this}, to allow method chaining
+ * @param chars set of predefined Characters for random string generation the Character can be, may be {@code null} or empty
+ * @return {@code this}, to allow method chaining.
* @since 1.2
*/
public Builder selectFrom(final char... chars) {
@@ -210,15 +205,13 @@ public Builder selectFrom(final char... chars) {
}
/**
- * Overrides the default source of randomness. It is highly
- * recommended that a random number generator library like
- * Apache Commons RNG
- * be used to provide the random number generation.
+ * Overrides the default source of randomness. It is highly recommended that a random number generator library like
+ * Apache Commons RNG be used to provide the random number generation.
*
*
- * {@link TextRandomProvider} is a
- * functional interface and need not be explicitly implemented:
+ * {@link TextRandomProvider} is a functional interface and need not be explicitly implemented:
*
- * Passing {@code null} to this method will revert to the default source of
- * randomness.
+ * Passing {@code null} to this method will revert to the default source of randomness.
*
*
- * @param random
- * the source of randomness, may be {@code null}
- * @return {@code this}, to allow method chaining
+ * @param random the source of randomness, may be {@code null}.
+ * @return {@code this}, to allow method chaining.
* @since 1.14.0
*/
public Builder usingRandom(final IntUnaryOperator random) {
@@ -245,15 +236,13 @@ public Builder usingRandom(final IntUnaryOperator random) {
}
/**
- * Overrides the default source of randomness. It is highly
- * recommended that a random number generator library like
- * Apache Commons RNG
- * be used to provide the random number generation.
+ * Overrides the default source of randomness. It is highly recommended that a random number generator library like
+ * Apache Commons RNG be used to provide the random number generation.
*
*
- * {@link TextRandomProvider} is a
- * functional interface and need not be explicitly implemented:
+ * {@link TextRandomProvider} is a functional interface and need not be explicitly implemented:
*
- * Passing {@code null} to this method will revert to the default source of
- * randomness.
+ * Passing {@code null} to this method will revert to the default source of randomness.
*
*
- * @param random
- * the source of randomness, may be {@code null}
- * @return {@code this}, to allow method chaining
+ * @param random the source of randomness, may be {@code null}.
+ * @return {@code this}, to allow method chaining.
*/
public Builder usingRandom(final TextRandomProvider random) {
this.random = random;
@@ -279,15 +266,16 @@ public Builder usingRandom(final TextRandomProvider random) {
}
/**
- * Sets the array of minimum and maximum char allowed in the
- * generated string.
+ * Sets the array of minimum and maximum char allowed in the generated string.
*
* For example:
+ *
*
*
@@ -303,39 +291,29 @@ public Builder withinRange(final char[]... pairs) {
final int maximumCodePoint = pair[1];
Validate.isTrue(minimumCodePoint <= maximumCodePoint, "Minimum code point %d is larger than maximum code point %d", minimumCodePoint,
maximumCodePoint);
-
for (int index = minimumCodePoint; index <= maximumCodePoint; index++) {
characterList.add((char) index);
}
}
}
return this;
-
}
/**
- * Sets the minimum and maximum code points allowed in the
- * generated string.
+ * Sets the minimum and maximum code points allowed in the generated string.
*
- * @param minimumCodePoint
- * the smallest code point allowed (inclusive)
- * @param maximumCodePoint
- * the largest code point allowed (inclusive)
- * @return {@code this}, to allow method chaining
- * @throws IllegalArgumentException
- * if {@code maximumCodePoint >}
- * {@link Character#MAX_CODE_POINT}
- * @throws IllegalArgumentException
- * if {@code minimumCodePoint < 0}
- * @throws IllegalArgumentException
- * if {@code minimumCodePoint > maximumCodePoint}
+ * @param minimumCodePoint the smallest code point allowed (inclusive).
+ * @param maximumCodePoint the largest code point allowed (inclusive).
+ * @return {@code this}, to allow method chaining.
+ * @throws IllegalArgumentException if {@code maximumCodePoint >} {@link Character#MAX_CODE_POINT}.
+ * @throws IllegalArgumentException if {@code minimumCodePoint < 0}.
+ * @throws IllegalArgumentException if {@code minimumCodePoint > maximumCodePoint}.
*/
public Builder withinRange(final int minimumCodePoint, final int maximumCodePoint) {
- Validate.isTrue(minimumCodePoint <= maximumCodePoint,
- "Minimum code point %d is larger than maximum code point %d", minimumCodePoint, maximumCodePoint);
+ Validate.isTrue(minimumCodePoint <= maximumCodePoint, "Minimum code point %d is larger than maximum code point %d", minimumCodePoint,
+ maximumCodePoint);
Validate.isTrue(minimumCodePoint >= 0, "Minimum code point %d is negative", minimumCodePoint);
- Validate.isTrue(maximumCodePoint <= Character.MAX_CODE_POINT,
- "Value %d is larger than Character.MAX_CODE_POINT.", maximumCodePoint);
+ Validate.isTrue(maximumCodePoint <= Character.MAX_CODE_POINT, "Value %d is larger than Character.MAX_CODE_POINT.", maximumCodePoint);
this.minimumCodePoint = minimumCodePoint;
this.maximumCodePoint = maximumCodePoint;
return this;
@@ -344,6 +322,7 @@ public Builder withinRange(final int minimumCodePoint, final int maximumCodePoin
/**
* Constructs a new builder.
+ *
* @return a new builder.
* @since 1.11.0
*/
@@ -379,15 +358,11 @@ public static Builder builder() {
/**
* Constructs the generator.
*
- * @param minimumCodePoint
- * smallest allowed code point (inclusive)
- * @param maximumCodePoint
- * largest allowed code point (inclusive)
- * @param inclusivePredicates
- * filters for code points
- * @param random
- * source of randomness
- * @param characterList list of predefined set of characters.
+ * @param minimumCodePoint smallest allowed code point (inclusive).
+ * @param maximumCodePoint largest allowed code point (inclusive).
+ * @param inclusivePredicates filters for code points.
+ * @param random source of randomness.
+ * @param characterList list of predefined set of characters.
*/
private RandomStringGenerator(final Builder builder) {
this.minimumCodePoint = builder.minimumCodePoint;
@@ -401,24 +376,17 @@ private RandomStringGenerator(final Builder builder) {
* Generates a random string, containing the specified number of code points.
*
*
- * Code points are randomly selected between the minimum and maximum values defined
- * in the generator.
- * Surrogate and private use characters are not returned, although the
- * resulting string may contain pairs of surrogates that together encode a
- * supplementary character.
+ * Code points are randomly selected between the minimum and maximum values defined in the generator. Surrogate and private use characters are not returned,
+ * although the resulting string may contain pairs of surrogates that together encode a supplementary character.
*
*
- * Note: the number of {@code char} code units generated will exceed
- * {@code length} if the string contains supplementary characters. See the
- * {@link Character} documentation to understand how Java stores Unicode
- * values.
+ * Note: the number of {@code char} code units generated will exceed {@code length} if the string contains supplementary characters. See the
+ * {@link Character} documentation to understand how Java stores Unicode values.
*
*
- * @param length
- * the number of code points to generate
- * @return The generated string
- * @throws IllegalArgumentException
- * if {@code length < 0}
+ * @param length the number of code points to generate.
+ * @return The generated string.
+ * @throws IllegalArgumentException if {@code length < 0}.
*/
public String generate(final int length) {
if (length == 0) {
@@ -460,34 +428,27 @@ public String generate(final int length) {
}
/**
- * Generates a random string, containing between the minimum (inclusive) and the maximum (inclusive)
- * number of code points.
+ * Generates a random string, containing between the minimum (inclusive) and the maximum (inclusive) number of code points.
*
- * @param minLengthInclusive
- * the minimum (inclusive) number of code points to generate
- * @param maxLengthInclusive
- * the maximum (inclusive) number of code points to generate
- * @return The generated string
- * @throws IllegalArgumentException
- * if {@code minLengthInclusive < 0}, or {@code maxLengthInclusive < minLengthInclusive}
+ * @param minLengthInclusive the minimum (inclusive) number of code points to generate.
+ * @param maxLengthInclusive the maximum (inclusive) number of code points to generate.
+ * @return The generated string.
+ * @throws IllegalArgumentException if {@code minLengthInclusive < 0}, or {@code maxLengthInclusive < minLengthInclusive}.
* @see RandomStringGenerator#generate(int)
* @since 1.2
*/
public String generate(final int minLengthInclusive, final int maxLengthInclusive) {
Validate.isTrue(minLengthInclusive >= 0, "Minimum length %d is smaller than zero.", minLengthInclusive);
- Validate.isTrue(minLengthInclusive <= maxLengthInclusive,
- "Maximum length %d is smaller than minimum length %d.", maxLengthInclusive, minLengthInclusive);
+ Validate.isTrue(minLengthInclusive <= maxLengthInclusive, "Maximum length %d is smaller than minimum length %d.", maxLengthInclusive,
+ minLengthInclusive);
return generate(generateRandomNumber(minLengthInclusive, maxLengthInclusive));
}
/**
- * Generates a random number within a range, using a {@link ThreadLocalRandom} instance
- * or the user-supplied source of randomness.
+ * Generates a random number within a range, using a {@link ThreadLocalRandom} instance or the user-supplied source of randomness.
*
- * @param minInclusive
- * the minimum value allowed
- * @param maxInclusive
- * the maximum value allowed
+ * @param minInclusive the minimum value allowed.
+ * @param maxInclusive the maximum value allowed.
* @return The random number.
*/
private int generateRandomNumber(final int minInclusive, final int maxInclusive) {
@@ -498,8 +459,7 @@ private int generateRandomNumber(final int minInclusive, final int maxInclusive)
}
/**
- * Generates a random number within a range, using a {@link ThreadLocalRandom} instance
- * or the user-supplied source of randomness.
+ * Generates a random number within a range, using a {@link ThreadLocalRandom} instance or the user-supplied source of randomness.
*
* @param characterList predefined char list.
* @return The random number.
From 91e7eac4b51c3dc08262285a83e6d4831f8d2410 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 08:41:32 -0400
Subject: [PATCH 026/265] Add
org.apache.commons.text.RandomStringGenerator.Builder.setAccumulate(boolean)
This is instead of breaking compatibility with
https://github.com/apache/commons-text/pull/125
---
src/changes/changes.xml | 1 +
.../commons/text/RandomStringGenerator.java | 63 ++++++++++++++-----
.../text/RandomStringGeneratorTest.java | 54 ++++++++++++++--
3 files changed, 100 insertions(+), 18 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 272f878ddf..302829a057 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -61,6 +61,7 @@ The type attribute can be add,update,fix,remove.
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.
diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index 3ec2788701..f39212b7e9 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -125,7 +125,12 @@ public static class Builder implements org.apache.commons.text.Builder characterList;
+ private Set characterSet = new HashSet<>();
+
+ /**
+ * Whether calls accumulates the source of provided characters. The default is {@code false}.
+ */
+ private boolean accumulate;
/**
* Creates a new instance.
@@ -155,7 +160,7 @@ public RandomStringGenerator build() {
*
*
* @param predicates the predicates, may be {@code null} or empty.
- * @return {@code this}, to allow method chaining.
+ * @return {@code this} instance.
*/
public Builder filteredBy(final CharacterPredicate... predicates) {
if (ArrayUtils.isEmpty(predicates)) {
@@ -182,6 +187,12 @@ public RandomStringGenerator get() {
return new RandomStringGenerator(this);
}
+ private void initCharList() {
+ if (!accumulate) {
+ characterSet = new HashSet<>();
+ }
+ }
+
/**
* Limits the characters in the generated string to those who match at supplied list of Character.
*
@@ -191,19 +202,43 @@ public RandomStringGenerator get() {
*
*
* @param chars set of predefined Characters for random string generation the Character can be, may be {@code null} or empty
- * @return {@code this}, to allow method chaining.
+ * @return {@code this} instance.
* @since 1.2
*/
public Builder selectFrom(final char... chars) {
- characterList = new ArrayList<>();
+ initCharList();
if (chars != null) {
for (final char c : chars) {
- characterList.add(c);
+ characterSet.add(c);
}
}
return this;
}
+ /**
+ * Sets whether calls accumulates the source of provided characters. The default is {@code false}.
+ *
+ *
+ *
+ * @param accumulate whether calls accumulates the source of provided characters. The default is {@code false}.
+ * @return {@code this} instance.
+ * @since 1.14.0
+ */
+ public Builder setAccumulate(final boolean accumulate) {
+ this.accumulate = accumulate;
+ return this;
+ }
+
/**
* Overrides the default source of randomness. It is highly recommended that a random number generator library like
* Apache Commons RNG be used to provide the random number generation.
@@ -227,7 +262,7 @@ public Builder selectFrom(final char... chars) {
*
*
* @param random the source of randomness, may be {@code null}.
- * @return {@code this}, to allow method chaining.
+ * @return {@code this} instance.
* @since 1.14.0
*/
public Builder usingRandom(final IntUnaryOperator random) {
@@ -258,7 +293,7 @@ public Builder usingRandom(final IntUnaryOperator random) {
*
*
* @param random the source of randomness, may be {@code null}.
- * @return {@code this}, to allow method chaining.
+ * @return {@code this} instance.
*/
public Builder usingRandom(final TextRandomProvider random) {
this.random = random;
@@ -272,7 +307,6 @@ public Builder usingRandom(final TextRandomProvider random) {
*
*
*
* @param pairs array of characters array, expected is to pass min, max pairs through this arg.
- * @return {@code this}, to allow method chaining.
+ * @return {@code this} instance.
*/
public Builder withinRange(final char[]... pairs) {
- characterList = new ArrayList<>();
+ initCharList();
if (pairs != null) {
for (final char[] pair : pairs) {
Validate.isTrue(pair.length == 2, "Each pair must contain minimum and maximum code point");
@@ -292,19 +326,20 @@ public Builder withinRange(final char[]... pairs) {
Validate.isTrue(minimumCodePoint <= maximumCodePoint, "Minimum code point %d is larger than maximum code point %d", minimumCodePoint,
maximumCodePoint);
for (int index = minimumCodePoint; index <= maximumCodePoint; index++) {
- characterList.add((char) index);
+ characterSet.add((char) index);
}
}
}
return this;
}
+
/**
* Sets the minimum and maximum code points allowed in the generated string.
*
* @param minimumCodePoint the smallest code point allowed (inclusive).
* @param maximumCodePoint the largest code point allowed (inclusive).
- * @return {@code this}, to allow method chaining.
+ * @return {@code this} instance.
* @throws IllegalArgumentException if {@code maximumCodePoint >} {@link Character#MAX_CODE_POINT}.
* @throws IllegalArgumentException if {@code minimumCodePoint < 0}.
* @throws IllegalArgumentException if {@code minimumCodePoint > maximumCodePoint}.
@@ -362,14 +397,14 @@ public static Builder builder() {
* @param maximumCodePoint largest allowed code point (inclusive).
* @param inclusivePredicates filters for code points.
* @param random source of randomness.
- * @param characterList list of predefined set of characters.
+ * @param characterSet list of predefined set of characters.
*/
private RandomStringGenerator(final Builder builder) {
this.minimumCodePoint = builder.minimumCodePoint;
this.maximumCodePoint = builder.maximumCodePoint;
this.inclusivePredicates = builder.inclusivePredicates;
this.random = builder.random;
- this.characterList = builder.characterList;
+ this.characterList = new ArrayList<>(builder.characterSet);
}
/**
diff --git a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
index 9daea44b56..2352755789 100644
--- a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
+++ b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
@@ -23,13 +23,17 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
+import java.util.Arrays;
import java.util.function.IntUnaryOperator;
+import org.apache.commons.lang3.ArraySorter;
import org.apache.commons.text.RandomStringGenerator.Builder;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
/**
- * Tests for {@link RandomStringGenerator}
+ * Tests for {@link RandomStringGenerator}.
*/
class RandomStringGeneratorTest {
@@ -159,6 +163,25 @@ void testNoPrivateCharacters() {
} while (i < str.length());
}
+ @Test
+ void testPasswordExample() {
+ final char[] punctuation = ArraySorter
+ .sort(new char[] { '!', '"', '#', '$', '&', '\'', '(', ')', ',', '.', ':', ';', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~' });
+ // @formatter:off
+ final RandomStringGenerator generator = RandomStringGenerator.builder()
+ .setAccumulate(true)
+ .withinRange('a', 'z')
+ .withinRange('A', 'Z')
+ .withinRange('0', '9')
+ .selectFrom(punctuation)
+ .get();
+ // @formatter:on
+ final String randomText = generator.generate(10);
+ for (final char c : randomText.toCharArray()) {
+ assertTrue(Character.isLetter(c) || Character.isDigit(c) || Arrays.binarySearch(punctuation, c) >= 0);
+ }
+ }
+
@Test
void testRemoveFilters() {
final RandomStringGenerator.Builder builder = RandomStringGenerator.builder().withinRange('a', 'z').filteredBy(A_FILTER);
@@ -194,17 +217,19 @@ void testSelectFromCharVarargs() {
}
}
- @Test
- void testSelectFromCharVarargs2() {
+ @ParameterizedTest
+ @ValueSource(booleans = {false, true})
+ void testSelectFromCharVarargs2(final boolean accumulate) {
final String str = "abcde";
// @formatter:off
final RandomStringGenerator generator = RandomStringGenerator.builder()
+ .setAccumulate(accumulate)
.selectFrom()
.selectFrom(null)
.selectFrom('a', 'b')
.selectFrom('a', 'b', 'c')
.selectFrom('a', 'b', 'c', 'd')
- .selectFrom('a', 'b', 'c', 'd', 'e') // only this last call matters
+ .selectFrom('a', 'b', 'c', 'd', 'e') // only this last call matters when accumulate is false
.build();
// @formatter:on
final String randomText = generator.generate(10);
@@ -213,6 +238,27 @@ void testSelectFromCharVarargs2() {
}
}
+ @ParameterizedTest
+ @ValueSource(booleans = {false, true})
+ void testSelectFromCharVarargs3(final boolean accumulate) {
+ final String str = "abcde";
+ // @formatter:off
+ final RandomStringGenerator generator = RandomStringGenerator.builder()
+ .setAccumulate(accumulate)
+ .selectFrom('a', 'b', 'c', 'd', 'e')
+ .selectFrom('a', 'b', 'c', 'd')
+ .selectFrom('a', 'b', 'c')
+ .selectFrom('a', 'b')
+ .selectFrom(null)
+ .selectFrom()
+ .get();
+ // @formatter:on
+ final String randomText = generator.generate(10);
+ for (final char c : randomText.toCharArray()) {
+ assertEquals(accumulate, str.indexOf(c) != -1);
+ }
+ }
+
@Test
void testSelectFromCharVarargSize1() {
final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom('a').build();
From 49e02a5fae579a3c83c9bd8ecd1a37cc59d5fdc9 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 08:42:27 -0400
Subject: [PATCH 027/265] Use deprecated methods in specific method
---
.../text/RandomStringGeneratorTest.java | 57 +++++++++++--------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
index 2352755789..0a79af6a49 100644
--- a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
+++ b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
@@ -60,7 +60,7 @@ void testBadMinimumCodePoint() {
}
@Test
- void testChangeOfFilter() {
+ void testBuildDeprecated() {
final RandomStringGenerator.Builder builder = RandomStringGenerator.builder().withinRange('a', 'z').filteredBy(A_FILTER);
final String str = builder.filteredBy(B_FILTER).build().generate(100);
for (final char c : str.toCharArray()) {
@@ -68,11 +68,20 @@ void testChangeOfFilter() {
}
}
+ @Test
+ void testChangeOfFilter() {
+ final RandomStringGenerator.Builder builder = RandomStringGenerator.builder().withinRange('a', 'z').filteredBy(A_FILTER);
+ final String str = builder.filteredBy(B_FILTER).get().generate(100);
+ for (final char c : str.toCharArray()) {
+ assertEquals('b', c);
+ }
+ }
+
@Test
void testGenerateMinMaxLength() {
final int minLength = 0;
final int maxLength = 3;
- final RandomStringGenerator generator = RandomStringGenerator.builder().build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().get();
final String str = generator.generate(minLength, maxLength);
final int codePointLength = codePointLength(str);
assertTrue(codePointLength >= minLength && codePointLength <= maxLength);
@@ -81,7 +90,7 @@ void testGenerateMinMaxLength() {
@Test
void testGenerateMinMaxLengthInvalidLength() {
assertThrowsExactly(IllegalArgumentException.class, () -> {
- final RandomStringGenerator generator = RandomStringGenerator.builder().build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().get();
generator.generate(-1, 0);
});
}
@@ -89,7 +98,7 @@ void testGenerateMinMaxLengthInvalidLength() {
@Test
void testGenerateMinMaxLengthMinGreaterThanMax() {
assertThrowsExactly(IllegalArgumentException.class, () -> {
- final RandomStringGenerator generator = RandomStringGenerator.builder().build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().get();
generator.generate(1, 0);
});
}
@@ -100,19 +109,19 @@ void testGenerateTakingIntThrowsNullPointerException() {
final RandomStringGenerator.Builder randomStringGeneratorBuilder = RandomStringGenerator.builder();
final CharacterPredicate[] characterPredicateArray = new CharacterPredicate[2];
randomStringGeneratorBuilder.filteredBy(characterPredicateArray);
- final RandomStringGenerator randomStringGenerator = randomStringGeneratorBuilder.build();
+ final RandomStringGenerator randomStringGenerator = randomStringGeneratorBuilder.get();
randomStringGenerator.generate(18);
});
}
@Test
void testInvalidLength() {
- assertThrowsExactly(IllegalArgumentException.class, () -> RandomStringGenerator.builder().build().generate(-1));
+ assertThrowsExactly(IllegalArgumentException.class, () -> RandomStringGenerator.builder().get().generate(-1));
}
@Test
void testMultipleFilters() {
- final String str = RandomStringGenerator.builder().withinRange('a', 'd').filteredBy(A_FILTER, B_FILTER).build().generate(5000);
+ final String str = RandomStringGenerator.builder().withinRange('a', 'd').filteredBy(A_FILTER, B_FILTER).get().generate(5000);
boolean aFound = false;
boolean bFound = false;
for (final char c : str.toCharArray()) {
@@ -130,7 +139,7 @@ void testMultipleFilters() {
@Test
void testNoLoneSurrogates() {
final int length = 5000;
- final String str = RandomStringGenerator.builder().build().generate(length);
+ final String str = RandomStringGenerator.builder().get().generate(length);
char lastChar = str.charAt(0);
for (int i = 1; i < str.length(); i++) {
final char c = str.charAt(i);
@@ -153,7 +162,7 @@ void testNoPrivateCharacters() {
final int startOfPrivateBMPChars = 0xE000;
// Request a string in an area of the Basic Multilingual Plane that is
// largely occupied by private characters
- final String str = RandomStringGenerator.builder().withinRange(startOfPrivateBMPChars, Character.MIN_SUPPLEMENTARY_CODE_POINT - 1).build()
+ final String str = RandomStringGenerator.builder().withinRange(startOfPrivateBMPChars, Character.MIN_SUPPLEMENTARY_CODE_POINT - 1).get()
.generate(5000);
int i = 0;
do {
@@ -186,7 +195,7 @@ void testPasswordExample() {
void testRemoveFilters() {
final RandomStringGenerator.Builder builder = RandomStringGenerator.builder().withinRange('a', 'z').filteredBy(A_FILTER);
builder.filteredBy();
- final String str = builder.build().generate(100);
+ final String str = builder.get().generate(100);
for (final char c : str.toCharArray()) {
if (c != 'a') {
// filter was successfully removed
@@ -200,7 +209,7 @@ void testRemoveFilters() {
void testSelectFromCharArray() {
final String str = "abc";
final char[] charArray = str.toCharArray();
- final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom(charArray).build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom(charArray).get();
final String randomText = generator.generate(5);
for (final char c : randomText.toCharArray()) {
assertTrue(str.indexOf(c) != -1);
@@ -210,7 +219,7 @@ void testSelectFromCharArray() {
@Test
void testSelectFromCharVarargs() {
final String str = "abc";
- final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom('a', 'b', 'c').build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom('a', 'b', 'c').get();
final String randomText = generator.generate(5);
for (final char c : randomText.toCharArray()) {
assertTrue(str.indexOf(c) != -1);
@@ -230,7 +239,7 @@ void testSelectFromCharVarargs2(final boolean accumulate) {
.selectFrom('a', 'b', 'c')
.selectFrom('a', 'b', 'c', 'd')
.selectFrom('a', 'b', 'c', 'd', 'e') // only this last call matters when accumulate is false
- .build();
+ .get();
// @formatter:on
final String randomText = generator.generate(10);
for (final char c : randomText.toCharArray()) {
@@ -261,7 +270,7 @@ void testSelectFromCharVarargs3(final boolean accumulate) {
@Test
void testSelectFromCharVarargSize1() {
- final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom('a').build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom('a').get();
final String randomText = generator.generate(5);
for (final char c : randomText.toCharArray()) {
assertEquals('a', c);
@@ -270,7 +279,7 @@ void testSelectFromCharVarargSize1() {
@Test
void testSelectFromEmptyCharVarargs() {
- final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom().build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom().get();
final String randomText = generator.generate(5);
for (final char c : randomText.toCharArray()) {
assertTrue(c >= Character.MIN_CODE_POINT && c <= Character.MAX_CODE_POINT);
@@ -280,7 +289,7 @@ void testSelectFromEmptyCharVarargs() {
@Test
void testSelectFromNullCharVarargs() {
final int length = 5;
- RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom(null).build();
+ RandomStringGenerator generator = RandomStringGenerator.builder().selectFrom(null).get();
String randomText = generator.generate(length);
assertEquals(length, codePointLength(randomText));
for (final char c : randomText.toCharArray()) {
@@ -288,13 +297,13 @@ void testSelectFromNullCharVarargs() {
}
//
final Builder builder = RandomStringGenerator.builder().selectFrom('a');
- generator = builder.build();
+ generator = builder.get();
randomText = generator.generate(length);
for (final char c : randomText.toCharArray()) {
assertEquals('a', c);
}
// null input resets
- generator = builder.selectFrom(null).build();
+ generator = builder.selectFrom(null).get();
randomText = generator.generate(length);
assertEquals(length, codePointLength(randomText));
for (final char c : randomText.toCharArray()) {
@@ -305,7 +314,7 @@ void testSelectFromNullCharVarargs() {
@Test
void testSetLength() {
final int length = 99;
- final RandomStringGenerator generator = RandomStringGenerator.builder().build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().get();
final String str = generator.generate(length);
assertEquals(length, codePointLength(str));
}
@@ -314,7 +323,7 @@ void testSetLength() {
void testUsingRandomIntUnaryOperator() {
final char testChar = 'a';
final IntUnaryOperator testRandom = n -> testChar;
- final String str = RandomStringGenerator.builder().usingRandom(testRandom).build().generate(10);
+ final String str = RandomStringGenerator.builder().usingRandom(testRandom).get().generate(10);
for (final char c : str.toCharArray()) {
assertEquals(testChar, c);
}
@@ -324,7 +333,7 @@ void testUsingRandomIntUnaryOperator() {
void testUsingRandomTextRandomProvider() {
final char testChar = 'a';
final TextRandomProvider testRandom = n -> testChar;
- final String str = RandomStringGenerator.builder().usingRandom(testRandom).build().generate(10);
+ final String str = RandomStringGenerator.builder().usingRandom(testRandom).get().generate(10);
for (final char c : str.toCharArray()) {
assertEquals(testChar, c);
}
@@ -339,7 +348,7 @@ void testWithinMultipleRanges() {
.withinRange()
.withinRange((char[][]) null)
.withinRange(pairs)
- .build();
+ .get();
// @formatter:on
final String str = generator.generate(length);
int minimumCodePoint = 0, maximumCodePoint = 0;
@@ -360,7 +369,7 @@ void testWithinRange() {
final int length = 5000;
final int minimumCodePoint = 'a';
final int maximumCodePoint = 'z';
- final RandomStringGenerator generator = RandomStringGenerator.builder().withinRange(minimumCodePoint, maximumCodePoint).build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().withinRange(minimumCodePoint, maximumCodePoint).get();
final String str = generator.generate(length);
int i = 0;
do {
@@ -372,7 +381,7 @@ void testWithinRange() {
@Test
void testZeroLength() {
- final RandomStringGenerator generator = RandomStringGenerator.builder().build();
+ final RandomStringGenerator generator = RandomStringGenerator.builder().get();
assertEquals("", generator.generate(0));
}
}
From aac7e010f9dc31101018414d716ddfb5b439f06d Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 09:08:21 -0400
Subject: [PATCH 028/265]
org.apache.commons.text.translate.LookupTranslator.LookupTranslator(Map
CharSequence>) now throws NullPointerException instead of
java.security.InvalidParameterException
- Javadoc
- Reduce vertical whitespace
---
src/changes/changes.xml | 2 ++
.../text/translate/LookupTranslator.java | 23 ++++++-------------
.../text/translate/LookupTranslatorTest.java | 3 +--
3 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 302829a057..bfd08972d2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,6 +56,8 @@ The type attribute can be add,update,fix,remove.
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.
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 400c8d383c..005e36e446 100644
--- a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
@@ -14,14 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.text.translate;
import java.io.IOException;
import java.io.Writer;
-import java.security.InvalidParameterException;
import java.util.BitSet;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
/**
* Translates a value using a lookup table.
@@ -32,36 +33,27 @@ 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;
/**
- * Constructs the lookup table to be used in translation
+ * Constructs the lookup table to be used in translation.
*
- * Note that, as of Lang 3.1 (the origin of this code), the key to the lookup
- * table is converted to a java.lang.String. This is because we need the key
- * to support hashCode and equals(Object), allowing it to be the key for a
- * HashMap. See LANG-882.
+ * Note that, as of Lang 3.1 (the origin of this code), the key to the lookup table is converted to a java.lang.String. This is because we need the key to
+ * support hashCode and equals(Object), allowing it to be the key for a HashMap. See LANG-882.
*
- * @param lookupMap Map<CharSequence, CharSequence> table of translator
- * mappings
+ * @param lookupMap Map<CharSequence, CharSequence> table of translator mappings, may not be null.
*/
public LookupTranslator(final Map lookupMap) {
- if (lookupMap == null) {
- throw new InvalidParameterException("lookupMap cannot be null");
- }
+ Objects.requireNonNull(lookupMap, "lookupMap");
this.lookupMap = new HashMap<>();
this.prefixSet = new BitSet();
int currentShortest = Integer.MAX_VALUE;
int currentLongest = 0;
-
for (final Map.Entry pair : lookupMap.entrySet()) {
this.lookupMap.put(pair.getKey().toString(), pair.getValue().toString());
this.prefixSet.set(pair.getKey().charAt(0));
@@ -92,7 +84,6 @@ public int translate(final CharSequence input, final int index, final Writer wri
for (int i = max; i >= shortest; i--) {
final CharSequence subSeq = input.subSequence(index, index + i);
final String result = lookupMap.get(subSeq.toString());
-
if (result != null) {
writer.write(result);
return Character.codePointCount(subSeq, 0, subSeq.length());
diff --git a/src/test/java/org/apache/commons/text/translate/LookupTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/LookupTranslatorTest.java
index 49281e0cde..11cc0bc2e2 100644
--- a/src/test/java/org/apache/commons/text/translate/LookupTranslatorTest.java
+++ b/src/test/java/org/apache/commons/text/translate/LookupTranslatorTest.java
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.io.StringWriter;
-import java.security.InvalidParameterException;
import java.util.HashMap;
import java.util.Map;
@@ -46,7 +45,7 @@ void testBasicLookup() throws IOException {
@Test
void testFailsToCreateLookupTranslatorThrowsInvalidParameterException() {
- assertThrowsExactly(InvalidParameterException.class, () -> new LookupTranslator(null));
+ assertThrowsExactly(NullPointerException.class, () -> new LookupTranslator(null));
}
// Tests: https://issues.apache.org/jira/browse/LANG-882
From 8b3f623e61e4eda5b9fd51f45fd7d36b30b66efb Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 09:11:04 -0400
Subject: [PATCH 029/265] Javadoc
---
.../commons/text/similarity/LevenshteinDistance.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
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 cbfbe6d099..553bd8d6cb 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -34,7 +34,7 @@
public class LevenshteinDistance implements EditDistance {
/**
- * Singleton instance.
+ * The singleton instance.
*/
private static final LevenshteinDistance INSTANCE = new LevenshteinDistance();
@@ -48,7 +48,7 @@ public static LevenshteinDistance getDefaultInstance() {
}
/**
- * Find the Levenshtein distance between two CharSequences if it's less than or equal to a given threshold.
+ * Finds the Levenshtein distance between two CharSequences if it's less than or equal to a given threshold.
*
*
* This implementation follows from Algorithms on Strings, Trees and Sequences by Dan Gusfield and Chas Emerick's implementation of the Levenshtein distance
@@ -288,7 +288,7 @@ private static int unlimitedCompare(SimilarityInput left, SimilarityInput
private final Integer threshold;
/**
- * This returns the default instance that uses a version of the algorithm that does not use a threshold parameter.
+ * Constructs a default instance that uses a version of the algorithm that does not use a threshold parameter.
*
* @see LevenshteinDistance#getDefaultInstance()
* @deprecated Use {@link #getDefaultInstance()}.
@@ -299,8 +299,8 @@ public LevenshteinDistance() {
}
/**
- * If the threshold is not null, distance calculations will be limited to a maximum length. If the threshold is null, the unlimited version of the algorithm
- * will be used.
+ * Constructs a new instance. If the threshold is not null, distance calculations will be limited to a maximum length. If the threshold is null, the
+ * unlimited version of the algorithm will be used.
*
* @param threshold If this is null then distances calculations will not be limited. This may not be negative.
*/
From 9fc3ee00bdef269de3d4785a4d2aecabe340d9f4 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 09:16:54 -0400
Subject: [PATCH 030/265] Javadoc
---
.../org/apache/commons/text/similarity/LevenshteinDistance.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 553bd8d6cb..01f3494cb1 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -392,7 +392,7 @@ public Integer apply(final SimilarityInput left, final SimilarityInput
/**
* Gets the distance threshold.
*
- * @return The distance threshold
+ * @return The distance threshold.
*/
public Integer getThreshold() {
return threshold;
From eb479f31be081cfe6a49706091549334705121a5 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 09:29:31 -0400
Subject: [PATCH 031/265] Javadoc
---
.../apache/commons/text/similarity/LevenshteinDistance.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 01f3494cb1..ced4729771 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -19,7 +19,8 @@
import java.util.Arrays;
/**
- * An algorithm for measuring the difference between two character sequences.
+ * An algorithm for measuring the difference between two character sequences using the Levenshtein
+ * Distance.
*
*
* This is the number of changes needed to change one sequence into another, where each change is a single character modification (deletion, insertion or
@@ -30,6 +31,8 @@
*
*
* @since 1.0
+ * @see Levenshtein Distance on Wikipedia
+ * @see Levenshtein Distance on NIST
*/
public class LevenshteinDistance implements EditDistance {
From 4d26c2d7560e29d5e069f66728e8ecbaf414d79a Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 13:34:00 +0000
Subject: [PATCH 032/265] Prepare for the next release candidate
---
README.md | 10 +--
RELEASE-NOTES.txt | 105 +++++++++++++++++---------------
src/changes/changes.xml | 2 +-
src/site/xdoc/download_text.xml | 26 ++++----
4 files changed, 76 insertions(+), 67 deletions(-)
diff --git a/README.md b/README.md
index 7487c1f2a9..81333cf313 100644
--- a/README.md
+++ b/README.md
@@ -45,12 +45,12 @@ Apache Commons Text
[](https://github.com/apache/commons-text/actions/workflows/maven.yml)
[](https://search.maven.org/artifact/org.apache.commons/commons-text)
-[](https://javadoc.io/doc/org.apache.commons/commons-text/1.13.1)
+[](https://javadoc.io/doc/org.apache.commons/commons-text/1.14.0)
[](https://github.com/apache/commons-text/actions/workflows/codeql-analysis.yml)
[](https://api.securityscorecards.dev/projects/github.com/apache/commons-text)
-Apache Commons Text is a set of utility functions and reusable components for the purpose of processing
- and manipulating text that should be of use in a Java environment.
+Apache Commons Text is a set of utility functions and reusable components for processing
+ and manipulating text in a Java environment.
Documentation
-------------
@@ -69,7 +69,7 @@ Alternatively, you can pull it from the central Maven repositories:
org.apache.commonscommons-text
- 1.13.1
+ 1.14.0
```
@@ -91,7 +91,7 @@ There are some guidelines which will make applying PRs easier for us:
+ 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.
-+ To see the code coverage report, regardless of coverage failures, run `mvn clean site -Dcommons.jacoco.haltOnFailure=false`
++ 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).
You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md).
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index fdec18aa43..f3e1471648 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -14,6 +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.14.0 Release Notes
+------------------------------------------------
+
+The Apache Commons Text team is pleased to announce the release of Apache Commons Text 1.14.0.
+
+Apache Commons Text is a set of utility functions and reusable components for processing
+and manipulating text in a Java environment.
+
+Release 1.14.0. Requires Java 8 or above.
+
+
+New features
+------------
+
+* Interface StringLookup now extends UnaryOperator. Thanks to Gary Gregory.
+* Interface TextRandomProvider extends IntUnaryOperator. Thanks to Gary Gregory.
+* Add RandomStringGenerator.Builder.usingRandom(IntUnaryOperator). Thanks to Gary Gregory.
+* Add PMD check to default Maven goal. Thanks to Gary Gregory.
+* Add org.apache.commons.text.RandomStringGenerator.Builder.setAccumulate(boolean). Thanks to Gary Gregory.
+
+Fixed Bugs
+----------
+
+* Fix PMD UnnecessaryFullyQualifiedName in StringLookupFactory. Thanks to Gary Gregory.
+* Fix PMD UnnecessaryFullyQualifiedName in DefaultStringLookupsHolder. Thanks to Gary Gregory.
+* Fix PMD UnnecessaryFullyQualifiedName in PropertiesStringLookup. Thanks to Gary Gregory.
+* Fix PMD UnnecessaryFullyQualifiedName in JavaPlatformStringLookup. Thanks to Gary Gregory.
+* Fix PMD UnnecessaryFullyQualifiedName in StringSubstitutor. Thanks to Gary Gregory.
+* Fix PMD UnnecessaryFullyQualifiedName in StrSubstitutor. Thanks to Gary Gregory.
+* Fix PMD UnnecessaryFullyQualifiedName in AlphabetConverter. Thanks to Gary Gregory.
+* Fix PMD AvoidBranchingStatementAsLastInLoop in TextStringBuilder. Thanks to Gary Gregory.
+* Fix PMD AvoidBranchingStatementAsLastInLoop in StrBuilder. Thanks to Gary Gregory.
+* org.apache.commons.text.translate.LookupTranslator.LookupTranslator(Map CharSequence>) now throws NullPointerException instead of java.security.InvalidParameterException. Thanks to Gary Gregory.
+
+Changes
+-------
+
+* Bump org.apache.commons:commons-parent from 81 to 85 #668. Thanks to Dependabot, Gary Gregory.
+* Bump commons-io:commons-io from 2.18.0 to 2.20.0. Thanks to Gary Gregory.
+* Bump graalvm.version from 24.2.0 to 24.2.2 #665, #681. Thanks to Dependabot, Gary Gregory.
+* Bump commons.bytebuddy.version from 1.17.5 to 1.17.6 (#677). Thanks to Dependabot.
+* Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 #680. Thanks to Dependabot.
+
+
+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.13.1 Release Notes
----------------------------------------
@@ -53,22 +110,6 @@ Have fun!
-----------------------------------------------------------------------------
-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.
-
-
Apache Commons Text Version 1.13.0 Release Notes
------------------------------------------------
@@ -141,22 +182,6 @@ Have fun!
-----------------------------------------------------------------------------
-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.
-
-
Apache Commons Text Version 1.12.0 Release Notes
------------------------------------------------
@@ -206,22 +231,6 @@ Have fun!
-----------------------------------------------------------------------------
-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.
-
-
Apache Commons Text Version 1.11.0 Release Notes
------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bfd08972d2..5406a31766 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 PMD UnnecessaryFullyQualifiedName in StringLookupFactory.Fix PMD UnnecessaryFullyQualifiedName in DefaultStringLookupsHolder.
diff --git a/src/site/xdoc/download_text.xml b/src/site/xdoc/download_text.xml
index c16a6f0265..12c6a1a08a 100644
--- a/src/site/xdoc/download_text.xml
+++ b/src/site/xdoc/download_text.xml
@@ -115,32 +115,32 @@ limitations under the License.
From e96010915ed1c1185b3b7f34dcd231a613c40144 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 13:35:37 +0000
Subject: [PATCH 033/265] Prepare for the release candidate 1.14.0 RC1
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5e4ab7a622..c0e5b7e30d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
85commons-text
- 1.14.0-SNAPSHOT
+ 1.14.0Apache Commons TextApache 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-1UTF-8
- 2025-04-10T21:38:03Z
+ 2025-07-20T13:34:14Z1.81.8text
From 3a9488e4fdb22963388a73467215d1f7c7e8c206 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 09:51:11 -0400
Subject: [PATCH 034/265] Fix Javadoc on Java 8
---
.../apache/commons/text/similarity/LevenshteinDistance.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 ced4729771..3aad1d8d40 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -31,8 +31,8 @@
*
*
* @since 1.0
- * @see Levenshtein Distance on Wikipedia
- * @see Levenshtein Distance on NIST
+ * @see Levenshtein Distance on Wikipedia
+ * @see Levenshtein Distance on NIST
*/
public class LevenshteinDistance implements EditDistance {
From 3d100309e422d4aa8a7f52415c440f523565e7f4 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:00:37 -0400
Subject: [PATCH 035/265] Javadoc
---
.../commons/text/similarity/SimilarityScoreFrom.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java b/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java
index 341f9d9d34..470bb713da 100644
--- a/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java
+++ b/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java
@@ -81,8 +81,8 @@ public SimilarityScoreFrom(final SimilarityScore similarityScore, final CharS
* This compares "left" field against the "right" parameter
* using the "similarity score" implementation.
*
- * @param right the second CharSequence
- * @return The similarity score between two CharSequences
+ * @param right the second CharSequence.
+ * @return The similarity score between two CharSequences.
*/
public R apply(final CharSequence right) {
return similarityScore.apply(left, right);
@@ -91,7 +91,7 @@ public R apply(final CharSequence right) {
/**
* Gets the left parameter.
*
- * @return The left parameter
+ * @return The left parameter.
*/
public CharSequence getLeft() {
return left;
@@ -100,7 +100,7 @@ public CharSequence getLeft() {
/**
* Gets the edit distance.
*
- * @return The edit distance
+ * @return The edit distance.
*/
public SimilarityScore getSimilarityScore() {
return similarityScore;
From 4d585ce9b72cfcb33ccb04285c55915067f87d57 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:00:41 -0400
Subject: [PATCH 036/265] Javadoc
---
.../java/org/apache/commons/text/similarity/RegexTokenizer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java b/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
index b633d7867f..e566cbaf85 100644
--- a/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
+++ b/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
@@ -47,7 +47,7 @@ final class RegexTokenizer implements CharSequenceTokenizer {
/**
* {@inheritDoc}
*
- * @throws IllegalArgumentException if the input text is blank
+ * @throws IllegalArgumentException if the input text is blank.
*/
@Override
public CharSequence[] apply(final CharSequence text) {
From a43c1378a6a58b6d8ed9a8b1e0de9db9e890a3ee Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:00:44 -0400
Subject: [PATCH 037/265] Javadoc
---
.../LongestCommonSubsequenceDistance.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequenceDistance.java b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequenceDistance.java
index f6ce1e53f5..ed33437ac2 100644
--- a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequenceDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequenceDistance.java
@@ -44,15 +44,14 @@ public LongestCommonSubsequenceDistance() {
}
/**
- * Calculates an edit distance between two {@code CharSequence}'s {@code left} and
- * {@code right} as: {@code left.length() + right.length() - 2 * LCS(left, right)}, where
- * {@code LCS} is given in {@link LongestCommonSubsequence#apply(CharSequence, CharSequence)}.
+ * Calculates an edit distance between two {@code CharSequence}'s {@code left} and {@code right} as:
+ * {@code left.length() + right.length() - 2 * LCS(left, right)}, where {@code LCS} is given in
+ * {@link LongestCommonSubsequence#apply(CharSequence, CharSequence)}.
*
- * @param left first character sequence
- * @param right second character sequence
- * @return distance
- * @throws IllegalArgumentException
- * if either String input {@code null}
+ * @param left first character sequence.
+ * @param right second character sequence.
+ * @return distance.
+ * @throws IllegalArgumentException if either String input {@code null}.
*/
@Override
public Integer apply(final CharSequence left, final CharSequence right) {
From 0f08e877a9fa83e5a3de3ecfcf1ddbe45df7e5a5 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:00:54 -0400
Subject: [PATCH 038/265] Javadoc
---
.../similarity/LongestCommonSubsequence.java | 38 ++++++++++---------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
index 86288d4872..04ec48e911 100644
--- a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
+++ b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
@@ -65,7 +65,7 @@ public class LongestCommonSubsequence implements SimilarityScore {
*
* @param left first input sequence.
* @param right second input sequence.
- * @return last row of the dynamic-programming (DP) table for calculating the LCS of {@code left} and {@code right}
+ * @return last row of the dynamic-programming (DP) table for calculating the LCS of {@code left} and {@code right}.
* @since 1.10.0
*/
private static int[] algorithmB(final CharSequence left, final CharSequence right) {
@@ -104,7 +104,7 @@ private static int[] algorithmB(final CharSequence left, final CharSequence righ
*
* @param left first input sequence.
* @param right second input sequence.
- * @return the LCS of {@code left} and {@code right}
+ * @return the LCS of {@code left} and {@code right}.
* @since 1.10.0
*/
private static String algorithmC(final CharSequence left, final CharSequence right) {
@@ -144,7 +144,9 @@ private static String algorithmC(final CharSequence left, final CharSequence rig
return out.toString();
}
- // An auxiliary method for CharSequence reversal
+ /*
+ * A method for CharSequence reversal.
+ */
private static String reverse(final CharSequence s) {
return new StringBuilder(s).reverse().toString();
}
@@ -170,10 +172,10 @@ public LongestCommonSubsequence() {
* An evaluation using JMH revealed that this method is almost two times faster than its previous version.
*
*
- * @param left first character sequence
- * @param right second character sequence
- * @return length of the longest common subsequence of {@code left} and {@code right}
- * @throws IllegalArgumentException if either String input {@code null}
+ * @param left first character sequence.
+ * @param right second character sequence.
+ * @return length of the longest common subsequence of {@code left} and {@code right}.
+ * @throws IllegalArgumentException if either String input {@code null}.
*/
@Override
public Integer apply(final CharSequence left, final CharSequence right) {
@@ -211,10 +213,10 @@ public Integer apply(final CharSequence left, final CharSequence right) {
* elements.
*
*
- * @param left first character sequence
- * @param right second character sequence
- * @return the longest common subsequence found
- * @throws IllegalArgumentException if either String input {@code null}
+ * @param left first character sequence.
+ * @param right second character sequence.
+ * @return the longest common subsequence found.
+ * @throws IllegalArgumentException if either String input {@code null}.
* @deprecated Deprecated as of 1.2 due to a typo in the method name.
* Use {@link #longestCommonSubsequence(CharSequence, CharSequence)} instead.
* This method will be removed in 2.0.
@@ -247,10 +249,10 @@ public CharSequence logestCommonSubsequence(final CharSequence left, final CharS
* elements.
*
*
- * @param left first character sequence
- * @param right second character sequence
- * @return the longest common subsequence found
- * @throws IllegalArgumentException if either String input {@code null}
+ * @param left first character sequence.
+ * @param right second character sequence.
+ * @return the longest common subsequence found.
+ * @throws IllegalArgumentException if either String input {@code null}.
* @since 1.2
*/
public CharSequence longestCommonSubsequence(final CharSequence left, final CharSequence right) {
@@ -279,9 +281,9 @@ public CharSequence longestCommonSubsequence(final CharSequence left, final Char
* dynamic programming portion of the algorithm, and is the reason for the runtime complexity being
* O(m*n), where m=left.length() and n=right.length().
*
- * @param left first character sequence
- * @param right second character sequence
- * @return lcsLengthArray
+ * @param left first character sequence.
+ * @param right second character sequence.
+ * @return longest common substring length array.
* @deprecated Deprecated as of 1.10. A more efficient implementation for calculating LCS is now available.
* Use {@link #longestCommonSubsequence(CharSequence, CharSequence)} instead to directly calculate the LCS.
* This method will be removed in 2.0.
From 38a7ae8d751c20e1f4055ebe15a649f003050bcb Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:00:57 -0400
Subject: [PATCH 039/265] Javadoc
---
.../text/similarity/LevenshteinResults.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java
index 796019077d..37b547798b 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java
@@ -54,9 +54,9 @@ public class LevenshteinResults {
* Constructs the results for a detailed Levenshtein distance.
*
* @param distance distance between two character sequences.
- * @param insertCount insert character count
- * @param deleteCount delete character count
- * @param substituteCount substitute character count
+ * @param insertCount insert character count.
+ * @param deleteCount delete character count.
+ * @param substituteCount substitute character count.
*/
public LevenshteinResults(final Integer distance, final Integer insertCount, final Integer deleteCount,
final Integer substituteCount) {
@@ -83,7 +83,7 @@ public boolean equals(final Object o) {
/**
* Gets the number of character deletion needed to change one character sequence to other.
*
- * @return delete character count
+ * @return delete character count.
*/
public Integer getDeleteCount() {
return deleteCount;
@@ -92,7 +92,7 @@ public Integer getDeleteCount() {
/**
* Gets the distance between two character sequences.
*
- * @return distance between two character sequence
+ * @return distance between two character sequence.
*/
public Integer getDistance() {
return distance;
@@ -101,7 +101,7 @@ public Integer getDistance() {
/**
* Gets the number of insertion needed to change one character sequence into another.
*
- * @return insert character count
+ * @return insert character count.
*/
public Integer getInsertCount() {
return insertCount;
@@ -110,7 +110,7 @@ public Integer getInsertCount() {
/**
* Gets the number of character substitution needed to change one character sequence into another.
*
- * @return substitute character count
+ * @return substitute character count.
*/
public Integer getSubstituteCount() {
return substituteCount;
From 90eb6293905066fd1e26c3768c4e88c2ccab8b1c Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:00 -0400
Subject: [PATCH 040/265] Javadoc
---
.../text/similarity/LevenshteinDistance.java | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
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 3aad1d8d40..787279c6ab 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -44,7 +44,7 @@ public class LevenshteinDistance implements EditDistance {
/**
* Gets the default instance.
*
- * @return The default instance
+ * @return The default instance.
*/
public static LevenshteinDistance getDefaultInstance() {
return INSTANCE;
@@ -72,9 +72,9 @@ public static LevenshteinDistance getDefaultInstance() {
* limitedCompare("hippo", "elephant", 6) = -1
*
*
- * @param left the first SimilarityInput, must not be null
- * @param right the second SimilarityInput, must not be null
- * @param threshold the target threshold, must not be negative
+ * @param left the first SimilarityInput, must not be null.
+ * @param right the second SimilarityInput, must not be null.
+ * @param threshold the target threshold, must not be negative.
* @return result distance, or -1
*/
private static int limitedCompare(SimilarityInput left, SimilarityInput right, final int threshold) { // NOPMD
@@ -229,10 +229,10 @@ private static int limitedCompare(SimilarityInput left, SimilarityInput
*
- * @param left the first CharSequence, must not be null
- * @param right the second CharSequence, must not be null
- * @return result distance, or -1
- * @throws IllegalArgumentException if either CharSequence input is {@code null}
+ * @param left the first CharSequence, must not be null.
+ * @param right the second CharSequence, must not be null.
+ * @return result distance, or -1.
+ * @throws IllegalArgumentException if either CharSequence input is {@code null}.
*/
private static int unlimitedCompare(SimilarityInput left, SimilarityInput right) {
if (left == null || right == null) {
@@ -347,10 +347,10 @@ public LevenshteinDistance(final Integer threshold) {
* distance.apply("hello", "hallo") = 1
*
*
- * @param left the first input, must not be null
- * @param right the second input, must not be null
- * @return result distance, or -1
- * @throws IllegalArgumentException if either String input {@code null}
+ * @param left the first input, must not be null.
+ * @param right the second input, must not be null.
+ * @return result distance, or -1.
+ * @throws IllegalArgumentException if either String input {@code null}.
*/
@Override
public Integer apply(final CharSequence left, final CharSequence right) {
From a28b9fa39bf83b6e1499493210eb8288a35dba1b Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:03 -0400
Subject: [PATCH 041/265] Javadoc
---
.../LevenshteinDetailedDistance.java | 275 +++++++-----------
1 file changed, 110 insertions(+), 165 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 0e241efd5f..78505991f9 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.text.similarity;
import java.util.Arrays;
@@ -22,9 +23,8 @@
* An algorithm for measuring the difference between two character sequences.
*
*
- * This is the number of changes needed to change one sequence into another,
- * where each change is a single character modification (deletion, insertion
- * or substitution).
+ * This is the number of changes needed to change one sequence into another, where each change is a single character modification (deletion, insertion or
+ * substitution).
*
*
* @since 1.0
@@ -37,39 +37,29 @@ public class LevenshteinDetailedDistance implements EditDistance The type of similarity score unit.
- * @param left character sequence which need to be converted from
- * @param right character sequence which need to be converted to
- * @param matrix two dimensional array containing
- * @param swapped tells whether the value for left character sequence and right
- * character sequence were swapped to save memory
- * @return result object containing the count of insert, delete and substitute and total count needed
+ * @param The type of similarity score unit.
+ * @param left character sequence which need to be converted from.
+ * @param right character sequence which need to be converted to.
+ * @param matrix two dimensional array containing.
+ * @param swapped tells whether the value for left character sequence and right character sequence were swapped to save memory.
+ * @return result object containing the count of insert, delete and substitute and total count needed.
*/
- private static LevenshteinResults findDetailedResults(final SimilarityInput left,
- final SimilarityInput right,
- final int[][] matrix,
- final boolean swapped) {
-
+ private static LevenshteinResults findDetailedResults(final SimilarityInput left, final SimilarityInput right, final int[][] matrix,
+ final boolean swapped) {
int delCount = 0;
int addCount = 0;
int subCount = 0;
-
int rowIndex = right.length();
int columnIndex = left.length();
-
int dataAtLeft = 0;
int dataAtTop = 0;
int dataAtDiagonal = 0;
int data = 0;
boolean deleted = false;
boolean added = false;
-
while (rowIndex >= 0 && columnIndex >= 0) {
-
if (columnIndex == 0) {
dataAtLeft = -1;
} else {
@@ -89,7 +79,6 @@ private static LevenshteinResults findDetailedResults(final SimilarityInput<
break;
}
data = matrix[rowIndex][columnIndex];
-
// case in which the character at left and right are the same,
// in this case none of the counters will be incremented.
if (columnIndex > 0 && rowIndex > 0 && left.at(columnIndex - 1).equals(right.at(rowIndex - 1))) {
@@ -97,12 +86,10 @@ private static LevenshteinResults findDetailedResults(final SimilarityInput<
rowIndex--;
continue;
}
-
// handling insert and delete cases.
deleted = false;
added = false;
- if (data - 1 == dataAtLeft && data <= dataAtDiagonal && data <= dataAtTop
- || dataAtDiagonal == -1 && dataAtTop == -1) { // NOPMD
+ if (data - 1 == dataAtLeft && data <= dataAtDiagonal && data <= dataAtTop || dataAtDiagonal == -1 && dataAtTop == -1) { // NOPMD
columnIndex--;
if (swapped) {
addCount++;
@@ -111,8 +98,7 @@ private static LevenshteinResults findDetailedResults(final SimilarityInput<
delCount++;
deleted = true;
}
- } else if (data - 1 == dataAtTop && data <= dataAtDiagonal && data <= dataAtLeft
- || dataAtDiagonal == -1 && dataAtLeft == -1) { // NOPMD
+ } else if (data - 1 == dataAtTop && data <= dataAtDiagonal && data <= dataAtLeft || dataAtDiagonal == -1 && dataAtLeft == -1) { // NOPMD
rowIndex--;
if (swapped) {
delCount++;
@@ -122,7 +108,6 @@ private static LevenshteinResults findDetailedResults(final SimilarityInput<
added = true;
}
}
-
// substituted case
if (!added && !deleted) {
subCount++;
@@ -143,15 +128,11 @@ public static LevenshteinDetailedDistance getDefaultInstance() {
}
/**
- * Finds the Levenshtein distance between two CharSequences if it's less than or
- * equal to a given threshold.
+ * Finds the Levenshtein distance between two CharSequences if it's less than or equal to a given threshold.
*
*
- * 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
+ * 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
*
*
- * @param The type of similarity score unit.
- * @param left the first CharSequence, must not be null
- * @param right the second CharSequence, must not be null
- * @param threshold the target threshold, must not be negative
- * @return result distance, or -1
+ * @param The type of similarity score unit.
+ * @param left the first CharSequence, must not be null.
+ * @param right the second CharSequence, must not be null.
+ * @param threshold the target threshold, must not be negative.
+ * @return result distance, or -1.
*/
- private static LevenshteinResults limitedCompare(SimilarityInput left, SimilarityInput right, final int threshold) { //NOPMD
+ private static LevenshteinResults limitedCompare(SimilarityInput left, SimilarityInput right, final int threshold) { // NOPMD
if (left == null || right == null) {
throw new IllegalArgumentException("CharSequences must not be null");
}
if (threshold < 0) {
throw new IllegalArgumentException("Threshold must not be negative");
}
-
/*
- * This implementation only computes the distance if it's less than or
- * equal to the threshold value, returning -1 if it's greater. The
- * advantage is performance: unbounded distance is O(nm), but a bound of
- * k allows us to reduce it to O(km) time by only computing a diagonal
- * stripe of width 2k + 1 of the cost table. It is also possible to use
- * this to compute the unbounded Levenshtein distance by starting the
- * threshold at 1 and doubling each time until the distance is found;
- * this is O(dm), where d is the distance.
+ * This implementation only computes the distance if it's less than or equal to the threshold value, returning -1 if it's greater. The advantage is
+ * performance: unbounded distance is O(nm), but a bound of k allows us to reduce it to O(km) time by only computing a diagonal stripe of width 2k + 1
+ * of the cost table. It is also possible to use this to compute the unbounded Levenshtein distance by starting the threshold at 1 and doubling each
+ * time until the distance is found; this is O(dm), where d is the distance.
*
- * One subtlety comes from needing to ignore entries on the border of
- * our stripe eg. p[] = |#|#|#|* d[] = *|#|#|#| We must ignore the entry
- * to the left of the leftmost member We must ignore the entry above the
- * rightmost member
+ * One subtlety comes from needing to ignore entries on the border of our stripe eg. p[] = |#|#|#|* d[] = *|#|#|#| We must ignore the entry to the left
+ * of the leftmost member We must ignore the entry above the rightmost member
*
- * Another subtlety comes from our stripe running off the matrix if the
- * strings aren't of the same size. Since string s is always swapped to
- * be the shorter of the two, the stripe will always run off to the
- * upper right instead of the lower left of the matrix.
+ * Another subtlety comes from our stripe running off the matrix if the strings aren't of the same size. Since string s is always swapped to be the
+ * shorter of the two, the stripe will always run off to the upper right instead of the lower left of the matrix.
*
- * As a concrete example, suppose s is of length 5, t is of length 7,
- * and our threshold is 1. In this case we're going to walk a stripe of
- * length 3. The matrix would look like so:
+ * As a concrete example, suppose s is of length 5, t is of length 7, and our threshold is 1. In this case we're going to walk a stripe of length 3. The
+ * matrix would look like so:
*
- *
*
- * Note how the stripe leads off the table as there is no possible way
- * to turn a string of length 5 into one of length 7 in edit distance of
- * 1.
+ * Note how the stripe leads off the table as there is no possible way to turn a string of length 5 into one of length 7 in edit distance of 1.
*
- * Additionally, this implementation decreases memory usage by using two
- * single-dimensional arrays and swapping them back and forth instead of
- * allocating an entire n by m matrix. This requires a few minor
- * changes, such as immediately returning when it's detected that the
- * stripe has run off the matrix and initially filling the arrays with
- * large values so that entries we don't compute are ignored.
+ * Additionally, this implementation decreases memory usage by using two single-dimensional arrays and swapping them back and forth instead of
+ * allocating an entire n by m matrix. This requires a few minor changes, such as immediately returning when it's detected that the stripe has run off
+ * the matrix and initially filling the arrays with large values so that entries we don't compute are ignored.
*
- * See Algorithms on Strings, Trees and Sequences by Dan Gusfield for
- * some discussion.
+ * See Algorithms on Strings, Trees and Sequences by Dan Gusfield for some discussion.
*/
-
int n = left.length(); // length of left
int m = right.length(); // length of right
-
// if one string is empty, the edit distance is necessarily the length of the other
if (n == 0) {
return m <= threshold ? new LevenshteinResults(m, m, 0, 0) : new LevenshteinResults(-1, 0, 0, 0);
@@ -242,7 +196,6 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si
if (m == 0) {
return n <= threshold ? new LevenshteinResults(n, 0, n, 0) : new LevenshteinResults(-1, 0, 0, 0);
}
-
boolean swapped = false;
if (n > m) {
// swap the two strings to consume less memory
@@ -253,20 +206,17 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si
m = right.length();
swapped = true;
}
-
int[] p = new int[n + 1]; // 'previous' cost array, horizontally
int[] d = new int[n + 1]; // cost array, horizontally
int[] tempD; // placeholder to assist in swapping p and d
final int[][] matrix = new int[m + 1][n + 1];
-
- //filling the first row and first column values in the matrix
+ // filling the first row and first column values in the matrix
for (int index = 0; index <= n; index++) {
matrix[0][index] = index;
}
for (int index = 0; index <= m; index++) {
matrix[index][0] = index;
}
-
// fill in starting table values
final int boundary = Math.min(n, threshold) + 1;
for (int i = 0; i < boundary; i++) {
@@ -276,27 +226,21 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si
// stripe will be ignored in following loop iterations
Arrays.fill(p, boundary, p.length, Integer.MAX_VALUE);
Arrays.fill(d, Integer.MAX_VALUE);
-
// iterates through t
for (int j = 1; j <= m; j++) {
final E rightJ = right.at(j - 1); // jth character of right
d[0] = j;
-
// compute stripe indices, constrain to array size
final int min = Math.max(1, j - threshold);
- final int max = j > Integer.MAX_VALUE - threshold ? n : Math.min(
- n, j + threshold);
-
+ final int max = j > Integer.MAX_VALUE - threshold ? n : Math.min(n, j + threshold);
// the stripe may lead off of the table if s and t are of different sizes
if (min > max) {
return new LevenshteinResults(-1, 0, 0, 0);
}
-
// ignore entry left of leftmost
if (min > 1) {
d[min - 1] = Integer.MAX_VALUE;
}
-
// iterates through [min, max] in s
for (int i = min; i <= max; i++) {
if (left.at(i - 1).equals(rightJ)) {
@@ -308,13 +252,11 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si
}
matrix[j][i] = d[i];
}
-
// copy current distance counts to 'previous row' distance counts
tempD = p;
p = d;
d = tempD;
}
-
// if p[n] is greater than the threshold, there's no guarantee on it being the correct distance
if (p[n] <= threshold) {
return findDetailedResults(left, right, matrix, swapped);
@@ -325,15 +267,21 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si
/**
* Finds the Levenshtein distance between two Strings.
*
- *
A higher score indicates a greater distance.
+ *
+ * A higher score indicates a greater distance.
+ *
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
+ *
+ * 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
+ *
*
- * @param The type of similarity score unit.
- * @param left the first CharSequence, must not be null
- * @param right the second CharSequence, must not be null
- * @return result distance, or -1
- * @throws IllegalArgumentException if either CharSequence input is {@code null}
+ * @param The type of similarity score unit.
+ * @param left the first CharSequence, must not be null.
+ * @param right the second CharSequence, must not be null.
+ * @return result distance, or -1.
+ * @throws IllegalArgumentException if either CharSequence input is {@code null}.
*/
private static LevenshteinResults unlimitedCompare(SimilarityInput left, SimilarityInput right) {
if (left == null || right == null) {
throw new IllegalArgumentException("CharSequences must not be null");
}
-
/*
- The difference between this impl. and the previous is that, rather
- than creating and retaining a matrix of size s.length() + 1 by t.length() + 1,
- we maintain two single-dimensional arrays of length s.length() + 1. The first, d,
- is the 'current working' distance array that maintains the newest distance cost
- counts as we iterate through the characters of String s. Each time we increment
- the index of String t we are comparing, d is copied to p, the second int[]. Doing so
- allows us to retain the previous cost counts as required by the algorithm (taking
- the minimum of the cost count to the left, up one, and diagonally up and to the left
- of the current cost count being calculated). (Note that the arrays aren't really
- copied anymore, just switched...this is clearly much better than cloning an array
- or doing a System.arraycopy() each time through the outer loop.)
-
- Effectively, the difference between the two implementations is this one does not
- cause an out of memory condition when calculating the LD over two very large strings.
+ * The difference between this impl. and the previous is that, rather than creating and retaining a matrix of size s.length() + 1 by t.length() + 1, we
+ * maintain two single-dimensional arrays of length s.length() + 1. The first, d, is the 'current working' distance array that maintains the newest
+ * distance cost counts as we iterate through the characters of String s. Each time we increment the index of String t we are comparing, d is copied to
+ * p, the second int[]. Doing so allows us to retain the previous cost counts as required by the algorithm (taking the minimum of the cost count to the
+ * left, up one, and diagonally up and to the left of the current cost count being calculated). (Note that the arrays aren't really copied anymore, just
+ * switched...this is clearly much better than cloning an array or doing a System.arraycopy() each time through the outer loop.)
+ *
+ * Effectively, the difference between the two implementations is this one does not cause an out of memory condition when calculating the LD over two
+ * very large strings.
*/
-
int n = left.length(); // length of left
int m = right.length(); // length of right
-
if (n == 0) {
return new LevenshteinResults(m, m, 0, 0);
}
@@ -396,12 +336,10 @@ allows us to retain the previous cost counts as required by the algorithm (takin
m = right.length();
swapped = true;
}
-
int[] p = new int[n + 1]; // 'previous' cost array, horizontally
int[] d = new int[n + 1]; // cost array, horizontally
- int[] tempD; //placeholder to assist in swapping p and d
+ int[] tempD; // placeholder to assist in swapping p and d
final int[][] matrix = new int[m + 1][n + 1];
-
// filling the first row and first column values in the matrix
for (int index = 0; index <= n; index++) {
matrix[0][index] = index;
@@ -409,30 +347,24 @@ allows us to retain the previous cost counts as required by the algorithm (takin
for (int index = 0; index <= m; index++) {
matrix[index][0] = index;
}
-
// indexes into strings left and right
int i; // iterates through left
int j; // iterates through right
-
E rightJ; // jth character of right
-
int cost; // cost
for (i = 0; i <= n; i++) {
p[i] = i;
}
-
for (j = 1; j <= m; j++) {
rightJ = right.at(j - 1);
d[0] = j;
-
for (i = 1; i <= n; i++) {
cost = left.at(i - 1).equals(rightJ) ? 0 : 1;
// minimum of cell to the left+1, to the top+1, diagonally left and up +cost
d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1), p[i - 1] + cost);
- //filling the matrix
+ // filling the matrix
matrix[j][i] = d[i];
}
-
// copy current distance counts to 'previous row' distance counts
tempD = p;
p = d;
@@ -448,8 +380,7 @@ allows us to retain the previous cost counts as required by the algorithm (takin
/**
*
- * This returns the default instance that uses a version
- * of the algorithm that does not use a threshold parameter.
+ * This returns the default instance that uses a version of the algorithm that does not use a threshold parameter.
*
*
* @see LevenshteinDetailedDistance#getDefaultInstance()
@@ -463,7 +394,9 @@ public LevenshteinDetailedDistance() {
/**
* If the threshold is not null, distance calculations will be limited to a maximum length.
*
- *
If the threshold is null, the unlimited version of the algorithm will be used.
+ *
+ * If the threshold is null, the unlimited version of the algorithm will be used.
+ *
*
* @param threshold If this is null then distances calculations will not be limited. This may not be negative.
*/
@@ -477,15 +410,21 @@ public LevenshteinDetailedDistance(final Integer threshold) {
/**
* Computes the Levenshtein distance between two Strings.
*
- *
A higher score indicates a greater distance.
+ *
+ * A higher score indicates a greater distance.
+ *
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
+ *
+ * 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
+ *
*
- * @param left the first input, must not be null
- * @param right the second input, must not be null
- * @return result distance, or -1
- * @throws IllegalArgumentException if either String input {@code null}
+ * @param left the first input, must not be null.
+ * @param right the second input, must not be null.
+ * @return result distance, or -1.
+ * @throws IllegalArgumentException if either String input {@code null}.
*/
@Override
public LevenshteinResults apply(final CharSequence left, final CharSequence right) {
@@ -514,15 +453,21 @@ public LevenshteinResults apply(final CharSequence left, final CharSequence righ
/**
* Computes the Levenshtein distance between two Strings.
*
- *
A higher score indicates a greater distance.
+ *
+ * A higher score indicates a greater distance.
+ *
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
+ *
+ * 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
+ *
*
- * @param The type of similarity score unit.
- * @param left the first input, must not be null
- * @param right the second input, must not be null
- * @return result distance, or -1
- * @throws IllegalArgumentException if either String input {@code null}
+ * @param The type of similarity score unit.
+ * @param left the first input, must not be null.
+ * @param right the second input, must not be null.
+ * @return result distance, or -1.
+ * @throws IllegalArgumentException if either String input {@code null}.
* @since 1.13.0
*/
public LevenshteinResults apply(final SimilarityInput left, final SimilarityInput right) {
@@ -555,7 +500,7 @@ public LevenshteinResults apply(final SimilarityInput left, final Similar
/**
* Gets the distance threshold.
*
- * @return The distance threshold
+ * @return The distance threshold.
*/
public Integer getThreshold() {
return threshold;
From bd008ff5e5f852e6979c9b5800f24f6a2db0e530 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:08 -0400
Subject: [PATCH 042/265] Javadoc
---
.../org/apache/commons/text/similarity/JaroWinklerDistance.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 f15549878f..5564b07b4e 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java
@@ -81,7 +81,7 @@ public JaroWinklerDistance() {
* @param left the first input, must not be null.
* @param right the second input, must not be null.
* @return result distance.
- * @throws IllegalArgumentException if either CharSequence input is {@code null}
+ * @throws IllegalArgumentException if either CharSequence input is {@code null}.
*/
@Override
public Double apply(final CharSequence left, final CharSequence right) {
From 4f9ac340d2a5bc67f7f722cfdde820c411102913 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:11 -0400
Subject: [PATCH 043/265] Javadoc
---
.../org/apache/commons/text/similarity/JaccardSimilarity.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
index 2630728a78..c5291486e0 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
@@ -48,7 +48,7 @@ public JaccardSimilarity() {
*
* @param left first input sequence.
* @param right second input sequence.
- * @return index.
+ * @return The Jaccard Similarity of two set character sequence passed as input.
* @throws IllegalArgumentException if either String input {@code null}.
*/
@Override
@@ -63,7 +63,7 @@ public Double apply(final CharSequence left, final CharSequence right) {
* @param The type of similarity score unit.
* @param left first input sequence.
* @param right second input sequence.
- * @return index.
+ * @return The Jaccard Similarity of two set character sequence passed as input.
* @since 1.13.0
*/
public Double apply(final SimilarityInput left, final SimilarityInput right) {
From 1d7b5caeadeeff3329cce283411876fa92315d25 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:14 -0400
Subject: [PATCH 044/265] Javadoc
---
.../org/apache/commons/text/similarity/JaccardDistance.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
index 51c64f4e65..d2042e0659 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
@@ -40,7 +40,7 @@ public JaccardDistance() {
*
* @param left first input sequence.
* @param right second input sequence.
- * @return index
+ * @return The Jaccard distance.
* @throws IllegalArgumentException if either String input {@code null}.
*/
@Override
@@ -54,7 +54,7 @@ public Double apply(final CharSequence left, final CharSequence right) {
* @param The type of similarity score unit.
* @param left first input sequence.
* @param right second input sequence.
- * @return index
+ * @return index.
* @throws IllegalArgumentException if either String input {@code null}.
*/
public Double apply(final SimilarityInput left, final SimilarityInput right) {
From a1f3288ac72897d511b04734eb82bbae121bf0d2 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:18 -0400
Subject: [PATCH 045/265] Javadoc
---
.../similarity/IntersectionSimilarity.java | 40 +++++++++----------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java b/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java
index 71a31a0094..370b00a296 100644
--- a/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java
@@ -82,7 +82,7 @@ private TinyBag(final int initialCapacity) {
/**
* Adds a new element to the bag, incrementing its count in the underlying map.
*
- * @param object the object to add
+ * @param object the object to add.
*/
private void add(final T object) {
map.computeIfAbsent(object, k -> new BagCount()).count++;
@@ -91,7 +91,7 @@ private void add(final T object) {
/**
* Returns a Set view of the mappings contained in this bag.
*
- * @return The Set view
+ * @return The Set view.
*/
private Set> entrySet() {
return map.entrySet();
@@ -101,8 +101,8 @@ private Set> entrySet() {
* Returns the number of occurrence of the given element in this bag by
* looking up its count in the underlying map.
*
- * @param object the object to search for
- * @return The number of occurrences of the object, zero if not found
+ * @param object the object to search for.
+ * @return The number of occurrences of the object, zero if not found.
*/
private int getCount(final Object object) {
return map.getOrDefault(object, BagCount.ZERO).count;
@@ -111,7 +111,7 @@ private int getCount(final Object object) {
/**
* Gets the number of unique elements in the bag.
*
- * @return The unique element size
+ * @return The unique element size.
*/
private int uniqueElementSize() {
return map.size();
@@ -122,10 +122,10 @@ private int uniqueElementSize() {
* Computes the intersection between two sets. This is the count of all the elements
* that are within both sets.
*
- * @param the type of the elements in the set
- * @param setA the set A
- * @param setB the set B
- * @return The intersection
+ * @param the type of the elements in the set.
+ * @param setA the set A.
+ * @param setB the set B.
+ * @return The intersection of A and B.
*/
private static int getIntersection(final Set setA, final Set setB) {
int intersection = 0;
@@ -149,8 +149,8 @@ private static int getIntersection(final Set setA, final Set setB) {
* that will include duplicates in the intersect and union.
*
*
- * @param converter the converter used to create the elements from the characters
- * @throws IllegalArgumentException if the converter is null
+ * @param converter the converter used to create the elements from the characters.
+ * @throws IllegalArgumentException if the converter is null.
*/
public IntersectionSimilarity(final Function> converter) {
if (converter == null) {
@@ -162,10 +162,10 @@ public IntersectionSimilarity(final Function> conver
/**
* Calculates the intersection of two character sequences passed as input.
*
- * @param left first character sequence
- * @param right second character sequence
- * @return The intersection result
- * @throws IllegalArgumentException if either input sequence is {@code null}
+ * @param left first character sequence.
+ * @param right second character sequence.
+ * @return The intersection result.
+ * @throws IllegalArgumentException if either input sequence is {@code null}.
*/
@Override
public IntersectionResult apply(final CharSequence left, final CharSequence right) {
@@ -210,9 +210,9 @@ public IntersectionResult apply(final CharSequence left, final CharSequence righ
* Computes the intersection between two bags. This is the sum of the minimum
* count of each element that is within both sets.
*
- * @param bagA the bag A
- * @param bagB the bag B
- * @return The intersection
+ * @param bagA the bag A.
+ * @param bagB the bag B.
+ * @return The intersection of A and B.
*/
private int getIntersection(final TinyBag bagA, final TinyBag bagB) {
int intersection = 0;
@@ -229,8 +229,8 @@ private int getIntersection(final TinyBag bagA, final TinyBag bagB) {
* Converts the collection to a bag. The bag will contain the count of each element
* in the collection.
*
- * @param objects the objects
- * @return The bag
+ * @param objects the objects.
+ * @return The bag.
*/
private TinyBag toBag(final Collection objects) {
final TinyBag bag = new TinyBag(objects.size());
From 74e54eece9d5e77fe7a95bb8f498ce4179420995 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:21 -0400
Subject: [PATCH 046/265] Javadoc
---
.../commons/text/similarity/IntersectionResult.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java b/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java
index 155a772fd3..01f4f09a2c 100644
--- a/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java
+++ b/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java
@@ -49,11 +49,11 @@ public class IntersectionResult {
/**
* Constructs the results for an intersection between two sets.
*
- * @param sizeA the size of set A ({@code |A|})
- * @param sizeB the size of set B ({@code |B|})
- * @param intersection the size of the intersection of A and B ({@code |A ∩ B|})
+ * @param sizeA the size of set A ({@code |A|}).
+ * @param sizeB the size of set B ({@code |B|}).
+ * @param intersection the size of the intersection of A and B ({@code |A ∩ B|}).
* @throws IllegalArgumentException if the sizes are negative or the intersection is greater
- * than the minimum of the two set sizes
+ * than the minimum of the two set sizes.
*/
public IntersectionResult(final int sizeA, final int sizeB, final int intersection) {
if (sizeA < 0) {
From c819ed70bae8cbfebd402d31324caa26faa6f341 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:24 -0400
Subject: [PATCH 047/265] Javadoc
---
.../commons/text/similarity/FuzzyScore.java | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java b/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java
index 8355fdba38..78c96affc5 100644
--- a/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java
+++ b/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java
@@ -43,10 +43,8 @@ public class FuzzyScore {
/**
* This returns a {@link Locale}-specific {@link FuzzyScore}.
*
- * @param locale The string matching logic is case insensitive.
- A {@link Locale} is necessary to normalize both Strings to lower case.
- * @throws IllegalArgumentException
- * This is thrown if the {@link Locale} parameter is {@code null}.
+ * @param locale The string matching logic is case insensitive. A {@link Locale} is necessary to normalize both Strings to lower case.
+ * @throws IllegalArgumentException This is thrown if the {@link Locale} parameter is {@code null}.
*/
public FuzzyScore(final Locale locale) {
if (locale == null) {
@@ -56,8 +54,7 @@ public FuzzyScore(final Locale locale) {
}
/**
- * Find the Fuzzy Score which indicates the similarity score between two
- * Strings.
+ * Find the Fuzzy Score which indicates the similarity score between two Strings.
*
*
*
- * @param term a full term that should be matched against, must not be null
- * @param query the query that will be matched against a term, must not be
- * null
- * @return result score
- * @throws IllegalArgumentException if the term or query is {@code null}
+ * @param term a full term that should be matched against, must not be null.
+ * @param query the query that will be matched against a term, must not be null.
+ * @return result score.
+ * @throws IllegalArgumentException if the term or query is {@code null}.
*/
public Integer fuzzyScore(final CharSequence term, final CharSequence query) {
if (term == null || query == null) {
From 2afc236395968c1bf262f8f3f320bbd20b58da95 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:26 -0400
Subject: [PATCH 048/265] Javadoc
---
.../apache/commons/text/similarity/EditDistanceFrom.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java b/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java
index 008ea39c52..ef021dcdd0 100644
--- a/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java
+++ b/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java
@@ -80,8 +80,8 @@ public EditDistanceFrom(final EditDistance editDistance, final CharSequence l
* Compares "left" field against the "right" parameter
* using the "edit distance" implementation.
*
- * @param right the second CharSequence
- * @return The similarity score between two CharSequences
+ * @param right the second CharSequence.
+ * @return The similarity score between two CharSequences.
*/
public R apply(final CharSequence right) {
return editDistance.apply(left, right);
@@ -90,7 +90,7 @@ public R apply(final CharSequence right) {
/**
* Gets the edit distance.
*
- * @return The edit distance
+ * @return The edit distance.
*/
public EditDistance getEditDistance() {
return editDistance;
@@ -99,7 +99,7 @@ public EditDistance getEditDistance() {
/**
* Gets the left parameter.
*
- * @return The left parameter
+ * @return The left parameter.
*/
public CharSequence getLeft() {
return left;
From 2f50c4f412612865494ba91cfa42008d3084022e Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:31 -0400
Subject: [PATCH 049/265] Javadoc
---
.../text/similarity/CosineSimilarity.java | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java b/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java
index d1adbf2508..dfbfe25b73 100644
--- a/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java
@@ -48,9 +48,9 @@ public CosineSimilarity() {
/**
* Calculates the cosine similarity for two given vectors.
*
- * @param leftVector left vector
- * @param rightVector right vector
- * @return cosine similarity between the two vectors
+ * @param leftVector left vector.
+ * @param rightVector right vector.
+ * @return cosine similarity between the two vectors.
*/
public Double cosineSimilarity(final Map leftVector,
final Map rightVector) {
@@ -83,10 +83,10 @@ public Double cosineSimilarity(final Map leftVector,
* that if a vector is longer than other, then a smaller part of it will be used to compute
* the dot product.
*
- * @param leftVector left vector
- * @param rightVector right vector
- * @param intersection common elements
- * @return The dot product
+ * @param leftVector left vector.
+ * @param rightVector right vector.
+ * @param intersection common elements.
+ * @return The dot product.
*/
private double dot(final Map leftVector, final Map rightVector,
final Set intersection) {
@@ -100,9 +100,9 @@ private double dot(final Map leftVector, final Map getIntersection(final Map leftVector,
final Map rightVector) {
From 5fea6e2183e0832ea332a28228bc1fc773b4c647 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:01:51 -0400
Subject: [PATCH 050/265] Javadoc
---
.../commons/text/similarity/LevenshteinDetailedDistance.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 78505991f9..f5f80ad134 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
@@ -314,7 +314,7 @@ private static LevenshteinResults unlimitedCompare(SimilarityInput left,
* p, the second int[]. Doing so allows us to retain the previous cost counts as required by the algorithm (taking the minimum of the cost count to the
* left, up one, and diagonally up and to the left of the current cost count being calculated). (Note that the arrays aren't really copied anymore, just
* switched...this is clearly much better than cloning an array or doing a System.arraycopy() each time through the outer loop.)
- *
+ *
* Effectively, the difference between the two implementations is this one does not cause an out of memory condition when calculating the LD over two
* very large strings.
*/
From f7b8d467bb519fc24ff9e518af1bdfae02bafb8d Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 10:04:46 -0400
Subject: [PATCH 051/265] Javadoc
---
.../org/apache/commons/text/similarity/CosineSimilarity.java | 2 +-
.../org/apache/commons/text/similarity/JaccardSimilarity.java | 2 +-
.../apache/commons/text/similarity/JaroWinklerSimilarity.java | 2 +-
.../commons/text/similarity/LevenshteinDetailedDistance.java | 2 +-
.../commons/text/similarity/LongestCommonSubsequence.java | 2 +-
.../java/org/apache/commons/text/similarity/RegexTokenizer.java | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java b/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java
index dfbfe25b73..c0dd5c2c1a 100644
--- a/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java
@@ -34,7 +34,7 @@
public class CosineSimilarity {
/**
- * Singleton instance.
+ * The singleton instance.
*/
static final CosineSimilarity INSTANCE = new CosineSimilarity();
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
index c5291486e0..61e2b84319 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
@@ -32,7 +32,7 @@
public class JaccardSimilarity implements SimilarityScore {
/**
- * Singleton instance.
+ * The singleton instance.
*/
static final JaccardSimilarity INSTANCE = new JaccardSimilarity();
diff --git a/src/main/java/org/apache/commons/text/similarity/JaroWinklerSimilarity.java b/src/main/java/org/apache/commons/text/similarity/JaroWinklerSimilarity.java
index c803bd5a47..e42650fe70 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaroWinklerSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaroWinklerSimilarity.java
@@ -39,7 +39,7 @@
public class JaroWinklerSimilarity implements SimilarityScore {
/**
- * Singleton instance.
+ * The singleton instance.
*/
static final JaroWinklerSimilarity INSTANCE = new JaroWinklerSimilarity();
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 f5f80ad134..a25b988b60 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
@@ -32,7 +32,7 @@
public class LevenshteinDetailedDistance implements EditDistance {
/**
- * Singleton instance.
+ * The singleton instance.
*/
private static final LevenshteinDetailedDistance INSTANCE = new LevenshteinDetailedDistance();
diff --git a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
index 04ec48e911..ac6d8d36f0 100644
--- a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
+++ b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
@@ -52,7 +52,7 @@
public class LongestCommonSubsequence implements SimilarityScore {
/**
- * Singleton instance.
+ * The singleton instance.
*/
static final LongestCommonSubsequence INSTANCE = new LongestCommonSubsequence();
diff --git a/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java b/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
index e566cbaf85..bf895ed8ac 100644
--- a/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
+++ b/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
@@ -40,7 +40,7 @@ final class RegexTokenizer implements CharSequenceTokenizer {
private static final Pattern PATTERN = Pattern.compile("(\\w)+");
/**
- * Singleton instance.
+ * The singleton instance.
*/
static final RegexTokenizer INSTANCE = new RegexTokenizer();
From 0a343ae4eec94a028d875d8c2200e7f5620d152c Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 20 Jul 2025 13:32:33 -0400
Subject: [PATCH 052/265] Update the GitHub pull request template for AI
Better grammar
---
.github/pull_request_template.md | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index e17973cb0c..7578b4da03 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -22,7 +22,9 @@ Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Y
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.
- [ ] 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 is a best-practice.
+- [ ] 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.
-- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge.
+- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.
From 32ff6b421569ad4d611c60e79b01be64d96a92a6 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Mon, 21 Jul 2025 07:12:15 -0400
Subject: [PATCH 053/265] Merge some string literals
---
.../java/org/apache/commons/text/StringEscapeUtilsTest.java | 2 +-
.../java/org/apache/commons/text/StringSubstitutorTest.java | 4 ++--
.../org/apache/commons/text/lookup/XmlStringLookupTest.java | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
index 99c4755d43..bbebb0f1fe 100644
--- a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
+++ b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
@@ -299,7 +299,7 @@ void testEscapeJava() throws IOException {
assertEscapeJava("\\uABCD", "\uabcd", "Should use capitalized Unicode hex");
assertEscapeJava("He didn't say, \\\"stop!\\\"", "He didn't say, \"stop!\"");
- assertEscapeJava("This space is non-breaking:" + "\\u00A0", "This space is non-breaking:\u00a0", "non-breaking space");
+ assertEscapeJava("This space is non-breaking:\\u00A0", "This space is non-breaking:\u00a0", "non-breaking space");
assertEscapeJava("\\uABCD\\u1234\\u012C", "\uABCD\u1234\u012C");
}
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
index 25ff819341..0f1fbf4339 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
@@ -556,7 +556,7 @@ void testReplaceInVariable() throws IOException {
values.put("species", "1");
assertEqualsCharSeq("The fox jumps over the lazy dog.", replace(sub, "The ${animal.${species}} jumps over the ${target}."));
assertEqualsCharSeq("The fox jumps over the lazy dog.",
- replace(sub, "The ${unknown.animal.${unknown.species:-1}:-fox} " + "jumps over the ${unknow.target:-lazy dog}."));
+ replace(sub, "The ${unknown.animal.${unknown.species:-1}:-fox} jumps over the ${unknow.target:-lazy dog}."));
}
/**
@@ -1031,7 +1031,7 @@ void testStaticReplaceSystemProperties() {
buf.append(", your home directory is ");
buf.append(SystemProperties.getUserHome()).append('.');
assertEqualsCharSeq(buf.toString(),
- StringSubstitutor.replaceSystemProperties("Hi ${user.name}, you are " + "working with ${os.name}, your home " + "directory is ${user.home}."));
+ StringSubstitutor.replaceSystemProperties("Hi ${user.name}, you are " + "working with ${os.name}, your home directory is ${user.home}."));
}
/**
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 179f9ff399..40290f0b75 100644
--- a/src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java
@@ -57,7 +57,7 @@ void testBadXPath() {
@Test
void testMissingXPath() {
- assertThrows(IllegalArgumentException.class, () -> XmlStringLookup.INSTANCE.apply(DOC_RELATIVE + ":" + "!JUNK!"));
+ assertThrows(IllegalArgumentException.class, () -> XmlStringLookup.INSTANCE.apply(DOC_RELATIVE + ":!JUNK!"));
}
@Test
From b6702d61a0766ea7137c1dc53833fbd67287a290 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 24 Jul 2025 12:03:45 +0000
Subject: [PATCH 054/265] Bump to next development version
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index c0e5b7e30d..775344dae0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
85commons-text
- 1.14.0
+ 1.14.1-SNAPSHOTApache Commons TextApache 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-1UTF-8
- 2025-07-20T13:34:14Z
+ 2025-07-24T12:03:40Z1.81.8text
From 88dc3c8e2504a03882d7026e6727b09b8c8a105d Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 24 Jul 2025 12:04:47 +0000
Subject: [PATCH 055/265] 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 5406a31766..89c8799a00 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 PMD UnnecessaryFullyQualifiedName in StringLookupFactory.
From a7ef60c423eaec93b068c7b7d79f9a1ce80d8dba Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 24 Jul 2025 12:23:54 +0000
Subject: [PATCH 056/265] Updates for the next release
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 775344dae0..dd280d8785 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,8 +39,8 @@
texttextorg.apache.commons.text
- 1.14.0
- 1.14.1
+ 1.14.1
+ 1.14.2(Java 8+)TEXT12318221
@@ -61,7 +61,7 @@
- 1.13.1
+ 1.14.0RC1truescm:svn:https://dist.apache.org/repos/dist/dev/commons/${commons.componentid}
From d7dbcacc8fe3e80639b118e00ed6fc93a6d0ac87 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 25 Jul 2025 16:18:01 -0400
Subject: [PATCH 057/265] Bump github/codeql-action from 3.29.2 to 3.29.4
(#682)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.2 to 3.29.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/181d5eefc20863364f96762470ba6f862bdef56b...4e828ff8d448a8a6e532957b1811f387a63867e8)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 9255621e98..73bf9d5dec 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@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
+ uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
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@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
+ uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
# âšī¸ 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@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
+ uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 4c90c9c49f..1542dc9fe1 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@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
+ uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
with:
sarif_file: results.sarif
From 3dfb2c11405a9ce47aff9b10a3b0ef63efd380a1 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 26 Jul 2025 07:40:18 -0400
Subject: [PATCH 058/265] Add macOS file to git ignore file
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 92a1b2a4a3..03ca919d66 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,4 @@ site-content
.project
.externalToolBuilders
/.checkstyle
+/.DS_Store
From b57a280f86da740d1e22b01a87f19986fe25d31b Mon Sep 17 00:00:00 2001
From: "Piotr P. Karwasz"
Date: Tue, 29 Jul 2025 19:12:47 +0200
Subject: [PATCH 059/265] feat: Add experimental CycloneDX VEX file (#683)
* feat: Add experimental CycloneDX VEX file
This commit introduces an experimental CycloneDX VEX document that:
* Provides an analysis of **CVE-2025-48924** as it pertains to this library.
* Is committed to the **Git repository only** (not published to Maven Central), allowing it to be retrieved via `raw.githubusercontent.com`.
This VEX file is intended to support consumers in evaluating the exploitability of known vulnerabilities in Apache Commons Text.
* fix: Move files and fix copy/paste problems
Moves files as suggested in apache/commons-bcel#446 and fixes copy/paste mistakes.
---
src/conf/security/README.md | 61 ++++++++++++++
src/conf/security/VEX.cyclonedx.xml | 124 ++++++++++++++++++++++++++++
2 files changed, 185 insertions(+)
create mode 100644 src/conf/security/README.md
create mode 100644 src/conf/security/VEX.cyclonedx.xml
diff --git a/src/conf/security/README.md b/src/conf/security/README.md
new file mode 100644
index 0000000000..8629f82a7a
--- /dev/null
+++ b/src/conf/security/README.md
@@ -0,0 +1,61 @@
+
+
+# CycloneDX Documents for Apache Commons Text
+
+The Apache Commons Text project publishes multiple [CycloneDX](https://cyclonedx.org/) documents to help consumers assess the security of their applications using this library:
+
+## SBOM (Software Bill of Materials)
+
+Beginning with version `6.6.0`, Apache Commons Text publishes SBOMs in both **XML** and **JSON** formats to Maven Central. These documents describe all components and dependencies of the library, following standard Maven coordinates:
+
+* **Group ID:** `org.apache.commons`
+* **Artifact ID:** `commons-text`
+* **Classifier:** `cyclonedx`
+* **Type:** `xml` or `json`
+
+Each SBOM lists the libraryâs required and optional dependencies, helping consumers analyze the software supply chain and manage dependency risk.
+
+> [!NOTE]
+> The versions listed in the SBOM reflect the dependencies used during the build and test process for that specific release of Text.
+> Your own project may use different versions depending on your dependency management configuration.
+
+## VEX (Vulnerability Exploitability eXchange)
+
+An experimental [VEX](https://cyclonedx.org/capabilities/vex/) document is also published:
+
+đ [`https://raw.githubusercontent.com/apache/commons-text/refs/heads/master/src/conf/security/VEX.cyclonedx.xml`](VEX.cyclonedx.xml)
+
+This document provides information about the **exploitability of known vulnerabilities** in the **dependencies** of Apache Commons Text.
+
+### When is a dependency vulnerability exploitable?
+
+Because Apache Commons libraries (including Text) do **not** bundle their dependencies, a vulnerability in a dependency is only exploitable if **both** of the following conditions are true:
+
+1. The vulnerable dependency is included in the consuming project.
+2. Apache Commons Text is explicitly listed as affected by the vulnerability.
+
+### Notes and Limitations
+
+* This VEX document is **experimental** and provided **as-is**.
+ The semantics of this document may change in the future.
+* The **absence** of a vulnerability entry does **not** indicate that Text is unaffected.
+* If a version of Text is not listed under the `affects` section of a vulnerability, that version may still be affected or not.
+* Only the **latest major version** of Text is currently assessed for vulnerabilities.
+* The `analysis` field in the VEX file uses **Markdown** formatting.
+
+For more information about CycloneDX, SBOMs, or VEX, visit [cyclonedx.org](https://cyclonedx.org/).
diff --git a/src/conf/security/VEX.cyclonedx.xml b/src/conf/security/VEX.cyclonedx.xml
new file mode 100644
index 0000000000..7ef177f808
--- /dev/null
+++ b/src/conf/security/VEX.cyclonedx.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+ 2025-07-29T12:26:42Z
+
+ org.apache.commons
+ commons-text
+ cpe:2.3:a:apache:commons_text:*:*:*:*:*:*:*:*
+ pkg:maven/org.apache.commons/commons-text?type=jar
+
+
+ The Apache Software Foundation
+ https://commons.apache.org
+
+ Apache Commons PMC
+ dev@commons.apache.org
+
+
+ Apache Commons Security Team
+ security@commons.apache.org
+
+
+
+
+
+
+ CVE-2025-48924
+
+
+ GHSA-j288-q9x7-2f5v
+
+ https://github.com/advisories/GHSA-j288-q9x7-2f5v
+
+
+
+
+ exploitable
+
+ update
+
+
+ CVE-2025-48924 is exploitable in Apache Commons Text versions 1.5 and later, but only when all the following conditions are met:
+
+ * The consuming project includes a vulnerable version of Commons Text on the classpath.
+ As of version `1.14.1`, Commons Text no longer references a vulnerable version of the `commons-lang3` library in its POM file.
+ * Unvalidated or unsanitized user input is passed to the `StringSubstitutor` or `StringLookup` classes.
+ * An interpolator lookup created via `StringLookupFactory.interpolatorLookup()` is used.
+
+ If these conditions are satisfied, an attacker may cause an infinite loop by submitting a specially crafted input such as `${const:...}`.
+
+ 2025-07-29T12:26:42Z
+ 2025-07-29T12:26:42Z
+
+
+
+ main_component
+
+
+
+ affected
+
+
+
+
+
+
+
+
+
+
+
+ Apache Commons PMC
+ dev@commons.apache.org
+
+
+ 2025-07-29T12:26:42Z
+
+ This document provides information about the **exploitability of known vulnerabilities** in the **dependencies** of Apache Commons Text.
+
+ # When is a dependency vulnerability exploitable?
+
+ Because Apache Commons libraries do **not** bundle their dependencies, a vulnerability in a dependency is only exploitable if **both** of the following conditions are true:
+
+ 1. The vulnerable dependency is included in the consuming project.
+ 2. Apache Commons Text is explicitly listed as affected by the vulnerability.
+
+ # Notes and Limitations
+
+ * This VEX document is **experimental** and provided **as-is**.
+ The semantics of this document may change in the future.
+ * The **absence** of a vulnerability entry does **not** indicate that Text is unaffected.
+ * If a version of Text is not listed under the `affects` section of a vulnerability, that version may still be affected or not.
+ * Only the **latest major version** of Text is currently assessed for vulnerabilities.
+ * The `analysis` field in the VEX file uses **Markdown** formatting.
+
+
+
+
From f5908a7f204002cde362920dbf3c9755077628d4 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 29 Jul 2025 13:15:22 -0400
Subject: [PATCH 060/265] Add experimental CycloneDX VEX file #683
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 89c8799a00..298f8cc60a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,6 +48,7 @@ The type attribute can be add,update,fix,remove.
+ Add experimental CycloneDX VEX file #683.
From d2f43cd822de59daab7924668ab9f0a2b7512553 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 1 Aug 2025 16:11:40 -0400
Subject: [PATCH 061/265] Bump github/codeql-action from 3.29.4 to 3.29.5
(#685)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.4 to 3.29.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/4e828ff8d448a8a6e532957b1811f387a63867e8...51f77329afa6477de8c49fc9c7046c15b9a4e79d)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.5
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 73bf9d5dec..d3aa4af0e3 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@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
+ uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
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@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
+ uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
# âšī¸ 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@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
+ uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 1542dc9fe1..68adb567af 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@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
+ uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
with:
sarif_file: results.sarif
From 8d3f4aa9eaa433774dcd6181cd69c790257d0bf6 Mon Sep 17 00:00:00 2001
From: "Piotr P. Karwasz"
Date: Mon, 4 Aug 2025 14:10:35 +0200
Subject: [PATCH 062/265] fix: Ensure unique serial number for VEX file (#686)
This update corrects the serial number in the VEX file, which was mistakenly copied from apache/commons-bcel#446. With this fix, all published VEX files will now have unique serial numbers, preventing potential conflicts or duplication.
---
src/conf/security/VEX.cyclonedx.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/security/VEX.cyclonedx.xml b/src/conf/security/VEX.cyclonedx.xml
index 7ef177f808..9c0875aa99 100644
--- a/src/conf/security/VEX.cyclonedx.xml
+++ b/src/conf/security/VEX.cyclonedx.xml
@@ -23,11 +23,11 @@
+ serialNumber="urn:uuid:9d64577b-0376-4ee7-b154-5ec26a1803f4"
+ version="2">
- 2025-07-29T12:26:42Z
+ 2025-08-04T11:45:36Zorg.apache.commonscommons-text
From c0599f43b6a84e8ae7e1cea10e082ac2657fb647 Mon Sep 17 00:00:00 2001
From: "Piotr P. Karwasz"
Date: Mon, 4 Aug 2025 14:31:22 +0200
Subject: [PATCH 063/265] fix: Replace Text -> Lang in VEX description
The vulnerability is exploitable if a vulnerable Commons Lang is present, not Commons Text.
---
src/conf/security/VEX.cyclonedx.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/security/VEX.cyclonedx.xml b/src/conf/security/VEX.cyclonedx.xml
index 9c0875aa99..dcad061f0e 100644
--- a/src/conf/security/VEX.cyclonedx.xml
+++ b/src/conf/security/VEX.cyclonedx.xml
@@ -67,7 +67,7 @@
CVE-2025-48924 is exploitable in Apache Commons Text versions 1.5 and later, but only when all the following conditions are met:
- * The consuming project includes a vulnerable version of Commons Text on the classpath.
+ * The consuming project includes a vulnerable version of Commons Lang on the classpath.
As of version `1.14.1`, Commons Text no longer references a vulnerable version of the `commons-lang3` library in its POM file.
* Unvalidated or unsanitized user input is passed to the `StringSubstitutor` or `StringLookup` classes.
* An interpolator lookup created via `StringLookupFactory.interpolatorLookup()` is used.
From 87b9da4c80d234bf62d819b9cf9ad30a75bf6870 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Tue, 5 Aug 2025 09:41:38 -0400
Subject: [PATCH 064/265] Javadoc
---
.../org/apache/commons/text/translate/LookupTranslator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 005e36e446..e9d5d40645 100644
--- a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
@@ -43,7 +43,7 @@ public class LookupTranslator extends CharSequenceTranslator {
/**
* Constructs the lookup table to be used in translation.
*
- * Note that, as of Lang 3.1 (the origin of this code), the key to the lookup table is converted to a java.lang.String. This is because we need the key to
+ * Note that, as of Lang 3.1 (the origin of this code), the key to the lookup table is converted to a {@link String}. This is because we need the key to
* support hashCode and equals(Object), allowing it to be the key for a HashMap. See LANG-882.
*
* @param lookupMap Map<CharSequence, CharSequence> table of translator mappings, may not be null.
From 96c6382c2d2e28db5c54284ad566d8227a8bf86b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 8 Aug 2025 17:00:13 -0400
Subject: [PATCH 065/265] Bump github/codeql-action from 3.29.7 to 3.29.8
(#688)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.7 to 3.29.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/51f77329afa6477de8c49fc9c7046c15b9a4e79d...76621b61decf072c1cee8dd1ce2d2a82d33c17ed)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.8
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 d3aa4af0e3..6049e1d240 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@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
+ uses: github/codeql-action/init@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
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@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
+ uses: github/codeql-action/autobuild@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
# âšī¸ 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@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
+ uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 68adb567af..387ec70f93 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@51f77329afa6477de8c49fc9c7046c15b9a4e79d # 3.29.5
+ uses: github/codeql-action/upload-sarif@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
with:
sarif_file: results.sarif
From abc4a103d4b1521da480e08fa2c3b29d909b3b5e Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 8 Aug 2025 17:00:26 -0400
Subject: [PATCH 066/265] Bump actions/cache from 4.2.3 to 4.2.4 (#689)
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.3 to 4.2.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/5a3ec84eff668545956fd18022155c47e93e2684...0400d5f644dc74513175e3cd8d07132dd4860809)
---
updated-dependencies:
- dependency-name: actions/cache
dependency-version: 4.2.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 6049e1d240..f7a3c7484f 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
+ - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
From 1c09035f232480c9920bb90a31b0a644c5165351 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 15 Aug 2025 17:04:23 -0400
Subject: [PATCH 067/265] Bump actions/checkout from 4.2.2 to 5.0.0 (#691)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/11bd71901bbe5b1630ceea73d27597364c9af683...08c6903cd8c0fde910a37f88322edcfb5dd907a8)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: 5.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 f7a3c7484f..4e90507a7c 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 33573cf948..e8d1ed6781 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review PR'
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index d182b41b99..c1f9fb58dc 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -34,7 +34,7 @@ jobs:
experimental: true
steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
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 387ec70f93..bf2796af74 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
From a7cbd846db5e7aa0e6ea8d4caa0e154e40ad3796 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 15 Aug 2025 17:04:37 -0400
Subject: [PATCH 068/265] Bump github/codeql-action from 3.29.8 to 3.29.9
(#690)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.8 to 3.29.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/76621b61decf072c1cee8dd1ce2d2a82d33c17ed...df559355d593797519d70b90fc8edd5db049e7a2)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.9
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 4e90507a7c..b6654adaf0 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@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
+ uses: github/codeql-action/init@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
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@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
+ uses: github/codeql-action/autobuild@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
# âšī¸ 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@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
+ uses: github/codeql-action/analyze@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index bf2796af74..fe4221817d 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@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # 3.29.5
+ uses: github/codeql-action/upload-sarif@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
with:
sarif_file: results.sarif
From bbcc1e7a326e696e79efbdad2d35557f89ba5a2f Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Wed, 20 Aug 2025 06:57:30 -0400
Subject: [PATCH 069/265] Javadoc
---
.../commons/text/TextStringBuilder.java | 2 +-
.../commons/text/numbers/DoubleFormat.java | 32 +++++++++----------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 939ce1eaf1..1f194220fe 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -3019,7 +3019,7 @@ public TextStringBuilder setLength(final int length) {
* Sets the text to be appended when {@link #appendNewLine() new line} is called.
*
* @param newLine the new line text, {@code null} means use the system default from {@link System#lineSeparator()}.
- * @return this instance.
+ * @return {@code this} instance.
*/
public TextStringBuilder setNewLineText(final String newLine) {
this.newLine = newLine;
diff --git a/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java b/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
index 74e1713894..1ad97d5fd3 100644
--- a/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
+++ b/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
@@ -424,7 +424,7 @@ private Builder(final Function> factory) {
*
* @param signedZero if {@code true}, the zero string may be returned with a preceding minus sign; if {@code false}, the zero string will only be
* returned in its positive form
- * @return this instance
+ * @return {@code this} instance
*/
public Builder allowSignedZero(final boolean signedZero) {
this.signedZero = signedZero;
@@ -437,7 +437,7 @@ public Builder allowSignedZero(final boolean signedZero) {
* ENGINEERING}, and {@link DoubleFormat#MIXED MIXED}. The default value is {@code false}.
*
* @param alwaysIncludeExponent if {@code true}, exponents will always be included in formatted output even if the exponent value is zero
- * @return this instance
+ * @return {@code this} instance
*/
public Builder alwaysIncludeExponent(final boolean alwaysIncludeExponent) {
this.alwaysIncludeExponent = alwaysIncludeExponent;
@@ -460,7 +460,7 @@ public DoubleFunction build() {
* default value is {@code '.'}.
*
* @param decimalSeparator decimal separator character
- * @return this instance
+ * @return {@code this} instance
*/
public Builder decimalSeparator(final char decimalSeparator) {
this.decimalSeparator = decimalSeparator;
@@ -471,7 +471,7 @@ public Builder decimalSeparator(final char decimalSeparator) {
* Sets the string containing the digit characters 0-9, in that order. The default value is the string {@code "0123456789"}.
*
* @param digits string containing the digit characters 0-9
- * @return this instance
+ * @return {@code this} instance
* @throws NullPointerException if the argument is {@code null}
* @throws IllegalArgumentException if the argument does not have a length of exactly 10
*/
@@ -490,7 +490,7 @@ public Builder digits(final String digits) {
* {@code "1.2E6"}.
*
* @param exponentSeparator exponent separator string
- * @return this instance
+ * @return {@code this} instance
* @throws NullPointerException if the argument is {@code null}
*/
public Builder exponentSeparator(final String exponentSeparator) {
@@ -513,7 +513,7 @@ public Builder exponentSeparator(final String exponentSeparator) {
* consecutive characters.
*
* @param symbols format symbols
- * @return this instance
+ * @return {@code this} instance
* @throws NullPointerException if the argument is {@code null}
*/
public Builder formatSymbols(final DecimalFormatSymbols symbols) {
@@ -537,7 +537,7 @@ public DoubleFunction get() {
* Sets the character used to separate groups of thousands. Default value is {@code ','}.
*
* @param groupingSeparator character used to separate groups of thousands
- * @return this instance
+ * @return {@code this} instance
* @see #groupThousands(boolean)
*/
public Builder groupingSeparator(final char groupingSeparator) {
@@ -551,7 +551,7 @@ public Builder groupingSeparator(final char groupingSeparator) {
* value is {@code false}.
*
* @param groupThousands if {@code true}, thousands will be grouped
- * @return this instance
+ * @return {@code this} instance
* @see #groupingSeparator(char)
*/
public Builder groupThousands(final boolean groupThousands) {
@@ -566,7 +566,7 @@ public Builder groupThousands(final boolean groupThousands) {
*
* @param fractionPlaceholder if {@code true}, a zero character is placed in the fraction position when no fractional value is present; if
* {@code false}, fractional digits are only included when needed
- * @return this instance
+ * @return {@code this} instance
*/
public Builder includeFractionPlaceholder(final boolean fractionPlaceholder) {
this.fractionPlaceholder = fractionPlaceholder;
@@ -577,7 +577,7 @@ public Builder includeFractionPlaceholder(final boolean fractionPlaceholder) {
* Sets the string used to represent infinity. For negative infinity, this string is prefixed with the {@link #minusSign(char) minus sign}.
*
* @param infinity string used to represent infinity
- * @return this instance
+ * @return {@code this} instance
* @throws NullPointerException if the argument is {@code null}
*/
public Builder infinity(final String infinity) {
@@ -590,7 +590,7 @@ public Builder infinity(final String infinity) {
* {@code 0}.
*
* @param maxPrecision maximum precision
- * @return this instance
+ * @return {@code this} instance
*/
public Builder maxPrecision(final int maxPrecision) {
this.maxPrecision = maxPrecision;
@@ -604,7 +604,7 @@ public Builder maxPrecision(final int maxPrecision) {
* {@code 0.001} is formatted, then the result is the zero string.
*
* @param minDecimalExponent minimum decimal exponent
- * @return this instance
+ * @return {@code this} instance
*/
public Builder minDecimalExponent(final int minDecimalExponent) {
this.minDecimalExponent = minDecimalExponent;
@@ -615,7 +615,7 @@ public Builder minDecimalExponent(final int minDecimalExponent) {
* Sets the character used as the minus sign.
*
* @param minusSign character to use as the minus sign
- * @return this instance
+ * @return {@code this} instance
*/
public Builder minusSign(final char minusSign) {
this.minusSign = minusSign;
@@ -626,7 +626,7 @@ public Builder minusSign(final char minusSign) {
* Sets the string used to represent {@link Double#NaN}.
*
* @param nan string used to represent {@link Double#NaN}
- * @return this instance
+ * @return {@code this} instance
* @throws NullPointerException if the argument is {@code null}
*/
public Builder nan(final String nan) {
@@ -649,7 +649,7 @@ public Builder nan(final String nan) {
*
* @param plainFormatMaxDecimalExponent maximum decimal exponent for values formatted as plain strings when using the {@link DoubleFormat#MIXED MIXED}
* format type.
- * @return this instance
+ * @return {@code this} instance
* @see #plainFormatMinDecimalExponent(int)
*/
public Builder plainFormatMaxDecimalExponent(final int plainFormatMaxDecimalExponent) {
@@ -672,7 +672,7 @@ public Builder plainFormatMaxDecimalExponent(final int plainFormatMaxDecimalExpo
*
* @param plainFormatMinDecimalExponent maximum decimal exponent for values formatted as plain strings when using the {@link DoubleFormat#MIXED MIXED}
* format type.
- * @return this instance
+ * @return {@code this} instance
* @see #plainFormatMinDecimalExponent(int)
*/
public Builder plainFormatMinDecimalExponent(final int plainFormatMinDecimalExponent) {
From a2d2157859c1d470703dc363c391a2dd569f05d1 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 17:45:13 -0400
Subject: [PATCH 070/265] Bump actions/setup-java from 4.7.1 to 5.0.0 (#692)
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 4.7.1 to 5.0.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/c5195efecf7bdfc987ee8bae7a71cb8b11521c00...dded0888837ed1f317902acf8a20df0ad188d165)
---
updated-dependencies:
- dependency-name: actions/setup-java
dependency-version: 5.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 c1f9fb58dc..4890f722c4 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@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
From beae6a921ae6511fc96cf0a27d5063a172b331fb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 17:45:28 -0400
Subject: [PATCH 071/265] Bump actions/dependency-review-action from 4.7.1 to
4.7.2 (#693)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.7.1 to 4.7.2.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/da24556b548a50705dd671f47852072ea4c105d9...bc41886e18ea39df68b1b1245f4184881938e050)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-version: 4.7.2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index e8d1ed6781..daed9687ff 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,4 +28,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
+ uses: actions/dependency-review-action@bc41886e18ea39df68b1b1245f4184881938e050 # v4.7.2
From 370a99be2bfb690b5bd25919c4e4243842ff5dbd Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 17:45:43 -0400
Subject: [PATCH 072/265] Bump github/codeql-action from 3.29.9 to 3.29.11
(#694)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.9 to 3.29.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/df559355d593797519d70b90fc8edd5db049e7a2...3c3833e0f8c1c83d449a7478aa59c036a9165498)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.11
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 b6654adaf0..36b2f321b5 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@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
+ uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
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@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
+ uses: github/codeql-action/autobuild@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
# âšī¸ 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@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
+ uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index fe4221817d..f5ac42eaa8 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@df559355d593797519d70b90fc8edd5db049e7a2 # 3.29.5
+ uses: github/codeql-action/upload-sarif@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
with:
sarif_file: results.sarif
From c5a9bb5f51a27f625c73e40f3e18b4c8d916ad6c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 20:49:17 -0400
Subject: [PATCH 073/265] Bump commons.bytebuddy.version from 1.17.6 to 1.17.7
(#696)
Bumps `commons.bytebuddy.version` from 1.17.6 to 1.17.7.
Updates `net.bytebuddy:byte-buddy` from 1.17.6 to 1.17.7
- [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.17.6...byte-buddy-1.17.7)
Updates `net.bytebuddy:byte-buddy-agent` from 1.17.6 to 1.17.7
- [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.17.6...byte-buddy-1.17.7)
---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
dependency-version: 1.17.7
dependency-type: direct:development
update-type: version-update:semver-patch
- dependency-name: net.bytebuddy:byte-buddy-agent
dependency-version: 1.17.7
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 dd280d8785..2e950031eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,7 @@
https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-textsite-content3.18.0
- 1.17.6
+ 1.17.71.6false1.37
From ee2243e0d07e112c4439daded46ebb4d65901c44 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 22 Aug 2025 20:50:52 -0400
Subject: [PATCH 074/265] Bump commons.bytebuddy.version from 1.17.6 to 1.17.7
#696
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 298f8cc60a..fafac5dfc9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.
+ Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.
@@ -63,7 +64,6 @@ The type attribute can be add,update,fix,remove.
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.
From 80b12daa94162ee828f3e450dc0f431a0bb1888e Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 24 Aug 2025 16:19:21 -0400
Subject: [PATCH 075/265] Account for false positives only seen on GH CI
---
src/conf/spotbugs-exclude-filter.xml | 13 +++---
.../commons/text/ExtendedMessageFormat.java | 42 +++++++------------
2 files changed, 21 insertions(+), 34 deletions(-)
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index 2656019b49..d918d9f0f8 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -19,38 +19,39 @@
xmlns="https://github.com/spotbugs/filter/3.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
-
-
+
+
+
+
+
+
+
-
-
-
-
diff --git a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java
index 5cc88e3c22..e955490089 100644
--- a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java
+++ b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java
@@ -135,18 +135,14 @@ public ExtendedMessageFormat(final String pattern, final Locale locale) {
* Constructs a new ExtendedMessageFormat.
*
* @param pattern the pattern to use, not null
- * @param locale the locale to use, not null
- * @param registry the registry of format factories, may be null
+ * @param locale the locale to use, not null
+ * @param registry the registry of format factories, may be null
* @throws IllegalArgumentException in case of a bad pattern.
*/
- public ExtendedMessageFormat(final String pattern,
- final Locale locale,
- final Map registry) {
+ public ExtendedMessageFormat(final String pattern, final Locale locale, final Map registry) {
super(EMPTY_PATTERN);
setLocale(locale);
- this.registry = registry != null
- ? Collections.unmodifiableMap(new HashMap<>(registry))
- : null;
+ this.registry = registry != null ? Collections.unmodifiableMap(new HashMap<>(registry)) : null;
applyPattern(pattern);
}
@@ -154,33 +150,27 @@ public ExtendedMessageFormat(final String pattern,
* Constructs a new ExtendedMessageFormat for the default locale.
*
* @param pattern the pattern to use, not null
- * @param registry the registry of format factories, may be null
+ * @param registry the registry of format factories, may be null
* @throws IllegalArgumentException in case of a bad pattern.
*/
- public ExtendedMessageFormat(final String pattern,
- final Map registry) {
+ public ExtendedMessageFormat(final String pattern, final Map registry) {
this(pattern, Locale.getDefault(Category.FORMAT), registry);
}
/**
- * Consumes a quoted string, adding it to {@code appendTo} if
- * specified.
+ * Consumes a quoted string, adding it to {@code appendTo} if specified.
*
- * @param pattern pattern to parse
- * @param pos current parse position
+ * @param pattern pattern to parse
+ * @param pos current parse position
* @param appendTo optional StringBuilder to append
*/
- private void appendQuotedString(final String pattern, final ParsePosition pos,
- final StringBuilder appendTo) {
- assert pattern.toCharArray()[pos.getIndex()] == QUOTE
- : "Quoted string must start with quote character";
-
+ private void appendQuotedString(final String pattern, final ParsePosition pos, final StringBuilder appendTo) {
+ assert pattern.toCharArray()[pos.getIndex()] == QUOTE : "Quoted string must start with quote character";
// handle quote character at the beginning of the string
if (appendTo != null) {
appendTo.append(QUOTE);
}
next(pos);
-
final int start = pos.getIndex();
final char[] c = pattern.toCharArray();
for (int i = pos.getIndex(); i < pattern.length(); i++) {
@@ -195,8 +185,7 @@ private void appendQuotedString(final String pattern, final ParsePosition pos,
next(pos);
}
}
- throw new IllegalArgumentException(
- "Unterminated quoted string at position " + start);
+ throw new IllegalArgumentException("Unterminated quoted string at position " + start);
}
/**
@@ -214,7 +203,6 @@ public final void applyPattern(final String pattern) {
final ArrayList foundFormats = new ArrayList<>();
final ArrayList foundDescriptions = new ArrayList<>();
final StringBuilder stripCustom = new StringBuilder(pattern.length());
-
final ParsePosition pos = new ParsePosition(0);
final char[] c = pattern.toCharArray();
int fmtCount = 0;
@@ -233,8 +221,7 @@ public final void applyPattern(final String pattern) {
Format format = null;
String formatDescription = null;
if (c[pos.getIndex()] == START_FMT) {
- formatDescription = parseFormatDescription(pattern,
- next(pos));
+ formatDescription = parseFormatDescription(pattern, next(pos));
format = getFormat(formatDescription);
if (format == null) {
stripCustom.append(START_FMT).append(formatDescription);
@@ -249,8 +236,7 @@ public final void applyPattern(final String pattern) {
throw new IllegalArgumentException("The validated expression is false");
}
if (c[pos.getIndex()] != END_FE) {
- throw new IllegalArgumentException(
- "Unreadable format element at position " + start);
+ throw new IllegalArgumentException("Unreadable format element at position " + start);
}
//$FALL-THROUGH$
default:
From fcda003b17094384fdda579a59ea59becf200036 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 24 Aug 2025 16:20:08 -0400
Subject: [PATCH 076/265] Bump org.apache.commons:commons-parent from 85 to 87
---
pom.xml | 2 +-
src/changes/changes.xml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 2e950031eb..8c9b18d74a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.apache.commonscommons-parent
- 85
+ 87commons-text1.14.1-SNAPSHOT
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fafac5dfc9..66826b5844 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.
+ Bump org.apache.commons:commons-parent from 85 to 87.
From 79252937b136534d608258acab8ad883696ff5a5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Thu, 28 Aug 2025 10:04:50 -0400
Subject: [PATCH 077/265] Fix exception message typo in
XmlStringLookup.XmlStringLookup(Map, Path...)
---
src/changes/changes.xml | 1 +
.../java/org/apache/commons/text/lookup/XmlStringLookup.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 66826b5844..df97b651b1 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,6 +47,7 @@ The type attribute can be add,update,fix,remove.
+ Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...).Add experimental CycloneDX VEX file #683.
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 a476cc0786..0f3663fd45 100644
--- a/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java
@@ -72,7 +72,7 @@ final class XmlStringLookup extends AbstractPathFencedLookup {
*/
XmlStringLookup(final Map xPathFactoryFeatures, final Path... fences) {
super(fences);
- this.xPathFactoryFeatures = Objects.requireNonNull(xPathFactoryFeatures, "xPathFfactoryFeatures");
+ this.xPathFactoryFeatures = Objects.requireNonNull(xPathFactoryFeatures, "xPathFactoryFeatures");
}
/**
From ff23055f79609ba9c049446d051bc4f110a8722f Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Fri, 29 Aug 2025 08:35:54 -0400
Subject: [PATCH 078/265] Javadoc
---
.../apache/commons/text/lookup/BiFunctionStringLookup.java | 4 ++++
.../org/apache/commons/text/lookup/ConstantStringLookup.java | 4 ++++
.../org/apache/commons/text/lookup/DateStringLookup.java | 5 +++++
.../java/org/apache/commons/text/lookup/DnsStringLookup.java | 4 ++++
.../org/apache/commons/text/lookup/FileStringLookup.java | 4 ++++
.../org/apache/commons/text/lookup/FunctionStringLookup.java | 4 ++++
.../java/org/apache/commons/text/lookup/InetAddressKeys.java | 4 ++++
.../apache/commons/text/lookup/InetAddressStringLookup.java | 4 ++++
.../apache/commons/text/lookup/InterpolatorStringLookup.java | 5 +++++
.../apache/commons/text/lookup/JavaPlatformStringLookup.java | 4 ++++
.../apache/commons/text/lookup/PropertiesStringLookup.java | 4 ++++
.../commons/text/lookup/ResourceBundleStringLookup.java | 4 ++++
.../org/apache/commons/text/lookup/ScriptStringLookup.java | 4 ++++
.../apache/commons/text/lookup/UrlDecoderStringLookup.java | 4 ++++
.../apache/commons/text/lookup/UrlEncoderStringLookup.java | 5 +++++
.../java/org/apache/commons/text/lookup/UrlStringLookup.java | 5 +++++
.../apache/commons/text/lookup/XmlDecoderStringLookup.java | 5 +++++
.../apache/commons/text/lookup/XmlEncoderStringLookup.java | 5 +++++
.../java/org/apache/commons/text/lookup/XmlStringLookup.java | 2 +-
19 files changed, 79 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/text/lookup/BiFunctionStringLookup.java b/src/main/java/org/apache/commons/text/lookup/BiFunctionStringLookup.java
index 9e1891a5a9..336d429372 100644
--- a/src/main/java/org/apache/commons/text/lookup/BiFunctionStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/BiFunctionStringLookup.java
@@ -22,9 +22,13 @@
/**
* A function-based lookup where the request for a lookup is answered by applying that function with a key.
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
*
* @param A function's return type
* @param
A function's second input type
+ * @see StringLookupFactory
* @since 1.9
*/
final class BiFunctionStringLookup
* The above example converts {@code "UTF-8:SomePath"} to the UTF-8 contents of the file at {@code SomePath}.
*
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
*
+ * @see StringLookupFactory
* @since 1.5
*/
final class FileStringLookup extends AbstractPathFencedLookup {
diff --git a/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java b/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
index 4a7123ea9b..07df1489ea 100644
--- a/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/FunctionStringLookup.java
@@ -22,8 +22,12 @@
/**
* A function-based lookup where the request for a lookup is answered by applying that function with a key.
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
*
* @param A function's input type
+ * @see StringLookupFactory
* @since 1.9
*/
final class FunctionStringLookup extends AbstractStringLookup {
diff --git a/src/main/java/org/apache/commons/text/lookup/InetAddressKeys.java b/src/main/java/org/apache/commons/text/lookup/InetAddressKeys.java
index a188d4fd58..e7eee0136b 100644
--- a/src/main/java/org/apache/commons/text/lookup/InetAddressKeys.java
+++ b/src/main/java/org/apache/commons/text/lookup/InetAddressKeys.java
@@ -21,7 +21,11 @@
/**
* Constants for referring to {@link InetAddress} APIs.
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
*
+ * @see StringLookupFactory
* @since 1.8
*/
final class InetAddressKeys {
diff --git a/src/main/java/org/apache/commons/text/lookup/InetAddressStringLookup.java b/src/main/java/org/apache/commons/text/lookup/InetAddressStringLookup.java
index 346634cdcb..6d0183db9c 100644
--- a/src/main/java/org/apache/commons/text/lookup/InetAddressStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/InetAddressStringLookup.java
@@ -35,7 +35,11 @@
*
canonical-name: for the local canonical host name, for example {@code EXAMPLE.apache.org}.
*
address: for the local host address, for example {@code 192.168.56.1}.
*
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
* Uses the {@link StringLookupFactory default lookups}.
*
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
+ *
+ * @see StringLookupFactory
*/
final class InterpolatorStringLookup extends AbstractStringLookup {
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 da1048bbe6..734e2dd436 100644
--- a/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/JavaPlatformStringLookup.java
@@ -53,7 +53,11 @@
* The above examples convert {@code "version"} to the current VM version, for example,
* {@code "Java version 1.8.0_181"}.
*
+ *
+ * Public access is through {@link StringLookupFactory}.
+ *
- * The above examples convert {@code "HelloWorld!"} to {@code "SGVsbG9Xb3JsZCE="}.
+ * The examples above convert {@code "HelloWorld!"} to {@code "SGVsbG9Xb3JsZCE="}.
*
* Defines the singleton for this class.
*/
@@ -438,7 +438,7 @@ Map getDefaultStringLookups() {
* StringSubstitutor.createInterpolator().replace("... ${env:USER} ..."));
*
*
- * The above examples convert (on Linux) {@code "USER"} to the current user name. On Windows 10, you would use {@code "USERNAME"} to the same effect.
+ * The examples above convert (on Linux) {@code "USER"} to the current user name. On Windows 10, you would use {@code "USERNAME"} to the same effect.
*
- * The above examples convert {@code "yyyy-MM-dd"} to todays's date, for example, {@code "2019-08-04"}.
+ * The examples above convert {@code "yyyy-MM-dd"} to todays's date, for example, {@code "2019-08-04"}.
*
*
* @return The DateStringLookup singleton instance.
@@ -856,7 +856,7 @@ public StringLookup dateStringLookup() {
* new StringSubstitutor(variableResolver).replace("... ${dns:address|apache.org} ...");
*
*
- * The above examples convert {@code "address|apache.org"} to the IP address of {@code apache.org}.
+ * The examples above convert {@code "address|apache.org"} to the IP address of {@code apache.org}.
*
- * The above examples convert (on Linux) {@code "USER"} to the current user name. On Windows 10, you would use {@code "USERNAME"} to the same effect.
+ * The examples above convert (on Linux) {@code "USER"} to the current user name. On Windows 10, you would use {@code "USERNAME"} to the same effect.
*
- * The above examples convert {@code "UTF-8:com/domain/document.txt"} to the contents of the file.
+ * The examples above convert {@code "UTF-8:com/domain/document.txt"} to the contents of the file.
*
*
* @return a file StringLookup instance.
@@ -1017,7 +1017,7 @@ public StringLookup functionStringLookup(final Function function)
* StringSubstitutor.createInterpolator().replace("... ${sys:os.name}, ${env:USER} ..."));
*
*
- * The above examples convert {@code "${sys:os.name}, ${env:USER}"} to the OS name and Linux user name.
+ * The examples above convert {@code "${sys:os.name}, ${env:USER}"} to the OS name and Linux user name.
*
- * The above examples convert {@code "version"} to the current VM version, for example, {@code "Java version 1.8.0_181"}.
+ * The examples above convert {@code "version"} to the current VM version, for example, {@code "Java version 1.8.0_181"}.
*
- * The above examples convert {@code "canonical-name"} to the current host name, for example, {@code "EXAMPLE.apache.org"}.
+ * The examples above convert {@code "canonical-name"} to the current host name, for example, {@code "EXAMPLE.apache.org"}.
*
- * The above examples convert {@code "canonical-name"} to the current host name, for example, {@code "EXAMPLE.apache.org"}.
+ * The examples above convert {@code "canonical-name"} to the current host name, for example, {@code "EXAMPLE.apache.org"}.
*
*
* @return The InetAddressStringLookup singleton instance.
@@ -1195,13 +1195,13 @@ public StringLookup nullStringLookup() {
* if a lookup causes causes a path to resolve outside of these fences. Otherwise, the result is unfenced to preserved behavior from previous versions.
*
*
- * We looks up a value for the key in the format "DocumentPath::MyKey".
+ * We looks up a value for the key in the format {@code "DocumentPath::MyKey"}.
*
*
* Note the use of "::" instead of ":" to allow for "C:" drive letters in paths.
*
*
- * For example: "com/domain/document.properties::MyKey".
+ * For example: {@code "com/domain/document.properties::MyKey"}.
*
- * The above examples convert {@code "com/domain/document.properties::MyKey"} to the key value in the properties file at the path
- * "com/domain/document.properties".
+ * The examples above convert {@code "com/domain/document.properties::MyKey"} to the key value in the properties file at the path
+ * {@code "com/domain/document.properties"}.
*
- * The above examples convert {@code "com.domain.messages:MyKey"} to the key value in the resource bundle at {@code "com.domain.messages"}.
+ * The examples above convert {@code "com.domain.messages:MyKey"} to the key value in the resource bundle at {@code "com.domain.messages"}.
*
*
* @return The ResourceBundleStringLookup singleton instance.
@@ -1392,7 +1392,7 @@ public StringLookup resourceBundleStringLookup(final String bundleName) {
* String value = new StringSubstitutor(variableResolver).replace("${script:javascript:3 + 4}");
*
*
- * The above examples convert {@code "javascript:3 + 4"} to {@code "7"}.
+ * The examples above convert {@code "javascript:3 + 4"} to {@code "7"}.
*
- * The above examples convert {@code "os.name"} to the operating system name.
+ * The examples above convert {@code "os.name"} to the operating system name.
*
- * The above examples convert {@code "Hello World!"} to {@code "Hello%20World%21"}.
+ * The examples above convert {@code "Hello World!"} to {@code "Hello%20World%21"}.
*
*
* @return The UrlStringLookup singleton instance.
@@ -1528,7 +1528,7 @@ public StringLookup urlEncoderStringLookup() {
* String value = new StringSubstitutor(variableResolver).replace("${url:UTF-8:https://www.apache.org}");
*
*
- * The above examples convert {@code "UTF-8:https://www.apache.org"} to the contents of that page.
+ * The examples above convert {@code "UTF-8:https://www.apache.org"} to the contents of that page.
*
- * The above examples convert {@code "com/domain/document.xml:/path/to/node"} to the value of the XPath in the XML document.
+ * The examples above convert {@code "com/domain/document.xml:/path/to/node"} to the value of the XPath in the XML document.
*
*
* @return An XML StringLookup instance.
@@ -1648,10 +1648,10 @@ public StringLookup xmlStringLookup() {
* if a lookup causes causes a path to resolve outside of these fences. Otherwise, the result is unfenced to preserved behavior from previous versions.
*
*
- * We look up the value for the key in the format "DocumentPath:XPath".
+ * We look up the value for the key in the format {@code "DocumentPath:XPath"}.
*
*
- * For example: "com/domain/document.xml:/path/to/node".
+ * For example: {@code "com/domain/document.xml:/path/to/node"}.
*
*
* Using a {@link StringLookup} from the {@link StringLookupFactory}:
@@ -1668,7 +1668,7 @@ public StringLookup xmlStringLookup() {
* StringSubstitutor.createInterpolator().replace("... ${xml:com/domain/document.xml:/path/to/node} ..."));
*
*
- * The above examples convert {@code "com/domain/document.xml:/path/to/node"} to the value of the XPath in the XML document.
+ * The examples above convert {@code "com/domain/document.xml:/path/to/node"} to the value of the XPath in the XML document.
*
*
* @param xPathFactoryFeatures XPathFactory features to set.
@@ -1687,10 +1687,10 @@ public StringLookup xmlStringLookup(final Map xPathFactoryFeatu
* if a lookup causes causes a path to resolve outside of these fences. Otherwise, the result is unfenced to preserved behavior from previous versions.
*
*
- * We look up the value for the key in the format "DocumentPath:XPath".
+ * We look up the value for the key in the format {@code "DocumentPath:XPath"}.
*
*
- * For example: "com/domain/document.xml:/path/to/node".
+ * For example: {@code "com/domain/document.xml:/path/to/node"}.
*
*
* Using a {@link StringLookup} from the {@link StringLookupFactory} fenced by the current directory ({@code Paths.get("")}):
@@ -1713,7 +1713,7 @@ public StringLookup xmlStringLookup(final Map xPathFactoryFeatu
* StringLookupFactory.INSTANCE.xmlStringLookup(Paths.get("")).lookup("../com/domain/document.xml:/path/to/node");
*
*
- * The above examples convert {@code "com/domain/document.xml:/path/to/node"} to the value of the XPath in the XML document.
+ * The examples above convert {@code "com/domain/document.xml:/path/to/node"} to the value of the XPath in the XML document.
*
*
* {@link StringSubstitutor} methods like {@link StringSubstitutor#replace(String)} will throw a {@link IllegalArgumentException} when a file doesn't
From 3e883ed1d3fff96db53480c2d351a6655de1dae7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 29 Aug 2025 16:11:13 -0400
Subject: [PATCH 080/265] Bump actions/dependency-review-action from 4.7.2 to
4.7.3 (#698)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.7.2 to 4.7.3.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/bc41886e18ea39df68b1b1245f4184881938e050...595b5aeba73380359d98a5e087f648dbb0edce1b)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-version: 4.7.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index daed9687ff..1e04392423 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,4 +28,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@bc41886e18ea39df68b1b1245f4184881938e050 # v4.7.2
+ uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3
From 5ba7929668286593db244bf888e4c94b53d41b21 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 30 Aug 2025 13:29:59 -0400
Subject: [PATCH 081/265] Remove trailing whitespace
---
src/conf/spotbugs-exclude-filter.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index d918d9f0f8..546e6193a4 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -63,14 +63,14 @@
-
+
-
-
+
+
-
+
From 53cf6ece273622821c5aa13444800ba94a69be55 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 30 Aug 2025 13:34:54 -0400
Subject: [PATCH 082/265] [TEXT-236] Inserting at end of a TextStringBuilder
throws a StringIndexOutOfBoundsException
---
src/changes/changes.xml | 1 +
src/conf/spotbugs-exclude-filter.xml | 6 +++
.../commons/text/TextStringBuilder.java | 14 +++---
.../TextStringBuilderAppendInsertTest.java | 46 +++++++++++++++++++
4 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index df97b651b1..362314fa01 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,6 +48,7 @@ The type attribute can be add,update,fix,remove.
Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...).
+ Inserting at end of a TextStringBuilder throws a StringIndexOutOfBoundsException.Add experimental CycloneDX VEX file #683.
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index 546e6193a4..c2b01f6b36 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -73,4 +73,10 @@
+
+
+
+
+
+
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 1f194220fe..503bb0567f 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -2190,7 +2190,7 @@ public int indexOf(final StringMatcher matcher, int startIndex) {
* @throws IndexOutOfBoundsException if the index is invalid
*/
public TextStringBuilder insert(final int index, final boolean value) {
- validateIndex(index);
+ validateRange(index, size);
if (value) {
ensureCapacityInternal(size + TRUE_STRING_SIZE);
System.arraycopy(buffer, index, buffer, index + TRUE_STRING_SIZE, size - index);
@@ -2212,7 +2212,7 @@ public TextStringBuilder insert(final int index, final boolean value) {
* @throws IndexOutOfBoundsException if the index is invalid
*/
public TextStringBuilder insert(final int index, final char value) {
- validateIndex(index);
+ validateRange(index, size);
ensureCapacityInternal(size + 1);
System.arraycopy(buffer, index, buffer, index + 1, size - index);
buffer[index] = value;
@@ -2229,7 +2229,7 @@ public TextStringBuilder insert(final int index, final char value) {
* @throws IndexOutOfBoundsException if the index is invalid
*/
public TextStringBuilder insert(final int index, final char[] chars) {
- validateIndex(index);
+ validateRange(index, size);
if (chars == null) {
return insert(index, nullText);
}
@@ -2254,7 +2254,7 @@ public TextStringBuilder insert(final int index, final char[] chars) {
* @throws IndexOutOfBoundsException if any index is invalid
*/
public TextStringBuilder insert(final int index, final char[] chars, final int offset, final int length) {
- validateIndex(index);
+ validateRange(index, size);
if (chars == null) {
return insert(index, nullText);
}
@@ -2346,7 +2346,7 @@ public TextStringBuilder insert(final int index, final Object obj) {
* @throws IndexOutOfBoundsException if the index is invalid
*/
public TextStringBuilder insert(final int index, String str) {
- validateIndex(index);
+ validateRange(index, size);
if (str == null) {
str = nullText;
}
@@ -3208,10 +3208,10 @@ public TextStringBuilder trim() {
}
/**
- * Validates that an index is in the range {@code 0 <= index <= size}.
+ * Validates that an index is in the range {@code 0 <= index < size}.
*
* @param index the index to test.
- * @throws IndexOutOfBoundsException Thrown when the index is not the range {@code 0 <= index <= size}.
+ * @throws IndexOutOfBoundsException Thrown when the index is not the range {@code 0 <= index < size}.
*/
protected void validateIndex(final int index) {
if (index < 0 || index >= size) {
diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderAppendInsertTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderAppendInsertTest.java
index 6d7a33c13d..51e431f57c 100644
--- a/src/test/java/org/apache/commons/text/TextStringBuilderAppendInsertTest.java
+++ b/src/test/java/org/apache/commons/text/TextStringBuilderAppendInsertTest.java
@@ -1133,6 +1133,52 @@ void testInsert() {
assertEquals("4.5barbaz", sb.toString());
}
+ @Test
+ void testInsertAtEnd() {
+ final TextStringBuilder sb = new TextStringBuilder();
+ assertEquals("", sb.toString());
+ sb.insert(0, "Hello");
+ assertEquals("Hello", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-1, "World"));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(6, "World"));
+ sb.insert(5, true);
+ assertEquals("Hellotrue", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(10, false));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-20, false));
+ sb.insert(9, 'A');
+ assertEquals("HellotrueA", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(11, 'B'));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-2, 'B'));
+ sb.insert(10, new char[] { 'B', 'C' });
+ assertEquals("HellotrueABC", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(13, new char[] { 'D', 'E' }));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-1, new char[] { 'D', 'E' }));
+ sb.insert(12, new char[] { 'D', 'E', 'F' }, 1, 1);
+ assertEquals("HellotrueABCE", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(14, new char[] { 'G', 'H', 'I' }, 1, 2));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-1, new char[] { 'G', 'H', 'I' }, 1, 1));
+ sb.insert(13, 1.2d);
+ assertEquals("HellotrueABCE1.2", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(17, 1.3d));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-1, 1.3d));
+ sb.insert(16, 1f);
+ assertEquals("HellotrueABCE1.21.0", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(20, 1.3f));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-3, 1.3f));
+ sb.insert(19, 23);
+ assertEquals("HellotrueABCE1.21.023", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(22, 20));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-5, -5));
+ sb.insert(21, 99L);
+ assertEquals("HellotrueABCE1.21.02399", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(24, 22L));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-1, -1L));
+ sb.insert(23, FOO);
+ assertEquals("HellotrueABCE1.21.02399foo", sb.toString());
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(27, FOO));
+ assertThrows(IndexOutOfBoundsException.class, () -> sb.insert(-3, FOO));
+ }
+
@Test
void testInsertWithNullText() {
final TextStringBuilder sb = new TextStringBuilder();
From ac0c6d63ca83a67e88cb0b4c0e1cb580e0ea191e Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 30 Aug 2025 13:35:27 -0400
Subject: [PATCH 083/265] [TEXT-236] Inserting at end of a TextStringBuilder
throws a StringIndexOutOfBoundsException
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 362314fa01..4366dbe10e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,7 +48,7 @@ The type attribute can be add,update,fix,remove.
Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...).
- Inserting at end of a TextStringBuilder throws a StringIndexOutOfBoundsException.
+ Inserting at end of a TextStringBuilder throws a StringIndexOutOfBoundsException.Add experimental CycloneDX VEX file #683.
From 125a97f00d275c431abafff6a38b869e272be1cb Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 30 Aug 2025 13:39:51 -0400
Subject: [PATCH 084/265] User ternary expression
---
.../java/org/apache/commons/text/TextStringBuilder.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 503bb0567f..dcf816f90e 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -1185,13 +1185,10 @@ public TextStringBuilder appendNewLine() {
/**
* Appends the text representing {@code null} to this string builder.
*
- * @return this, to enable chaining
+ * @return this, to enable chaining.
*/
public TextStringBuilder appendNull() {
- if (nullText == null) {
- return this;
- }
- return append(nullText);
+ return nullText != null ? append(nullText) : this;
}
/**
From b55435665f8c4a051f1407118bfa17ed176793b2 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 30 Aug 2025 13:41:15 -0400
Subject: [PATCH 085/265] Use Objects.toString()
---
.../org/apache/commons/text/TextStringBuilder.java | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index dcf816f90e..a7db693c2a 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -2322,16 +2322,13 @@ public TextStringBuilder insert(final int index, final long value) {
* Inserts the string representation of an object into this builder. Inserting null will use the stored null text
* value.
*
- * @param index the index to add at, must be valid
- * @param obj the object to insert
- * @return this, to enable chaining
- * @throws IndexOutOfBoundsException if the index is invalid
+ * @param index the index to add at, must be valid.
+ * @param obj the object to insert.
+ * @return this, to enable chaining.
+ * @throws IndexOutOfBoundsException if the index is invalid.
*/
public TextStringBuilder insert(final int index, final Object obj) {
- if (obj == null) {
- return insert(index, nullText);
- }
- return insert(index, obj.toString());
+ return insert(index, Objects.toString(obj, nullText));
}
/**
From 0c3cadeeda1aa01869e1d5f72c25e6176121c11e Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sat, 30 Aug 2025 14:03:06 -0400
Subject: [PATCH 086/265] Use fluent APIs and ternary expressions
---
.../commons/text/TextStringBuilder.java | 51 ++++---------------
1 file changed, 10 insertions(+), 41 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index a7db693c2a..40d53b1bf4 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -114,10 +114,7 @@ public boolean markSupported() {
/** {@inheritDoc} */
@Override
public int read() {
- if (!ready()) {
- return -1;
- }
- return charAt(pos++);
+ return ready() ? charAt(pos++) : -1;
}
/** {@inheritDoc} */
@@ -181,10 +178,7 @@ final class TextStringBuilderTokenizer extends StringTokenizer {
@Override
public String getContent() {
final String str = super.getContent();
- if (str == null) {
- return TextStringBuilder.this.toString();
- }
- return str;
+ return str != null ? str : TextStringBuilder.this.toString();
}
/** {@inheritDoc} */
@@ -1175,11 +1169,7 @@ public TextStringBuilder appendln(final TextStringBuilder str, final int startIn
* @see #setNewLineText(String)
*/
public TextStringBuilder appendNewLine() {
- if (newLine == null) {
- append(System.lineSeparator());
- return this;
- }
- return append(newLine);
+ return append(newLine == null ? System.lineSeparator() : newLine);
}
/**
@@ -1229,10 +1219,7 @@ public TextStringBuilder appendPadding(final int length, final char padChar) {
* @return this, to enable chaining
*/
public TextStringBuilder appendSeparator(final char separator) {
- if (isNotEmpty()) {
- append(separator);
- }
- return this;
+ return isEmpty() ? this : append(separator);
}
/**
@@ -1246,12 +1233,7 @@ public TextStringBuilder appendSeparator(final char separator) {
* @return this, to enable chaining
*/
public TextStringBuilder appendSeparator(final char standard, final char defaultIfEmpty) {
- if (isEmpty()) {
- append(defaultIfEmpty);
- } else {
- append(standard);
- }
- return this;
+ return append(isEmpty() ? defaultIfEmpty : standard);
}
/**
@@ -1277,10 +1259,7 @@ public TextStringBuilder appendSeparator(final char standard, final char default
* @return this, to enable chaining
*/
public TextStringBuilder appendSeparator(final char separator, final int loopIndex) {
- if (loopIndex > 0) {
- append(separator);
- }
- return this;
+ return loopIndex > 0 ? append(separator) : this;
}
/**
@@ -1331,10 +1310,7 @@ public TextStringBuilder appendSeparator(final String separator) {
* @return this, to enable chaining
*/
public TextStringBuilder appendSeparator(final String separator, final int loopIndex) {
- if (separator != null && loopIndex > 0) {
- append(separator);
- }
- return this;
+ return separator != null && loopIndex > 0 ? append(separator) : this;
}
/**
@@ -1366,10 +1342,7 @@ public TextStringBuilder appendSeparator(final String separator, final int loopI
*/
public TextStringBuilder appendSeparator(final String standard, final String defaultIfEmpty) {
final String str = isEmpty() ? defaultIfEmpty : standard;
- if (str != null) {
- append(str);
- }
- return this;
+ return str != null ? append(str) : this;
}
/**
@@ -1454,8 +1427,7 @@ public TextStringBuilder appendWithSeparators(final Object[] array, final String
final String sep = Objects.toString(separator, StringUtils.EMPTY);
append(array[0]);
for (int i = 1; i < array.length; i++) {
- append(sep);
- append(array[i]);
+ append(sep).append(array[i]);
}
}
return this;
@@ -2925,7 +2897,6 @@ public TextStringBuilder reverse() {
if (size == 0) {
return this;
}
-
final int half = size / 2;
final char[] buf = buffer;
for (int leftIdx = 0, rightIdx = size - 1; leftIdx < half; leftIdx++, rightIdx--) {
@@ -2966,9 +2937,7 @@ public String rightString(final int length) {
* @since 1.9
*/
public TextStringBuilder set(final CharSequence str) {
- clear();
- append(str);
- return this;
+ return clear().append(str);
}
/**
From c8058b8353ea0b0d7009dec0c0d7dc7eb5f37c9d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 5 Sep 2025 13:34:53 -0700
Subject: [PATCH 087/265] Bump github/codeql-action from 3.29.11 to 3.30.1
(#700)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.11 to 3.30.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/3c3833e0f8c1c83d449a7478aa59c036a9165498...f1f6e5f6af878fb37288ce1c627459e94dbf7d01)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.30.1
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 36b2f321b5..69e3507492 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@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
+ uses: github/codeql-action/init@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
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@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
+ uses: github/codeql-action/autobuild@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
# âšī¸ 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@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
+ uses: github/codeql-action/analyze@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index f5ac42eaa8..ef4beb910d 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@3c3833e0f8c1c83d449a7478aa59c036a9165498 # 3.29.5
+ uses: github/codeql-action/upload-sarif@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
with:
sarif_file: results.sarif
From 5d356fd01d231dd27dd7c38cb98761343d364075 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 12 Sep 2025 17:12:30 -0400
Subject: [PATCH 088/265] Bump github/codeql-action from 3.30.1 to 3.30.3
(#702)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.1 to 3.30.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f1f6e5f6af878fb37288ce1c627459e94dbf7d01...192325c86100d080feab897ff886c34abd4c83a3)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.30.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 69e3507492..e61f02688c 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@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
+ uses: github/codeql-action/init@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
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@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
+ uses: github/codeql-action/autobuild@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
# âšī¸ 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@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
+ uses: github/codeql-action/analyze@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index ef4beb910d..9f6e1fd0c2 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@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # 3.29.5
+ uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
with:
sarif_file: results.sarif
From d454232e0bb4efb973378180c8ba234087b7dddb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 19 Sep 2025 17:21:29 -0400
Subject: [PATCH 089/265] Bump graalvm.version from 24.2.2 to 25.0.0 (#703)
Bumps `graalvm.version` from 24.2.2 to 25.0.0.
Updates `org.graalvm.js:js` from 24.2.2 to 25.0.0
- [Release notes](https://github.com/graalvm/graaljs/releases)
- [Changelog](https://github.com/oracle/graaljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/graalvm/graaljs/compare/vm-24.2.2...vm-25.0.0)
Updates `org.graalvm.js:js-scriptengine` from 24.2.2 to 25.0.0
- [Release notes](https://github.com/graalvm/graaljs/releases)
- [Changelog](https://github.com/oracle/graaljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/graalvm/graaljs/compare/vm-24.2.2...vm-25.0.0)
Updates `org.graalvm.js:js-language` from 24.2.2 to 25.0.0
- [Release notes](https://github.com/graalvm/graaljs/releases)
- [Changelog](https://github.com/oracle/graaljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/graalvm/graaljs/compare/vm-24.2.2...vm-25.0.0)
Updates `org.graalvm.truffle:truffle-runtime` from 24.2.2 to 25.0.0
- [Release notes](https://github.com/oracle/graal/releases)
- [Commits](https://github.com/oracle/graal/compare/vm-24.2.2...vm-25.0.0)
---
updated-dependencies:
- dependency-name: org.graalvm.js:js
dependency-version: 25.0.0
dependency-type: direct:development
update-type: version-update:semver-major
- dependency-name: org.graalvm.js:js-scriptengine
dependency-version: 25.0.0
dependency-type: direct:development
update-type: version-update:semver-major
- dependency-name: org.graalvm.js:js-language
dependency-version: 25.0.0
dependency-type: direct:development
update-type: version-update:semver-major
- dependency-name: org.graalvm.truffle:truffle-runtime
dependency-version: 25.0.0
dependency-type: direct:development
update-type: version-update:semver-major
...
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 8c9b18d74a..e38a59942a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -500,7 +500,7 @@
[22,)
- 24.2.2
+ 25.0.05.2.0
From 618cc66d41e33652ce8e4d838e2297cd53293d89 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 19 Sep 2025 17:22:11 -0400
Subject: [PATCH 090/265] Bump graalvm.version from 24.2.2 to 25.0.0 #703
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4366dbe10e..092409b28e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,6 +54,7 @@ The type attribute can be add,update,fix,remove.
Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.Bump org.apache.commons:commons-parent from 85 to 87.
+ Bump graalvm.version from 24.2.2 to 25.0.0 #703.
From ac17677e712c0962b1a145da58e4f3c129505b83 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 19 Sep 2025 22:26:46 -0400
Subject: [PATCH 091/265] Bump org.apache.commons:commons-parent from 87 to 88
(#704)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 87 to 88.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-version: '88'
dependency-type: direct:production
update-type: version-update:semver-major
...
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 e38a59942a..5cf6ea22bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.apache.commonscommons-parent
- 87
+ 88commons-text1.14.1-SNAPSHOT
From db5ea4fe4424ee2b6b002302de1a84da6ba74810 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 19 Sep 2025 22:27:18 -0400
Subject: [PATCH 092/265] Bump org.apache.commons:commons-parent from 87 to 88
#704
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 092409b28e..c0e5169784 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,7 +53,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.
- Bump org.apache.commons:commons-parent from 85 to 87.
+ Bump org.apache.commons:commons-parent from 85 to 88 #704.Bump graalvm.version from 24.2.2 to 25.0.0 #703.
From 1df1c0cdaf5a1101860cf7422d01d06d3d33329d Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Mon, 22 Sep 2025 13:18:33 -0400
Subject: [PATCH 093/265] Javadoc
---
.../commons/text/lookup/AbstractPathFencedLookup.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java b/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
index 2a980ab2d8..c988738830 100644
--- a/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
@@ -30,7 +30,7 @@
abstract class AbstractPathFencedLookup extends AbstractStringLookup {
/**
- * Fences guarding Path resolution.
+ * A fence is made of Paths guarding Path resolution.
*/
protected final List fences;
@@ -44,11 +44,11 @@ abstract class AbstractPathFencedLookup extends AbstractStringLookup {
}
/**
- * Gets a Path for the given file name checking that it resolves within our fences.
+ * Gets a Path for the given file name checking that it resolves within our fence.
*
* @param fileName the file name to resolve.
* @return a fenced Path.
- * @throws IllegalArgumentException if the file name is not without our fences.
+ * @throws IllegalArgumentException if the file name is not without our fence.
*/
protected Path getPath(final String fileName) {
final Path path = Paths.get(fileName);
From f3b64e766b6819825217353a76a6864234759c57 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Mon, 22 Sep 2025 15:36:41 -0400
Subject: [PATCH 094/265] Internal refactoring
Extract a package-private PathFence class from AbstractPathFencedLookup
---
.../text/lookup/AbstractPathFencedLookup.java | 29 ++---
.../apache/commons/text/lookup/PathFence.java | 108 ++++++++++++++++++
2 files changed, 115 insertions(+), 22 deletions(-)
create mode 100644 src/main/java/org/apache/commons/text/lookup/PathFence.java
diff --git a/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java b/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
index c988738830..d077c17766 100644
--- a/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
@@ -14,33 +14,28 @@
* See the license for the specific language governing permissions and
* limitations under the license.
*/
+
package org.apache.commons.text.lookup;
import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
/**
- * Abstracts guarding Path lookups with fences.
+ * Abstracts string lookup that guards Path lookups with a fence.
*/
abstract class AbstractPathFencedLookup extends AbstractStringLookup {
/**
* A fence is made of Paths guarding Path resolution.
*/
- protected final List fences;
+ protected final PathFence fence;
/**
* Constructs a new instance.
*
- * @param fences The fences guarding Path resolution.
+ * @param paths The fences guarding Path resolution.
*/
- AbstractPathFencedLookup(final Path... fences) {
- this.fences = fences != null ? Arrays.stream(fences).map(Path::toAbsolutePath).collect(Collectors.toList()) : Collections.emptyList();
+ AbstractPathFencedLookup(final Path... paths) {
+ this.fence = PathFence.builder().setPaths(paths).get();
}
/**
@@ -51,16 +46,6 @@ abstract class AbstractPathFencedLookup extends AbstractStringLookup {
* @throws IllegalArgumentException if the file name is not without our fence.
*/
protected Path getPath(final String fileName) {
- final Path path = Paths.get(fileName);
- if (fences.isEmpty()) {
- return path;
- }
- final Path pathAbs = path.normalize().toAbsolutePath();
- final Optional first = fences.stream().filter(pathAbs::startsWith).findFirst();
- if (first.isPresent()) {
- return path;
- }
- throw IllegalArgumentExceptions.format("[%s] -> [%s] not in %s", fileName, pathAbs, fences);
+ return fence.getPath(fileName);
}
-
}
diff --git a/src/main/java/org/apache/commons/text/lookup/PathFence.java b/src/main/java/org/apache/commons/text/lookup/PathFence.java
new file mode 100644
index 0000000000..0428ef2f8e
--- /dev/null
+++ b/src/main/java/org/apache/commons/text/lookup/PathFence.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+package org.apache.commons.text.lookup;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+/**
+ * A Path fence guards Path resolution.
+ *
+ * Keep package-private.
+ */
+final class PathFence {
+
+ /**
+ * Builds {@link PathFence} instances.
+ */
+ static final class Builder implements Supplier {
+
+ /** The empty Path array. */
+ private static final Path[] EMPTY = {};
+
+ /**
+ * A fence is made of Paths guarding Path resolution.
+ */
+ private Path[] paths = EMPTY;
+
+ /**
+ * Sets the paths that delineate this fence.
+ *
+ * @param paths the paths that delineate this fence.
+ * @return {@code this} instance.
+ */
+ Builder setPaths(final Path... paths) {
+ this.paths = paths != null ? paths.clone() : EMPTY;
+ return this;
+ }
+
+ @Override
+ public PathFence get() {
+ return new PathFence(this);
+ }
+ }
+
+ /**
+ * Creates a new builder.
+ *
+ * @return a new builder.
+ */
+ static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * A fence is made of Paths guarding Path resolution.
+ */
+ private final List paths;
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param builder A builder.
+ */
+ private PathFence(final Builder builder) {
+ this.paths = Arrays.stream(builder.paths).map(Path::toAbsolutePath).collect(Collectors.toList());
+ }
+
+ /**
+ * Gets a Path for the given file name checking that it resolves within our fence.
+ *
+ * @param fileName the file name to resolve.
+ * @return a fenced Path.
+ * @throws IllegalArgumentException if the file name is not without our fence.
+ */
+ Path getPath(final String fileName) {
+ final Path path = Paths.get(fileName);
+ if (paths.isEmpty()) {
+ return path;
+ }
+ final Path pathAbs = path.normalize().toAbsolutePath();
+ final Optional first = paths.stream().filter(pathAbs::startsWith).findFirst();
+ if (first.isPresent()) {
+ return path;
+ }
+ throw new IllegalArgumentException(String.format("[%s] -> [%s] not in the fence %s", fileName, pathAbs, paths));
+ }
+
+}
From 3abedb8b5c48991be87f8a135ab54a0d2b18e532 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Wed, 24 Sep 2025 17:40:47 -0400
Subject: [PATCH 095/265] Bump org.apache.commons:commons-lang3 from 3.18.0 to
3.19.0
---
pom.xml | 2 +-
src/changes/changes.xml | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5cf6ea22bb..0e51279212 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,7 +47,7 @@
texthttps://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-textsite-content
- 3.18.0
+ 3.19.01.17.71.6false
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c0e5169784..a7e3623057 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,9 +52,10 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.
- Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.Bump org.apache.commons:commons-parent from 85 to 88 #704.
+ Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.Bump graalvm.version from 24.2.2 to 25.0.0 #703.
+ Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0.
From e2277f5400cce07039a16d25c0f2f98fdaf26fbf Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Fri, 26 Sep 2025 10:45:34 -0400
Subject: [PATCH 096/265] Add GH CI 25 and 26-EA
---
.github/workflows/maven.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 4890f722c4..6724e87101 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -27,10 +27,10 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
- java: [ 8, 11, 17, 21, 24 ]
+ java: [ 8, 11, 17, 21, 25 ]
experimental: [false]
include:
- - java: 25-ea
+ - java: 26-ea
experimental: true
steps:
From 03bdf123ab8fb6b95187d3b490391bc3a5e2ce13 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 26 Sep 2025 16:48:02 -0400
Subject: [PATCH 097/265] Bump github/codeql-action from 3.30.3 to 3.30.5
(#705)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.3 to 3.30.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/192325c86100d080feab897ff886c34abd4c83a3...3599b3baa15b485a2e49ef411a7a4bb2452e7f93)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.30.5
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 e61f02688c..af6cd05036 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@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
+ uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
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@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
+ uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
# âšī¸ 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@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
+ uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 9f6e1fd0c2..7ec7ae6801 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@192325c86100d080feab897ff886c34abd4c83a3 # 3.29.5
+ uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
with:
sarif_file: results.sarif
From 78d5cfaf12d96ba7bb6674e4902a9d663a6c36dd Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 26 Sep 2025 16:48:47 -0400
Subject: [PATCH 098/265] Bump actions/dependency-review-action from 4.7.3 to
4.8.0 (#707)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.7.3 to 4.8.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/595b5aeba73380359d98a5e087f648dbb0edce1b...56339e523c0409420f6c2c9a2f4292bbb3c07dd3)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-version: 4.8.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 1e04392423..edfe875664 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,4 +28,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3
+ uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
From cb7233acd4fc0b98b1e872925e403d2664f148f7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 26 Sep 2025 16:49:01 -0400
Subject: [PATCH 099/265] Bump actions/cache from 4.2.4 to 4.3.0 (#706)
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.4 to 4.3.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/0400d5f644dc74513175e3cd8d07132dd4860809...0057852bfaa89a56745cba8c7296529d2fc39830)
---
updated-dependencies:
- dependency-name: actions/cache
dependency-version: 4.3.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 af6cd05036..96554af907 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
+ - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
From 5ef8eea758e862c5212b9dd91d9074664dc2f6e6 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Wed, 1 Oct 2025 15:46:00 -0400
Subject: [PATCH 100/265] Update JMH test data
---
.../org/apache/commons/text/lcs-perf-analysis-inputs.csv | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 d000a26c96..53610d3579 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,5 +1,5 @@
-"This code is free software; you can redistribute it and/or modify it","under the terms of the GNU General Public License version 2 only, as"
-"You should have received a copy of the GNU General Public License version","2 along with this work; if not, write to the Free Software Foundation,"
+"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,"
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? 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","At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. 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."
From 81f219f61284cd82392085a7210777037c2893ec Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 3 Oct 2025 17:54:13 -0400
Subject: [PATCH 101/265] Bump github/codeql-action from 3.30.5 to 3.30.6
(#709)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.5 to 3.30.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/3599b3baa15b485a2e49ef411a7a4bb2452e7f93...64d10c13136e1c5bce3e5fbde8d4906eeaafc885)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.30.6
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 96554af907..131d8f6927 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@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
+ uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
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@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
+ uses: github/codeql-action/autobuild@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
# âšī¸ 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@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
+ uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 7ec7ae6801..2620d75876 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@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # 3.29.5
+ uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
with:
sarif_file: results.sarif
From 4ef7194ddcc7ca88c768a72d76f1c64370d462c8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 3 Oct 2025 17:55:16 -0400
Subject: [PATCH 102/265] Bump ossf/scorecard-action from 2.4.2 to 2.4.3 (#708)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/05b42c624433fc40578a4040d5cf5e36ddca8cde...4eaacf0543bb3f2c246792bd56e8cdeffafb205a)
---
updated-dependencies:
- dependency-name: ossf/scorecard-action
dependency-version: 2.4.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 2620d75876..b8af37f418 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -45,7 +45,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # 2.4.2
+ uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # 2.4.3
with:
results_file: results.sarif
results_format: sarif
From 34fec1023b5c55bee9a376bbfdecd9da24b8c515 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Wed, 8 Oct 2025 15:35:22 -0400
Subject: [PATCH 103/265] Bump org.apache.commons:commons-parent from 88 to 89
---
pom.xml | 2 +-
src/changes/changes.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0e51279212..8f77daf91d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.apache.commonscommons-parent
- 88
+ 89commons-text1.14.1-SNAPSHOT
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a7e3623057..7dd3974ca6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,7 +52,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.
- Bump org.apache.commons:commons-parent from 85 to 88 #704.
+ Bump org.apache.commons:commons-parent from 85 to 89 #704.Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.Bump graalvm.version from 24.2.2 to 25.0.0 #703.Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0.
From 4d2f10673f1c849c9edfd6090070fa624560931e Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Fri, 10 Oct 2025 07:02:09 -0400
Subject: [PATCH 104/265] Fix typo in StringUtils.trunctate()
IllegalArgumentException message and test assertion messages
---
pom.xml | 2 +-
src/changes/changes.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8f77daf91d..37c2a41b51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,7 @@
https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-textsite-content3.19.0
- 1.17.7
+ 1.17.81.6false1.37
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7dd3974ca6..7397803ebb 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,7 +53,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.Bump org.apache.commons:commons-parent from 85 to 89 #704.
- Bump commons.bytebuddy.version from 1.17.6 to 1.17.7 #696.
+ Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.Bump graalvm.version from 24.2.2 to 25.0.0 #703.Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0.
From 0d81869d37e7e0bdf967e466e2471d160a40faa8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 10 Oct 2025 16:04:42 -0400
Subject: [PATCH 105/265] Bump github/codeql-action from 3.30.6 to 4.30.8
(#710)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.6 to 4.30.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/64d10c13136e1c5bce3e5fbde8d4906eeaafc885...f443b600d91635bebf5b0d9ebc620189c0d6fba5)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 4.30.8
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 131d8f6927..a999a0751b 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@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
+ uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
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@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
+ uses: github/codeql-action/autobuild@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
# âšī¸ 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@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
+ uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index b8af37f418..6c7da95500 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@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # 3.29.5
+ uses: github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
with:
sarif_file: results.sarif
From 903d6268519d6093e9a6c3848cd840605af511c1 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 17 Oct 2025 16:07:51 -0400
Subject: [PATCH 106/265] Bump github/codeql-action from 4.30.8 to 4.30.9
(#711)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.30.8 to 4.30.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/f443b600d91635bebf5b0d9ebc620189c0d6fba5...16140ae1a102900babc80a33c44059580f687047)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 4.30.9
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 a999a0751b..d3291cb300 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@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
+ uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
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@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
+ uses: github/codeql-action/autobuild@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
# âšī¸ 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@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
+ uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 6c7da95500..40a87e44bf 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@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # 3.29.5
+ uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
with:
sarif_file: results.sarif
From 12b1e6a9cd5fc2c8e0eb08f2594269a933e3e711 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 17 Oct 2025 16:08:06 -0400
Subject: [PATCH 107/265] Bump actions/dependency-review-action from 4.8.0 to
4.8.1 (#712)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.8.0 to 4.8.1.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/56339e523c0409420f6c2c9a2f4292bbb3c07dd3...40c09b7dc99638e5ddb0bfd91c1673effc064d8a)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-version: 4.8.1
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index edfe875664..a657a4ae2c 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,4 +28,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
+ uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1
From 76df9e54399018163c8cd92bc1e407c7c4296612 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 19 Oct 2025 08:48:58 -0400
Subject: [PATCH 108/265] Better internal names and comments
---
.../text/lookup/AbstractPathFencedLookup.java | 4 +--
.../apache/commons/text/lookup/PathFence.java | 32 +++++++++----------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java b/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
index d077c17766..b4fc4601b8 100644
--- a/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/AbstractPathFencedLookup.java
@@ -35,7 +35,7 @@ abstract class AbstractPathFencedLookup extends AbstractStringLookup {
* @param paths The fences guarding Path resolution.
*/
AbstractPathFencedLookup(final Path... paths) {
- this.fence = PathFence.builder().setPaths(paths).get();
+ this.fence = PathFence.builder().setRoots(paths).get();
}
/**
@@ -46,6 +46,6 @@ abstract class AbstractPathFencedLookup extends AbstractStringLookup {
* @throws IllegalArgumentException if the file name is not without our fence.
*/
protected Path getPath(final String fileName) {
- return fence.getPath(fileName);
+ return fence.apply(fileName);
}
}
diff --git a/src/main/java/org/apache/commons/text/lookup/PathFence.java b/src/main/java/org/apache/commons/text/lookup/PathFence.java
index 0428ef2f8e..95b9b615f5 100644
--- a/src/main/java/org/apache/commons/text/lookup/PathFence.java
+++ b/src/main/java/org/apache/commons/text/lookup/PathFence.java
@@ -26,7 +26,7 @@
import java.util.stream.Collectors;
/**
- * A Path fence guards Path resolution.
+ * A Path fence guards against using paths outside of a "fence" of made of root paths.
*
* Keep package-private.
*/
@@ -41,9 +41,14 @@ static final class Builder implements Supplier {
private static final Path[] EMPTY = {};
/**
- * A fence is made of Paths guarding Path resolution.
+ * A fence is made of root Paths.
*/
- private Path[] paths = EMPTY;
+ private Path[] roots = EMPTY;
+
+ @Override
+ public PathFence get() {
+ return new PathFence(this);
+ }
/**
* Sets the paths that delineate this fence.
@@ -51,15 +56,10 @@ static final class Builder implements Supplier {
* @param paths the paths that delineate this fence.
* @return {@code this} instance.
*/
- Builder setPaths(final Path... paths) {
- this.paths = paths != null ? paths.clone() : EMPTY;
+ Builder setRoots(final Path... paths) {
+ this.roots = paths != null ? paths.clone() : EMPTY;
return this;
}
-
- @Override
- public PathFence get() {
- return new PathFence(this);
- }
}
/**
@@ -74,7 +74,7 @@ static Builder builder() {
/**
* A fence is made of Paths guarding Path resolution.
*/
- private final List paths;
+ private final List roots;
/**
* Constructs a new instance.
@@ -82,7 +82,7 @@ static Builder builder() {
* @param builder A builder.
*/
private PathFence(final Builder builder) {
- this.paths = Arrays.stream(builder.paths).map(Path::toAbsolutePath).collect(Collectors.toList());
+ this.roots = Arrays.stream(builder.roots).map(Path::toAbsolutePath).collect(Collectors.toList());
}
/**
@@ -92,17 +92,17 @@ private PathFence(final Builder builder) {
* @return a fenced Path.
* @throws IllegalArgumentException if the file name is not without our fence.
*/
- Path getPath(final String fileName) {
+ Path apply(final String fileName) {
final Path path = Paths.get(fileName);
- if (paths.isEmpty()) {
+ if (roots.isEmpty()) {
return path;
}
final Path pathAbs = path.normalize().toAbsolutePath();
- final Optional first = paths.stream().filter(pathAbs::startsWith).findFirst();
+ final Optional first = roots.stream().filter(pathAbs::startsWith).findFirst();
if (first.isPresent()) {
return path;
}
- throw new IllegalArgumentException(String.format("[%s] -> [%s] not in the fence %s", fileName, pathAbs, paths));
+ throw new IllegalArgumentException(String.format("[%s] -> [%s] not in the fence %s", fileName, pathAbs, roots));
}
}
From 346f7ba2b37aa3081a0692e1d3d23266315cccd0 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 19 Oct 2025 08:59:58 -0400
Subject: [PATCH 109/265] Fix grammar
---
.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 7578b4da03..4cbe168c3e 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -25,6 +25,6 @@ Before you push a pull request, review this list:
- [ ] 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.
- [ ] 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 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.
- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.
From 50bfffe72683a7d3816e809edc22f1022bc7a27f Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 19 Oct 2025 09:29:36 -0400
Subject: [PATCH 110/265] Use https scheme in license link
---
pom.xml | 2 +-
src/conf/security/README.md | 2 +-
src/conf/security/VEX.cyclonedx.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 37c2a41b51..3f8dfc0007 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ 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,
diff --git a/src/conf/security/README.md b/src/conf/security/README.md
index 8629f82a7a..4ac566bc6a 100644
--- a/src/conf/security/README.md
+++ b/src/conf/security/README.md
@@ -6,7 +6,7 @@
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
- ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ 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,
diff --git a/src/conf/security/VEX.cyclonedx.xml b/src/conf/security/VEX.cyclonedx.xml
index dcad061f0e..a347293699 100644
--- a/src/conf/security/VEX.cyclonedx.xml
+++ b/src/conf/security/VEX.cyclonedx.xml
@@ -7,7 +7,7 @@
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
- ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ 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,
From 9fd0ca67703503557c0f4c08bc6e26f8a1be8f44 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 24 Oct 2025 16:19:38 -0400
Subject: [PATCH 111/265] Bump github/codeql-action from 4.30.9 to 4.31.0
(#714)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.30.9 to 4.31.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/16140ae1a102900babc80a33c44059580f687047...4e94bd11f71e507f7f87df81788dff88d1dacbfb)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 4.31.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 d3291cb300..18730ee4ae 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@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
+ uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # 3.29.5
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@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
+ uses: github/codeql-action/autobuild@4e94bd11f71e507f7f87df81788dff88d1dacbfb # 3.29.5
# âšī¸ 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@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
+ uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 40a87e44bf..07625fba6f 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@16140ae1a102900babc80a33c44059580f687047 # 3.29.5
+ uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # 3.29.5
with:
sarif_file: results.sarif
From 2f516325b0bb87a88e621c904f5ceea6c1eb2750 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 24 Oct 2025 16:19:57 -0400
Subject: [PATCH 112/265] Bump actions/upload-artifact from 4.6.2 to 5.0.0
(#715)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 5.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/ea165f8d65b6e75b540449e92b4886f43607fa02...330a01c490aca151604b8cf639adc76d48f6c5d4)
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-version: 5.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 07625fba6f..31b58e38e8 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
+ uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0
with:
name: SARIF file
path: results.sarif
From f8db46df6dbb3dbd5085d005b6055304108eaf37 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 24 Oct 2025 16:55:56 -0400
Subject: [PATCH 113/265] Bump org.apache.commons:commons-parent from 89 to 90
(#713)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 89 to 90.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-version: '90'
dependency-type: direct:production
update-type: version-update:semver-major
...
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 3f8dfc0007..ed37a53d00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.apache.commonscommons-parent
- 89
+ 90commons-text1.14.1-SNAPSHOT
From 388effdf87475ba79c8881392e18809832606715 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 24 Oct 2025 16:56:19 -0400
Subject: [PATCH 114/265] Bump org.apache.commons:commons-parent from 89 to 90
#713
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7397803ebb..78845b2afa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,7 +52,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.
- Bump org.apache.commons:commons-parent from 85 to 89 #704.
+ Bump org.apache.commons:commons-parent from 85 to 90 #704.Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.Bump graalvm.version from 24.2.2 to 25.0.0 #703.Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0.
From 8283f350552eeabb98c87825053f78af58365e7b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 24 Oct 2025 16:56:56 -0400
Subject: [PATCH 115/265] Bump graalvm.version from 25.0.0 to 25.0.1 (#716)
Bumps `graalvm.version` from 25.0.0 to 25.0.1.
Updates `org.graalvm.js:js` from 25.0.0 to 25.0.1
- [Release notes](https://github.com/graalvm/graaljs/releases)
- [Changelog](https://github.com/oracle/graaljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/graalvm/graaljs/compare/vm-25.0.0...vm-25.0.1)
Updates `org.graalvm.js:js-scriptengine` from 25.0.0 to 25.0.1
- [Release notes](https://github.com/graalvm/graaljs/releases)
- [Changelog](https://github.com/oracle/graaljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/graalvm/graaljs/compare/vm-25.0.0...vm-25.0.1)
Updates `org.graalvm.js:js-language` from 25.0.0 to 25.0.1
- [Release notes](https://github.com/graalvm/graaljs/releases)
- [Changelog](https://github.com/oracle/graaljs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/graalvm/graaljs/compare/vm-25.0.0...vm-25.0.1)
Updates `org.graalvm.truffle:truffle-runtime` from 25.0.0 to 25.0.1
- [Release notes](https://github.com/oracle/graal/releases)
- [Commits](https://github.com/oracle/graal/compare/vm-25.0.0...vm-25.0.1)
---
updated-dependencies:
- dependency-name: org.graalvm.js:js
dependency-version: 25.0.1
dependency-type: direct:development
update-type: version-update:semver-patch
- dependency-name: org.graalvm.js:js-scriptengine
dependency-version: 25.0.1
dependency-type: direct:development
update-type: version-update:semver-patch
- dependency-name: org.graalvm.js:js-language
dependency-version: 25.0.1
dependency-type: direct:development
update-type: version-update:semver-patch
- dependency-name: org.graalvm.truffle:truffle-runtime
dependency-version: 25.0.1
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 ed37a53d00..072b91361c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -500,7 +500,7 @@
[22,)
- 25.0.0
+ 25.0.15.2.0
From 57f197870e0aaba57ea60f24544efb61f607d311 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 24 Oct 2025 16:57:29 -0400
Subject: [PATCH 116/265] Bump graalvm.version from 25.0.0 to 25.0.1 #716
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 78845b2afa..2de17e803e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,7 +54,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 85 to 90 #704.Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.
- Bump graalvm.version from 24.2.2 to 25.0.0 #703.
+ 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.19.0.
From 4f3555954819dda2a9a0ff6f9a8bd694bee56632 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Sun, 26 Oct 2025 15:33:42 -0400
Subject: [PATCH 117/265] No need for Latin
---
.../commons/text/similarity/LevenshteinDetailedDistance.java | 3 ++-
.../apache/commons/text/similarity/LevenshteinDistance.java | 3 ++-
2 files changed, 4 insertions(+), 2 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 a25b988b60..7e3df86aba 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
@@ -168,7 +168,8 @@ private static LevenshteinResults limitedCompare(SimilarityInput left, Si
* of the cost table. It is also possible to use this to compute the unbounded Levenshtein distance by starting the threshold at 1 and doubling each
* time until the distance is found; this is O(dm), where d is the distance.
*
- * One subtlety comes from needing to ignore entries on the border of our stripe eg. p[] = |#|#|#|* d[] = *|#|#|#| We must ignore the entry to the left
+ * One subtlety comes from needing to ignore entries on the border of our stripe, for example,
+ * p[] = |#|#|#|* d[] = *|#|#|#| We must ignore the entry to the left
* of the leftmost member We must ignore the entry above the rightmost member
*
* Another subtlety comes from our stripe running off the matrix if the strings aren't of the same size. Since string s is always swapped to be the
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 787279c6ab..0deb2b525a 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -91,7 +91,8 @@ private static int limitedCompare(SimilarityInput left, SimilarityInput
Date: Thu, 30 Oct 2025 11:04:59 +0000
Subject: [PATCH 118/265] [TEXT-235] Add Damerau-Levenshtein distance (#687)
* [TEXT-235] Implement Damerau-Levenshtein distance
* Fix comment formatting
* Fix style and spotbugs
---------
Co-authored-by: Eirik Lorgen Tanberg
---
.../DamerauLevenshteinDistance.java | 326 ++++++++++++++++++
.../DamerauLevenshteinDistanceTest.java | 220 ++++++++++++
2 files changed, 546 insertions(+)
create mode 100644 src/main/java/org/apache/commons/text/similarity/DamerauLevenshteinDistance.java
create mode 100644 src/test/java/org/apache/commons/text/similarity/DamerauLevenshteinDistanceTest.java
diff --git a/src/main/java/org/apache/commons/text/similarity/DamerauLevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/DamerauLevenshteinDistance.java
new file mode 100644
index 0000000000..d7685ebc29
--- /dev/null
+++ b/src/main/java/org/apache/commons/text/similarity/DamerauLevenshteinDistance.java
@@ -0,0 +1,326 @@
+/*
+ * 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.
+ */
+package org.apache.commons.text.similarity;
+
+/**
+ * An algorithm for measuring the difference between two character sequences using the
+ * Damerau-Levenshtein Distance.
+ *
+ *
+ * This is the number of changes needed to change one sequence into another, where each change is a single character
+ * modification (deletion, insertion, substitution, or transposition of two adjacent characters).
+ *
+ *
+ * @see Damerau-Levenshtein Distance on Wikipedia
+ * @since 1.15.0
+ */
+public class DamerauLevenshteinDistance implements EditDistance {
+
+ /**
+ * Utility function to ensure distance is valid according to threshold.
+ *
+ * @param distance The distance value
+ * @param threshold The threshold value
+ * @return The distance value, or {@code -1} if distance is greater than threshold
+ */
+ private static int clampDistance(final int distance, final int threshold) {
+ return distance > threshold ? -1 : distance;
+ }
+
+ /**
+ * Finds the Damerau-Levenshtein distance between two CharSequences if it's less than or equal to a given threshold.
+ *
+ * @param left the first SimilarityInput, must not be null.
+ * @param right the second SimilarityInput, must not be null.
+ * @param threshold the target threshold, must not be negative.
+ * @return result distance, or -1 if distance exceeds threshold
+ */
+ private static int limitedCompare(SimilarityInput left, SimilarityInput right, final int threshold) {
+ if (left == null || right == null) {
+ throw new IllegalArgumentException("Left/right inputs must not be null");
+ }
+
+ if (threshold < 0) {
+ throw new IllegalArgumentException("Threshold can not be negative");
+ }
+
+ // Implementation based on https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance#Optimal_string_alignment_distance
+
+ int leftLength = left.length();
+ int rightLength = right.length();
+
+ if (leftLength == 0) {
+ return clampDistance(rightLength, threshold);
+ }
+
+ if (rightLength == 0) {
+ return clampDistance(leftLength, threshold);
+ }
+
+ // Inspired by LevenshteinDistance impl; swap the input strings to consume less memory
+ if (rightLength > leftLength) {
+ final SimilarityInput tmp = left;
+ left = right;
+ right = tmp;
+ leftLength = rightLength;
+ rightLength = right.length();
+ }
+
+ // If the difference between the lengths of the strings is greater than the threshold, we must at least do
+ // threshold operations so we can return early
+ if (leftLength - rightLength > threshold) {
+ return -1;
+ }
+
+ // Use three arrays of minimum possible size to reduce memory usage. This avoids having to create a 2D
+ // array of size leftLength * rightLength
+ int[] curr = new int[rightLength + 1];
+ int[] prev = new int[rightLength + 1];
+ int[] prevPrev = new int[rightLength + 1];
+ int[] temp; // Temp variable use to shuffle arrays at the end of each iteration
+
+ int rightIndex, leftIndex, cost, minCost;
+
+ // Changing empty sequence to [0..i] requires i insertions
+ for (rightIndex = 0; rightIndex <= rightLength; rightIndex++) {
+ prev[rightIndex] = rightIndex;
+ }
+
+ // Calculate how many operations it takes to change right[0..rightIndex] into left[0..leftIndex]
+ // For each iteration
+ // - curr[i] contains the cost of changing right[0..i] into left[0..leftIndex]
+ // (computed in current iteration)
+ // - prev[i] contains the cost of changing right[0..i] into left[0..leftIndex - 1]
+ // (computed in previous iteration)
+ // - prevPrev[i] contains the cost of changing right[0..i] into left[0..leftIndex - 2]
+ // (computed in iteration before previous)
+ for (leftIndex = 1; leftIndex <= leftLength; leftIndex++) {
+ // For right[0..0] we must insert leftIndex characters, which means the cost is always leftIndex
+ curr[0] = leftIndex;
+
+ minCost = Integer.MAX_VALUE;
+
+ for (rightIndex = 1; rightIndex <= rightLength; rightIndex++) {
+ cost = (left.at(leftIndex - 1) == right.at(rightIndex - 1)) ? 0 : 1;
+
+ // Select cheapest operation
+ curr[rightIndex] = Math.min(
+ Math.min(
+ prev[rightIndex] + 1, // Delete current character
+ curr[rightIndex - 1] + 1 // Insert current character
+ ),
+ prev[rightIndex - 1] + cost // Replace (or no cost if same character)
+ );
+
+ // Check if adjacent characters are the same -> transpose if cheaper
+ if (leftIndex > 1
+ && rightIndex > 1
+ && left.at(leftIndex - 1) == right.at(rightIndex - 2)
+ && left.at(leftIndex - 2) == right.at(rightIndex - 1)) {
+ // Use cost here, to properly handle two subsequent equal letters
+ curr[rightIndex] = Math.min(curr[rightIndex], prevPrev[rightIndex - 2] + cost);
+ }
+
+ minCost = Math.min(curr[rightIndex], minCost);
+ }
+
+ // If there was no total cost for this entire iteration to transform right to left[0..leftIndex], there
+ // can not be a way to do it below threshold. This is because we have no way to reduce the overall cost
+ // in later operations.
+ if (minCost > threshold) {
+ return -1;
+ }
+
+ // Rotate arrays for next iteration
+ temp = prevPrev;
+ prevPrev = prev;
+ prev = curr;
+ curr = temp;
+ }
+
+ // Prev contains the value computed in the latest iteration
+ return clampDistance(prev[rightLength], threshold);
+ }
+
+ /**
+ * Finds the Damerau-Levenshtein distance between two inputs using optimal string alignment.
+ *
+ * @param left the first CharSequence, must not be null.
+ * @param right the second CharSequence, must not be null.
+ * @return result distance.
+ * @throws IllegalArgumentException if either CharSequence input is {@code null}.
+ */
+ private static int unlimitedCompare(SimilarityInput left, SimilarityInput right) {
+ if (left == null || right == null) {
+ throw new IllegalArgumentException("Left/right inputs must not be null");
+ }
+
+ /*
+ * Implementation based on https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance#Optimal_string_alignment_distance
+ */
+
+ int leftLength = left.length();
+ int rightLength = right.length();
+
+ if (leftLength == 0) {
+ return rightLength;
+ }
+
+ if (rightLength == 0) {
+ return leftLength;
+ }
+
+ // Inspired by LevenshteinDistance impl; swap the input strings to consume less memory
+ if (rightLength > leftLength) {
+ final SimilarityInput tmp = left;
+ left = right;
+ right = tmp;
+ leftLength = rightLength;
+ rightLength = right.length();
+ }
+
+ // Use three arrays of minimum possible size to reduce memory usage. This avoids having to create a 2D
+ // array of size leftLength * rightLength
+ int[] curr = new int[rightLength + 1];
+ int[] prev = new int[rightLength + 1];
+ int[] prevPrev = new int[rightLength + 1];
+ int[] temp; // Temp variable use to shuffle arrays at the end of each iteration
+
+ int rightIndex, leftIndex, cost;
+
+ // Changing empty sequence to [0..i] requires i insertions
+ for (rightIndex = 0; rightIndex <= rightLength; rightIndex++) {
+ prev[rightIndex] = rightIndex;
+ }
+
+ // Calculate how many operations it takes to change right[0..rightIndex] into left[0..leftIndex]
+ // For each iteration
+ // - curr[i] contains the cost of changing right[0..i] into left[0..leftIndex]
+ // (computed in current iteration)
+ // - prev[i] contains the cost of changing right[0..i] into left[0..leftIndex - 1]
+ // (computed in previous iteration)
+ // - prevPrev[i] contains the cost of changing right[0..i] into left[0..leftIndex - 2]
+ // (computed in iteration before previous)
+ for (leftIndex = 1; leftIndex <= leftLength; leftIndex++) {
+ // For right[0..0] we must insert leftIndex characters, which means the cost is always leftIndex
+ curr[0] = leftIndex;
+
+ for (rightIndex = 1; rightIndex <= rightLength; rightIndex++) {
+ cost = (left.at(leftIndex - 1) == right.at(rightIndex - 1)) ? 0 : 1;
+
+ // Select cheapest operation
+ curr[rightIndex] = Math.min(
+ Math.min(
+ prev[rightIndex] + 1, // Delete current character
+ curr[rightIndex - 1] + 1 // Insert current character
+ ),
+ prev[rightIndex - 1] + cost // Replace (or no cost if same character)
+ );
+
+ // Check if adjacent characters are the same -> transpose if cheaper
+ if (leftIndex > 1
+ && rightIndex > 1
+ && left.at(leftIndex - 1) == right.at(rightIndex - 2)
+ && left.at(leftIndex - 2) == right.at(rightIndex - 1)) {
+ // Use cost here, to properly handle two subsequent equal letters
+ curr[rightIndex] = Math.min(curr[rightIndex], prevPrev[rightIndex - 2] + cost);
+ }
+ }
+
+ // Rotate arrays for next iteration
+ temp = prevPrev;
+ prevPrev = prev;
+ prev = curr;
+ curr = temp;
+ }
+
+ // Prev contains the value computed in the latest iteration
+ return prev[rightLength];
+ }
+
+ /**
+ * Threshold.
+ */
+ private final Integer threshold;
+
+ /**
+ * Constructs a default instance that uses a version of the algorithm that does not use a threshold parameter.
+ */
+ public DamerauLevenshteinDistance() {
+ this(null);
+ }
+
+ /**
+ * Constructs a new instance. If the threshold is not null, distance calculations will be limited to a maximum length.
+ * If the threshold is null, the unlimited version of the algorithm will be used.
+ *
+ * @param threshold If this is null then distances calculations will not be limited. This may not be negative.
+ */
+ public DamerauLevenshteinDistance(final Integer threshold) {
+ if (threshold != null && threshold < 0) {
+ throw new IllegalArgumentException("Threshold must not be negative");
+ }
+ this.threshold = threshold;
+ }
+
+ /**
+ * Computes the Damerau-Levenshtein distance between two Strings.
+ *
+ *
+ * A higher score indicates a greater distance.
+ *
+ *
+ * @param left the first input, must not be null.
+ * @param right the second input, must not be null.
+ * @return result distance, or -1 if threshold is exceeded.
+ * @throws IllegalArgumentException if either String input {@code null}.
+ */
+ @Override
+ public Integer apply(final CharSequence left, final CharSequence right) {
+ return apply(SimilarityInput.input(left), SimilarityInput.input(right));
+ }
+
+ /**
+ * Computes the Damerau-Levenshtein distance between two inputs.
+ *
+ *
+ * A higher score indicates a greater distance.
+ *
+ *
+ * @param The type of similarity score unit.
+ * @param left the first input, must not be null.
+ * @param right the second input, must not be null.
+ * @return result distance, or -1 if threshold is exceeded.
+ * @throws IllegalArgumentException if either String input {@code null}.
+ * @since 1.13.0
+ */
+ public Integer apply(final SimilarityInput left, final SimilarityInput right) {
+ if (threshold != null) {
+ return limitedCompare(left, right, threshold);
+ }
+ return unlimitedCompare(left, right);
+ }
+
+ /**
+ * Gets the distance threshold.
+ *
+ * @return The distance threshold.
+ */
+ public Integer getThreshold() {
+ return threshold;
+ }
+}
diff --git a/src/test/java/org/apache/commons/text/similarity/DamerauLevenshteinDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/DamerauLevenshteinDistanceTest.java
new file mode 100644
index 0000000000..d1c1dcadc6
--- /dev/null
+++ b/src/test/java/org/apache/commons/text/similarity/DamerauLevenshteinDistanceTest.java
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+package org.apache.commons.text.similarity;
+
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+public class DamerauLevenshteinDistanceTest {
+
+ private static DamerauLevenshteinDistance defaultInstance;
+
+ @BeforeAll
+ static void createInstance() {
+ defaultInstance = new DamerauLevenshteinDistance();
+ }
+
+ @Test
+ void testGetThresholdDirectlyAfterObjectInstantiation() {
+ assertNull(defaultInstance.getThreshold());
+ }
+
+ @Test
+ void testGetThresholdIsCorrect() {
+ DamerauLevenshteinDistance distance = new DamerauLevenshteinDistance(10);
+
+ assertEquals(10, distance.getThreshold());
+ }
+
+ @Test
+ void testNullInputsThrowUnlimited() {
+ assertThrows(IllegalArgumentException.class, () -> defaultInstance.apply(null, "test"));
+ assertThrows(IllegalArgumentException.class, () -> defaultInstance.apply("test", null));
+ assertThrows(IllegalArgumentException.class, () -> defaultInstance.apply(null, SimilarityInput.input("test")));
+ assertThrows(IllegalArgumentException.class, () -> defaultInstance.apply(SimilarityInput.input("test"), null));
+ }
+
+ @Test
+ void testNullInputsThrowLimited() {
+ DamerauLevenshteinDistance instance = new DamerauLevenshteinDistance(10);
+
+ assertThrows(IllegalArgumentException.class, () -> instance.apply(null, "test"));
+ assertThrows(IllegalArgumentException.class, () -> instance.apply("test", null));
+ assertThrows(IllegalArgumentException.class, () -> instance.apply(null, SimilarityInput.input("test")));
+ assertThrows(IllegalArgumentException.class, () -> instance.apply(SimilarityInput.input("test"), null));
+ }
+
+ @Test
+ void testInvalidThresholdThrows() {
+ assertThrows(IllegalArgumentException.class, () -> new DamerauLevenshteinDistance(-1));
+ }
+
+ @ParameterizedTest(name = "DamerauLevenshteinDistance.unlimitedCompare(\"{0}\", \"{1}\") should return {2}")
+ @MethodSource("unlimitedDamerauLevenshteinDistanceTestCases")
+ void testCalculateDamerauLevenshteinDistance(String left, String right, int expectedDistance) {
+ int leftRightDistance = defaultInstance.apply(left, right);
+ int rightLeftDistance = defaultInstance.apply(right, left);
+
+ assertEquals(expectedDistance, leftRightDistance);
+ assertEquals(expectedDistance, rightLeftDistance);
+ }
+
+ @ParameterizedTest(name = "DamerauLevenshteinDistance.unlimitedCompare(\"{0}\", \"{1}\") should return {2} ({3})")
+ @MethodSource("unlimitedDamerauLevenshteinDistanceTestCases_SimilarityInput")
+ void testCalculateDamerauLevenshteinDistance_SimilarityInput(String left, String right, int expectedDistance, final Class> cls) {
+ SimilarityInput
- Use a StringSubstitutorReader
+ Use a StringSubstitutorReader
to avoid reading a whole file into memory as a String to perform string substitution, for example, when a Servlet filters a file to a client.
@@ -99,13 +99,13 @@ limitations under the License.
@@ -192,7 +192,7 @@ limitations under the License.
construct a complex string.
NOTE: The list of lookups available by default changed in version 1.10.0. See the documentation for
- StringLookupFactory
+ StringLookupFactory
for details and instructions on how to reproduce the previous behavior.
From 04d98c4e9d86f2f3eb04079b74885f254fcc8ee8 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 7 Nov 2025 05:58:53 -0500
Subject: [PATCH 126/265] Bump commons-io:commons-io from 2.20.0 to 2.21.0
---
pom.xml | 2 +-
src/changes/changes.xml | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/pom.xml b/pom.xml
index c34914b36d..e54d054494 100644
--- a/pom.xml
+++ b/pom.xml
@@ -109,7 +109,7 @@
commons-iocommons-io
- 2.20.0
+ 2.21.0test
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 61138101f9..e12bb48ac8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,17 +46,18 @@ The type attribute can be add,update,fix,remove.
-
- Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...).
- Inserting at end of a TextStringBuilder throws a StringIndexOutOfBoundsException.
-
- Add experimental CycloneDX VEX file #683.
- Add Damerau-Levenshtein distance #687.
-
- Bump org.apache.commons:commons-parent from 85 to 91 #704.
- Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.
- 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.19.0.
+
+ Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...).
+ Inserting at end of a TextStringBuilder throws a StringIndexOutOfBoundsException.
+
+ Add experimental CycloneDX VEX file #683.
+ Add Damerau-Levenshtein distance #687.
+
+ Bump org.apache.commons:commons-parent from 85 to 91 #704.
+ Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.
+ 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.19.0.
+ Bump commons-io:commons-io from 2.20.0 to 2.21.0.
From 271181b949d248a3f2397e67c44f834c2951486a Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 7 Nov 2025 15:18:39 -0500
Subject: [PATCH 127/265] Typo
---
CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 29041c11c4..9d1083cc5e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -69,7 +69,7 @@ Making Changes
+ Respect the original code style:
+ Only use spaces for indentation; you can check for unnecessary whitespace with `git diff` before committing.
+ 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 first.
-+ 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 is a best-practice.
++ 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 is a best practice.
Unit tests are typically in the `src/test/java` directory.
+ 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 a pull request description that is detailed enough to understand what the pull request does, how, and why.
From 9398a77cf70f668cf0a72fe5746d3e81b75bc9c7 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 8 Nov 2025 11:23:53 -0500
Subject: [PATCH 128/265] No need to override project/issueManagement/system
---
pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e54d054494..1f331014d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -414,7 +414,6 @@
https://gitbox.apache.org/repos/asf?p=commons-text.git
- jirahttps://issues.apache.org/jira/browse/TEXT
From 965f90dc297137e703cbd8d3f79b0239de5bef98 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 11 Nov 2025 07:39:01 -0500
Subject: [PATCH 129/265] Javadoc
---
.../org/apache/commons/text/lookup/StringLookupFactory.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 e3678f3ff1..229c410d39 100644
--- a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java
+++ b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java
@@ -363,7 +363,7 @@ Map getDefaultStringLookups() {
/**
* Name of the system property used to determine the string lookups added by the {@link #addDefaultStringLookups(Map)} method. Use of this property is only
- * required in cases where the set of default lookups must be modified. (See the class documentation for details.)
+ * required in cases where the set of default lookups must be modified. (See the {@link StringLookupFactory class documentation} for details.)
*
* @since 1.10.0
*/
@@ -657,6 +657,9 @@ private StringLookupFactory(final Path[] fences) {
* Adds the default string lookups for this class to {@code stringLookupMap}. The default string lookups are a set of built-in lookups added for convenience
* during string interpolation. The defaults may be configured using the {@value #DEFAULT_STRING_LOOKUPS_PROPERTY} system property. See the class
* documentation for details and a list of lookups.
+ *
+ * The format of the property string is a comma-separated list of names from the {@link DefaultStringLookup} enum.
+ *
*
* @param stringLookupMap the map of string lookups to edit.
* @since 1.5
From 0b63d06654e10418ce49f83f882531cf603bf80e Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 11 Nov 2025 07:40:04 -0500
Subject: [PATCH 130/265] Javadoc
---
.../org/apache/commons/text/lookup/StringLookupFactory.java | 3 +++
1 file changed, 3 insertions(+)
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 229c410d39..2f163b8e05 100644
--- a/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java
+++ b/src/main/java/org/apache/commons/text/lookup/StringLookupFactory.java
@@ -364,6 +364,9 @@ Map getDefaultStringLookups() {
/**
* Name of the system property used to determine the string lookups added by the {@link #addDefaultStringLookups(Map)} method. Use of this property is only
* required in cases where the set of default lookups must be modified. (See the {@link StringLookupFactory class documentation} for details.)
+ *
+ * The format of the property string is a comma-separated list of names from the {@link DefaultStringLookup} enum.
+ *
*
* @since 1.10.0
*/
From aab6439edd5c25d399d3435d8f79be20994270f9 Mon Sep 17 00:00:00 2001
From: Michael Hausegger
Date: Fri, 14 Nov 2025 19:47:03 +0100
Subject: [PATCH 131/265] Add unit tests to increase coverage (#719)
* Added new Unit Tests to increase coverage
* Remove trailing whitespace
* I verified a before-and-after JaCoCo report that each change improved coverage.
---------
Co-authored-by: TheRealHaui
Co-authored-by: Gary Gregory
---
.../commons/text/StringSubstitutorTest.java | 7 +++++++
.../text/similarity/HammingDistanceTest.java | 15 +++++++++++++++
.../text/similarity/JaroWinklerDistanceTest.java | 10 ++++++++++
.../similarity/JaroWinklerSimilarityTest.java | 10 ++++++++++
4 files changed, 42 insertions(+)
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
index 0f1fbf4339..3692653f10 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
@@ -1078,4 +1078,11 @@ void testSubstitutePreserveEscape() throws IOException {
assertEqualsCharSeq("value $${escaped}", replace(sub, org));
}
+ @Test
+ void testDetectsCyclicSubstitution() {
+ final Map map = new HashMap<>();
+ map.put("name", "");
+ assertThrows(IllegalStateException.class, () -> StringSubstitutor.replace("Hi !", map, "<", ">"));
+ }
+
}
diff --git a/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
index 181d2fe277..918a7bedc2 100644
--- a/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
@@ -59,6 +59,21 @@ void testHammingDistance_nullRightValue() {
assertThrows(IllegalArgumentException.class, () -> distance.apply("", null));
}
+ @Test
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
+ }
+
+ @Test
+ void testApply_SimilarityInputNull() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
+ }
+
+ @Test
+ void testApply_DifferentSimilarityInputLength() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), new SimilarityCharacterInput("ab")));
+ }
+
@Test
void testHammingDistanceCharSequence() {
assertEquals(0, distance.apply("", ""));
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 f1242fb301..412f1e721c 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java
@@ -95,4 +95,14 @@ void testGetJaroWinklerDistance_StringString() {
assertEquals(1 - 0.51111d, distance.apply("foo", " foo"), 0.00001d);
}
+ @Test
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
+ }
+
+ @Test
+ void testApply_SimilarityInputNull() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
+ }
+
}
diff --git a/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java b/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
index a5acfb2394..0b1f97052a 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
@@ -136,4 +136,14 @@ void testGetJaroWinklerSimilarity_StringString() {
assertEquals(0.911111d, similarity.apply(wrap("John Horn"), "John Hopkins"), 0.00001d);
}
+ @Test
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, new SimilarityCharacterInput("a")));
+ }
+
+ @Test
+ void testApply_SimilarityInputNull() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(new SimilarityCharacterInput("a"), null));
+ }
+
}
From 9280e357ac8ef9c9a8b4dc0c35985f9b6a5ef538 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 14 Nov 2025 13:49:03 -0500
Subject: [PATCH 132/265] Add unit tests to increase coverage #719
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e12bb48ac8..21c89d0d00 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,6 +52,7 @@ The type attribute can be add,update,fix,remove.
Add experimental CycloneDX VEX file #683.Add Damerau-Levenshtein distance #687.
+ Add unit tests to increase coverage #719.Bump org.apache.commons:commons-parent from 85 to 91 #704.Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.
From 0211ac6868f7329256a093de6b87c67c393cb424 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 14 Nov 2025 13:59:25 -0500
Subject: [PATCH 133/265] Sort members
---
.../commons/text/StringSubstitutorTest.java | 14 +++---
.../text/similarity/HammingDistanceTest.java | 48 +++++++++----------
.../similarity/JaroWinklerDistanceTest.java | 20 ++++----
.../similarity/JaroWinklerSimilarityTest.java | 28 +++++------
4 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
index 3692653f10..75f112ba6b 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
@@ -228,6 +228,13 @@ void testConstructorStringSubstitutor() {
assertTrue(target.getVariableSuffixMatcher().toString().endsWith("['s']"), target.getValueDelimiterMatcher().toString());
}
+ @Test
+ void testDetectsCyclicSubstitution() {
+ final Map map = new HashMap<>();
+ map.put("name", "");
+ assertThrows(IllegalStateException.class, () -> StringSubstitutor.replace("Hi !", map, "<", ">"));
+ }
+
/**
* Tests get set.
*/
@@ -1078,11 +1085,4 @@ void testSubstitutePreserveEscape() throws IOException {
assertEqualsCharSeq("value $${escaped}", replace(sub, org));
}
- @Test
- void testDetectsCyclicSubstitution() {
- final Map map = new HashMap<>();
- map.put("name", "");
- assertThrows(IllegalStateException.class, () -> StringSubstitutor.replace("Hi !", map, "<", ">"));
- }
-
}
diff --git a/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
index 918a7bedc2..0b8e5e133c 100644
--- a/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
@@ -36,42 +36,42 @@ public static void setUp() {
distance = new HammingDistance();
}
- @ParameterizedTest
- @MethodSource("org.apache.commons.text.similarity.SimilarityInputTest#similarityInputsEquals()")
- void testHammingDistance(final Class> cls) {
- assertEquals(0, distance.apply(SimilarityInputTest.build(cls, ""), SimilarityInputTest.build(cls, "")));
- assertEquals(0, distance.apply(SimilarityInputTest.build(cls, "pappa"), SimilarityInputTest.build(cls, "pappa")));
- assertEquals(1, distance.apply(SimilarityInputTest.build(cls, "papaa"), SimilarityInputTest.build(cls, "pappa")));
- assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kathrin")));
- assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kerstin")));
- assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "1011101"), SimilarityInputTest.build(cls, "1001001")));
- assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "2173896"), SimilarityInputTest.build(cls, "2233796")));
- assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "ATCG"), SimilarityInputTest.build(cls, "ACCC")));
+ @Test
+ void testApply_DifferentSimilarityInputLength() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), new SimilarityCharacterInput("ab")));
}
@Test
- void testHammingDistance_nullLeftValue() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(null, ""));
- }
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
+ }
@Test
- void testHammingDistance_nullRightValue() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply("", null));
+ void testApply_SimilarityInputNull() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
}
- @Test
- void testApply_NullSimilarityInput() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
- }
+ @ParameterizedTest
+ @MethodSource("org.apache.commons.text.similarity.SimilarityInputTest#similarityInputsEquals()")
+ void testHammingDistance(final Class> cls) {
+ assertEquals(0, distance.apply(SimilarityInputTest.build(cls, ""), SimilarityInputTest.build(cls, "")));
+ assertEquals(0, distance.apply(SimilarityInputTest.build(cls, "pappa"), SimilarityInputTest.build(cls, "pappa")));
+ assertEquals(1, distance.apply(SimilarityInputTest.build(cls, "papaa"), SimilarityInputTest.build(cls, "pappa")));
+ assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kathrin")));
+ assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kerstin")));
+ assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "1011101"), SimilarityInputTest.build(cls, "1001001")));
+ assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "2173896"), SimilarityInputTest.build(cls, "2233796")));
+ assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "ATCG"), SimilarityInputTest.build(cls, "ACCC")));
+ }
@Test
- void testApply_SimilarityInputNull() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
+ void testHammingDistance_nullLeftValue() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(null, ""));
}
@Test
- void testApply_DifferentSimilarityInputLength() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), new SimilarityCharacterInput("ab")));
+ void testHammingDistance_nullRightValue() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply("", null));
}
@Test
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 412f1e721c..509d58bb59 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaroWinklerDistanceTest.java
@@ -36,6 +36,16 @@ public static void setUp() {
distance = new JaroWinklerDistance();
}
+ @Test
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
+ }
+
+ @Test
+ void testApply_SimilarityInputNull() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
+ }
+
@ParameterizedTest
@MethodSource("org.apache.commons.text.similarity.SimilarityInputTest#similarityInputsEquals()")
void testGetJaroWinklerDistance(final Class> cls) {
@@ -95,14 +105,4 @@ void testGetJaroWinklerDistance_StringString() {
assertEquals(1 - 0.51111d, distance.apply("foo", " foo"), 0.00001d);
}
- @Test
- void testApply_NullSimilarityInput() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
- }
-
- @Test
- void testApply_SimilarityInputNull() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
- }
-
}
diff --git a/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java b/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
index 0b1f97052a..f2a362dc12 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
@@ -78,6 +78,16 @@ public String toString() {
};
}
+ @Test
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, new SimilarityCharacterInput("a")));
+ }
+
+ @Test
+ void testApply_SimilarityInputNull() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(new SimilarityCharacterInput("a"), null));
+ }
+
@ParameterizedTest
@MethodSource("org.apache.commons.text.similarity.SimilarityInputTest#similarityInputsEquals()")
void testGetJaroWinklerSimilarity(final Class> cls) {
@@ -111,10 +121,10 @@ void testGetJaroWinklerSimilarity_NullString() {
assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, "clear"));
}
- @Test
- void testGetJaroWinklerSimilarity_StringNull() {
- assertThrows(IllegalArgumentException.class, () -> similarity.apply(" ", null));
- }
+ @Test
+ void testGetJaroWinklerSimilarity_StringNull() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(" ", null));
+ }
@Test
void testGetJaroWinklerSimilarity_StringString() {
@@ -136,14 +146,4 @@ void testGetJaroWinklerSimilarity_StringString() {
assertEquals(0.911111d, similarity.apply(wrap("John Horn"), "John Hopkins"), 0.00001d);
}
- @Test
- void testApply_NullSimilarityInput() {
- assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, new SimilarityCharacterInput("a")));
- }
-
- @Test
- void testApply_SimilarityInputNull() {
- assertThrows(IllegalArgumentException.class, () -> similarity.apply(new SimilarityCharacterInput("a"), null));
- }
-
}
From b696bda8326f196803af3deee16528fc8c7400a0 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 15 Nov 2025 08:48:47 -0500
Subject: [PATCH 134/265] No tabs for you
---
.../text/similarity/HammingDistanceTest.java | 32 +++++++++----------
.../similarity/JaroWinklerSimilarityTest.java | 16 +++++-----
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
index 0b8e5e133c..7eb744856e 100644
--- a/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/HammingDistanceTest.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.text.similarity;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -42,27 +43,27 @@ void testApply_DifferentSimilarityInputLength() {
}
@Test
- void testApply_NullSimilarityInput() {
- assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
- }
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> distance.apply(null, new SimilarityCharacterInput("a")));
+ }
@Test
void testApply_SimilarityInputNull() {
assertThrows(IllegalArgumentException.class, () -> distance.apply(new SimilarityCharacterInput("a"), null));
}
- @ParameterizedTest
- @MethodSource("org.apache.commons.text.similarity.SimilarityInputTest#similarityInputsEquals()")
- void testHammingDistance(final Class> cls) {
- assertEquals(0, distance.apply(SimilarityInputTest.build(cls, ""), SimilarityInputTest.build(cls, "")));
- assertEquals(0, distance.apply(SimilarityInputTest.build(cls, "pappa"), SimilarityInputTest.build(cls, "pappa")));
- assertEquals(1, distance.apply(SimilarityInputTest.build(cls, "papaa"), SimilarityInputTest.build(cls, "pappa")));
- assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kathrin")));
- assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kerstin")));
- assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "1011101"), SimilarityInputTest.build(cls, "1001001")));
- assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "2173896"), SimilarityInputTest.build(cls, "2233796")));
- assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "ATCG"), SimilarityInputTest.build(cls, "ACCC")));
- }
+ @ParameterizedTest
+ @MethodSource("org.apache.commons.text.similarity.SimilarityInputTest#similarityInputsEquals()")
+ void testHammingDistance(final Class> cls) {
+ assertEquals(0, distance.apply(SimilarityInputTest.build(cls, ""), SimilarityInputTest.build(cls, "")));
+ assertEquals(0, distance.apply(SimilarityInputTest.build(cls, "pappa"), SimilarityInputTest.build(cls, "pappa")));
+ assertEquals(1, distance.apply(SimilarityInputTest.build(cls, "papaa"), SimilarityInputTest.build(cls, "pappa")));
+ assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kathrin")));
+ assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "karolin"), SimilarityInputTest.build(cls, "kerstin")));
+ assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "1011101"), SimilarityInputTest.build(cls, "1001001")));
+ assertEquals(3, distance.apply(SimilarityInputTest.build(cls, "2173896"), SimilarityInputTest.build(cls, "2233796")));
+ assertEquals(2, distance.apply(SimilarityInputTest.build(cls, "ATCG"), SimilarityInputTest.build(cls, "ACCC")));
+ }
@Test
void testHammingDistance_nullLeftValue() {
@@ -85,5 +86,4 @@ void testHammingDistanceCharSequence() {
assertEquals(3, distance.apply("2173896", "2233796"));
assertEquals(2, distance.apply("ATCG", "ACCC"));
}
-
}
diff --git a/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java b/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
index f2a362dc12..55986ab59d 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaroWinklerSimilarityTest.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.text.similarity;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -79,9 +80,9 @@ public String toString() {
}
@Test
- void testApply_NullSimilarityInput() {
- assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, new SimilarityCharacterInput("a")));
- }
+ void testApply_NullSimilarityInput() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, new SimilarityCharacterInput("a")));
+ }
@Test
void testApply_SimilarityInputNull() {
@@ -121,10 +122,10 @@ void testGetJaroWinklerSimilarity_NullString() {
assertThrows(IllegalArgumentException.class, () -> similarity.apply(null, "clear"));
}
- @Test
- void testGetJaroWinklerSimilarity_StringNull() {
- assertThrows(IllegalArgumentException.class, () -> similarity.apply(" ", null));
- }
+ @Test
+ void testGetJaroWinklerSimilarity_StringNull() {
+ assertThrows(IllegalArgumentException.class, () -> similarity.apply(" ", null));
+ }
@Test
void testGetJaroWinklerSimilarity_StringString() {
@@ -145,5 +146,4 @@ void testGetJaroWinklerSimilarity_StringString() {
assertEquals(0.941666d, similarity.apply(wrap("aaabcd"), "aaacdb"), 0.00001d);
assertEquals(0.911111d, similarity.apply(wrap("John Horn"), "John Hopkins"), 0.00001d);
}
-
}
From 4d8b9098e05f21e7abaa3bc6300a950c8faa4010 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 15 Nov 2025 08:49:54 -0500
Subject: [PATCH 135/265] Bump github/codeql-action from 4.31.2 to 4.31.3
(#721)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.2 to 4.31.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/0499de31b99561a6d14a36a5f662c2a54f91beee...014f16e7ab1402f30e7c3329d33797e7948572db)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 4.31.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.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 a04eb0532f..a3881f0766 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@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/init@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
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@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/autobuild@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
# âšī¸ 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@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 2372664fcd..8f94802660 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@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/upload-sarif@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
with:
sarif_file: results.sarif
From 45584f05c622e80511ae6327220a59c29d6c0da2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 15 Nov 2025 08:50:04 -0500
Subject: [PATCH 136/265] Bump actions/dependency-review-action from 4.8.1 to
4.8.2 (#720)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.8.1 to 4.8.2.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/40c09b7dc99638e5ddb0bfd91c1673effc064d8a...3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261)
---
updated-dependencies:
- dependency-name: actions/dependency-review-action
dependency-version: 4.8.2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
.github/workflows/dependency-review.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index a657a4ae2c..11834ed9d1 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -28,4 +28,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1
+ uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
From d255668d8971dc0f76e399d35dce4e3db3752c08 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 15 Nov 2025 08:55:57 -0500
Subject: [PATCH 137/265] Bump org.apache.commons:commons-parent from 91 to 92
(#723)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 91 to 92.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-version: '92'
dependency-type: direct:production
update-type: version-update:semver-major
...
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 1f331014d0..5d2afd3371 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.apache.commonscommons-parent
- 91
+ 92commons-text1.15.0-SNAPSHOT
From 5c4c7c35952f4654ef872881fd59d60fd995245d Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 15 Nov 2025 08:56:25 -0500
Subject: [PATCH 138/265] Bump org.apache.commons:commons-parent from 91 to 92
#723
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 21c89d0d00..5f913a9d7a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,7 +54,7 @@ The type attribute can be add,update,fix,remove.
Add Damerau-Levenshtein distance #687.Add unit tests to increase coverage #719.
- Bump org.apache.commons:commons-parent from 85 to 91 #704.
+ Bump org.apache.commons:commons-parent from 85 to 92 #704, #723.Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.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.19.0.
From d7bc06c49f28cbbde09c01990b5a3c3ca9a14036 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 15 Nov 2025 08:56:46 -0500
Subject: [PATCH 139/265] Fix typo in exception message for TextStringBuilder
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5f913a9d7a..b24bd1a0f9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,7 +48,7 @@ The type attribute can be add,update,fix,remove.
Fix exception message typo in XmlStringLookup.XmlStringLookup(Map, Path...).
- Inserting at end of a TextStringBuilder throws a StringIndexOutOfBoundsException.
+ Inserting at the end of a TextStringBuilder throws a StringIndexOutOfBoundsException.Add experimental CycloneDX VEX file #683.Add Damerau-Levenshtein distance #687.
From 2b229580f64e8c3cd39e6d172e728e00f21a14cc Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 15 Nov 2025 09:04:17 -0500
Subject: [PATCH 140/265] Bump commons.bytebuddy.version from 1.17.8 to 1.18.1
(#722)
Bumps `commons.bytebuddy.version` from 1.17.8 to 1.18.1.
Updates `net.bytebuddy:byte-buddy` from 1.17.8 to 1.18.1
- [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.17.8...byte-buddy-1.18.1)
Updates `net.bytebuddy:byte-buddy-agent` from 1.17.8 to 1.18.1
- [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.17.8...byte-buddy-1.18.1)
---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
dependency-version: 1.18.1
dependency-type: direct:development
update-type: version-update:semver-minor
- dependency-name: net.bytebuddy:byte-buddy-agent
dependency-version: 1.18.1
dependency-type: direct:development
update-type: version-update:semver-minor
...
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 5d2afd3371..fa0d58d927 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,7 @@
https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-textsite-content3.19.0
- 1.17.8
+ 1.18.11.6false1.37
From 213a883d915799e2b087ab28099536a9d7e1b1c6 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 15 Nov 2025 09:05:03 -0500
Subject: [PATCH 141/265] Bump commons.bytebuddy.version from 1.17.8 to 1.18.1
#722
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b24bd1a0f9..260ef37daa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -55,7 +55,7 @@ The type attribute can be add,update,fix,remove.
Add unit tests to increase coverage #719.Bump org.apache.commons:commons-parent from 85 to 92 #704, #723.
- Bump commons.bytebuddy.version from 1.17.6 to 1.17.8 #696.
+ Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #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.19.0.Bump commons-io:commons-io from 2.20.0 to 2.21.0.
From b1f661539eac561501a8a860a3f140bc6937c8d4 Mon Sep 17 00:00:00 2001
From: Sebb
Date: Sat, 15 Nov 2025 17:45:49 +0000
Subject: [PATCH 142/265] Dependabot => quarterly
---
.github/dependabot.yml | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 00079caf1b..90ec55f742 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -18,10 +18,8 @@ updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
- interval: "weekly"
- day: "friday"
+ interval: "quarterly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
- interval: "weekly"
- day: "friday"
+ interval: "quarterly"
From b2b5b978ccc1cdcf08e8812f17657a71bdf3b092 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 16 Nov 2025 09:56:56 -0500
Subject: [PATCH 143/265] Bump commons-lang3 from 3.19.0 to 3.20.0
---
pom.xml | 2 +-
src/changes/changes.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index fa0d58d927..4b221340f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,7 +47,7 @@
texthttps://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-textsite-content
- 3.19.0
+ 3.20.01.18.11.6false
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 260ef37daa..a72d382cf3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -57,7 +57,7 @@ The type attribute can be add,update,fix,remove.
Bump org.apache.commons:commons-parent from 85 to 92 #704, #723.Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #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.19.0.
+ 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.
From c3c3b598220b63aa1776c56482dd4a9345379783 Mon Sep 17 00:00:00 2001
From: Michael Hausegger
Date: Tue, 18 Nov 2025 18:47:20 +0100
Subject: [PATCH 144/265] TextStringBuilderTest#testAppendToStringBuffer
appends to StringBuffer now (#724)
Co-authored-by: TheRealHaui
---
.../java/org/apache/commons/text/TextStringBuilderTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
index 8ef3eaa111..3317543f73 100644
--- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
@@ -246,7 +246,7 @@ void testAppendToCharBuffer() throws Exception {
@Test
void testAppendToStringBuffer() throws Exception {
final TextStringBuilder sb = new TextStringBuilder("1234567890");
- final StringBuilder buffer = new StringBuilder("Test ");
+ final StringBuffer buffer = new StringBuffer("Test ");
sb.appendTo(buffer);
From eb00fd532ac4e3e59772939d434aaf7224fb5246 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Tue, 18 Nov 2025 12:49:03 -0500
Subject: [PATCH 145/265] Fix TextStringBuilderTest.testAppendToCharBuffer() to
use proper argument type #724
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a72d382cf3..ef5abe56ee 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -49,6 +49,7 @@ The type attribute can be add,update,fix,remove.
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.Add experimental CycloneDX VEX file #683.Add Damerau-Levenshtein distance #687.
From 6f42263ec6e78cf86b697f936a5bed054068c3d6 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 21 Nov 2025 14:25:44 +0000
Subject: [PATCH 146/265] Use HTTPS to download XML Schema
---
src/site/xdoc/download_text.xml | 2 +-
src/site/xdoc/issue-tracking.xml | 2 +-
src/site/xdoc/mail-lists.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/site/xdoc/download_text.xml b/src/site/xdoc/download_text.xml
index 12c6a1a08a..4f7cbc7c3a 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="https://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
Download Apache Commons TextApache Commons Team
diff --git a/src/site/xdoc/issue-tracking.xml b/src/site/xdoc/issue-tracking.xml
index 83219a0dd5..9ef2de7e3f 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="https://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
Apache Commons Text Issue trackingApache Commons Team
diff --git a/src/site/xdoc/mail-lists.xml b/src/site/xdoc/mail-lists.xml
index 806e21bb19..c8734db5fb 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="https://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
Apache Commons Text Mailing ListsApache Commons Team
From db60004c6bdc6d1b15c39fb04c4e9e022d1e1700 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 21 Nov 2025 14:44:48 +0000
Subject: [PATCH 147/265] Bump CodeQL 4.31.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 a3881f0766..60d115d843 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@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
+ uses: github/codeql-action/init@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # 4.31.4
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@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
+ uses: github/codeql-action/autobuild@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # 4.31.4
# âšī¸ 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@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
+ uses: github/codeql-action/analyze@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # 4.31.4
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 8f94802660..d0348717cf 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@014f16e7ab1402f30e7c3329d33797e7948572db # 3.29.5
+ uses: github/codeql-action/upload-sarif@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # 4.31.4
with:
sarif_file: results.sarif
From 66bafadc42c722ce8e8f99f318408ba5baca13b8 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 21 Nov 2025 19:46:51 +0000
Subject: [PATCH 148/265] Bump actions/checkout from v5.0.0 to v6.0.0
---
.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 60d115d843..db1d51c381 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 11834ed9d1..b58ce93016 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- 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 6724e87101..882c73abbd 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -34,7 +34,7 @@ jobs:
experimental: true
steps:
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
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 d0348717cf..4270678db1 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
From 13fe39124867d03110513304edda1312c5c6f0db Mon Sep 17 00:00:00 2001
From: Michael Hausegger
Date: Fri, 21 Nov 2025 23:22:10 +0100
Subject: [PATCH 149/265] Added new test for CharSequenceTranslator#with.
(#725)
* Added new test for CharSequenceTranslator#with.
* Fixed typo
* Reduce whitespace
---------
Co-authored-by: TheRealHaui
Co-authored-by: Gary Gregory
---
src/changes/changes.xml | 2 +-
.../translate/CharSequenceTranslatorTest.java | 53 +++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
create mode 100644 src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ef5abe56ee..e9c6b331a8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -49,7 +49,7 @@ The type attribute can be add,update,fix,remove.
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 TextStringBuilderTest.testAppendToCharBuffer() to use proper argument type #724.Add experimental CycloneDX VEX file #683.Add Damerau-Levenshtein distance #687.
diff --git a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java
new file mode 100644
index 0000000000..8bc38cae71
--- /dev/null
+++ b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+ package org.apache.commons.text.translate;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.junit.jupiter.api.Test;
+
+
+class CharSequenceTranslatorTest {
+
+ //Used to count translate invocations
+ private int translateInvocationCounter;
+
+ @Test
+ void testWith() throws IOException {
+ CharSequenceTranslator charSequenceTranslatorOne = new TestCharSequenceTranslator();
+ CharSequenceTranslator charSequenceTranslatorTwo = new TestCharSequenceTranslator();
+ CharSequenceTranslator charSequenceTranslatorThree = new TestCharSequenceTranslator();
+ CharSequenceTranslator aggregatedTranslator = charSequenceTranslatorOne.with(charSequenceTranslatorTwo, charSequenceTranslatorThree);
+ aggregatedTranslator.translate("", 0, null);
+ assertTrue(aggregatedTranslator instanceof AggregateTranslator);
+ assertEquals(3, translateInvocationCounter);
+ }
+
+ private final class TestCharSequenceTranslator extends CharSequenceTranslator {
+ @Override
+ public int translate(final CharSequence input, final int index, final Writer writer) {
+ translateInvocationCounter++;
+ return 0;
+ }
+
+ }
+
+}
From 8625878805284992c76ce3a5b0d32fb177f667e3 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 21 Nov 2025 22:24:39 +0000
Subject: [PATCH 150/265] Sort members
Use final
---
.../translate/CharSequenceTranslatorTest.java | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
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 8bc38cae71..7585f71df1 100644
--- a/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java
+++ b/src/test/java/org/apache/commons/text/translate/CharSequenceTranslatorTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.text.translate;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.io.Writer;
@@ -27,27 +27,27 @@
class CharSequenceTranslatorTest {
+ private final class TestCharSequenceTranslator extends CharSequenceTranslator {
+ @Override
+ public int translate(final CharSequence input, final int index, final Writer writer) {
+ translateInvocationCounter++;
+ return 0;
+ }
+
+ }
+
//Used to count translate invocations
private int translateInvocationCounter;
@Test
void testWith() throws IOException {
- CharSequenceTranslator charSequenceTranslatorOne = new TestCharSequenceTranslator();
- CharSequenceTranslator charSequenceTranslatorTwo = new TestCharSequenceTranslator();
- CharSequenceTranslator charSequenceTranslatorThree = new TestCharSequenceTranslator();
- CharSequenceTranslator aggregatedTranslator = charSequenceTranslatorOne.with(charSequenceTranslatorTwo, charSequenceTranslatorThree);
+ 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);
assertTrue(aggregatedTranslator instanceof AggregateTranslator);
assertEquals(3, translateInvocationCounter);
}
- private final class TestCharSequenceTranslator extends CharSequenceTranslator {
- @Override
- public int translate(final CharSequence input, final int index, final Writer writer) {
- translateInvocationCounter++;
- return 0;
- }
-
- }
-
}
From 2eb7d4c39119b7b6419794d2a0c4488afc8044e2 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Fri, 21 Nov 2025 22:26:29 +0000
Subject: [PATCH 151/265] Add new test for CharSequenceTranslator#with() #725
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e9c6b331a8..963c8aa72d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,6 +54,7 @@ The type attribute can be add,update,fix,remove.
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.Bump org.apache.commons:commons-parent from 85 to 92 #704, #723.Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #696, #722.
From ecff9a0ad3c7a6287532fa3a4293d41dc810a12f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 22 Nov 2025 08:53:12 -0500
Subject: [PATCH 152/265] Bump org.apache.commons:commons-parent from 92 to 93
(#726)
Bumps org.apache.commons:commons-parent from 92 to 93.
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
dependency-version: '93'
dependency-type: direct:production
update-type: version-update:semver-major
...
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 4b221340f6..b173021fd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
org.apache.commonscommons-parent
- 92
+ 93commons-text1.15.0-SNAPSHOT
From 05a02e16240d8f4d3f6c623acee41ec916e29440 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sat, 22 Nov 2025 08:53:43 -0500
Subject: [PATCH 153/265] Bump org.apache.commons:commons-parent from 92 to 93
#726
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 963c8aa72d..4a2aaa1c8b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,7 +56,7 @@ The type attribute can be add,update,fix,remove.
Add unit tests to increase coverage #719.Add new test for CharSequenceTranslator#with() #725.
- Bump org.apache.commons:commons-parent from 85 to 92 #704, #723.
+ Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726.Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #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.
From fa7a253aaea60059e418563ee31a3807b8fe5bcd Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Sun, 23 Nov 2025 10:01:41 -0500
Subject: [PATCH 154/265] Fix Apache RAT plugin console warnings
---
pom.xml | 16 ++++++++--------
src/changes/changes.xml | 1 +
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index b173021fd3..5a00fd7778 100644
--- a/pom.xml
+++ b/pom.xml
@@ -139,14 +139,14 @@
org.apache.ratapache-rat-plugin
-
- site-content/**
- 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/**
-
+
+ site-content/**
+ 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/changes/changes.xml b/src/changes/changes.xml
index 4a2aaa1c8b..b901a067ea 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,7 @@ The type attribute can be add,update,fix,remove.
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.Add experimental CycloneDX VEX file #683.Add Damerau-Levenshtein distance #687.
From 0c52aa1449895c24088f694f2883fdc3b90e1248 Mon Sep 17 00:00:00 2001
From: Michael Hausegger
Date: Wed, 26 Nov 2025 14:00:14 +0100
Subject: [PATCH 155/265] Added new tests for equals method for
SimilarityCharacterInput class (#727)
Co-authored-by: TheRealHaui
---
.../commons/text/similarity/SimilarityCharacterInputTest.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/test/java/org/apache/commons/text/similarity/SimilarityCharacterInputTest.java b/src/test/java/org/apache/commons/text/similarity/SimilarityCharacterInputTest.java
index a8d2ae8400..218fce1916 100644
--- a/src/test/java/org/apache/commons/text/similarity/SimilarityCharacterInputTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/SimilarityCharacterInputTest.java
@@ -42,6 +42,8 @@ void testEquals(final Class> cls) {
assertNotEquals(similarityInput1, similarityInput4);
assertNotEquals(similarityInput2, similarityInput4);
assertNotEquals(similarityInput3, similarityInput4);
+ assertNotEquals(similarityInput1, null);
+ assertNotEquals(similarityInput1, new Object());
}
@ParameterizedTest
From 5f0833414a8a5f498f0e04de47235644f97b0f7a Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 26 Nov 2025 08:01:47 -0500
Subject: [PATCH 156/265] Add test assertions for
SimilarityCharacterInput#equals() class #727
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b901a067ea..741b7fc46b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,6 +56,7 @@ The type attribute can be add,update,fix,remove.
Add Damerau-Levenshtein distance #687.Add unit tests to increase coverage #719.Add new test for CharSequenceTranslator#with() #725.
+ Add test assertions for SimilarityCharacterInput#equals() class #727.Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726.Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #696, #722.
From b9fac67ec0cd764924a5dc9181c8bc76fa14c6b5 Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 26 Nov 2025 08:02:22 -0500
Subject: [PATCH 157/265] Add test assertions for
SimilarityCharacterInput#equals() #727
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 741b7fc46b..a04993582f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,7 +56,7 @@ The type attribute can be add,update,fix,remove.
Add Damerau-Levenshtein distance #687.Add unit tests to increase coverage #719.Add new test for CharSequenceTranslator#with() #725.
- Add test assertions for SimilarityCharacterInput#equals() class #727.
+ Add test assertions for SimilarityCharacterInput#equals() #727.Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726.Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #696, #722.
From 1c87739cbbc866c7ed0eb7fd110688070e3adcca Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 26 Nov 2025 13:06:18 +0000
Subject: [PATCH 158/265] Fix site XML to use version 2.0.0 XML schema
---
src/changes/changes.xml | 3 ++-
src/site/site.xml | 16 ++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a04993582f..c6de2b3687 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,12 +51,13 @@ The type attribute can be add,update,fix,remove.
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.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 test assertions for SimilarityCharacterInput#equals() #727.
+ Add test assertions for SimilarityCharacterInput#equals() #727.Bump org.apache.commons:commons-parent from 85 to 93 #704, #723, #726.Bump commons.bytebuddy.version from 1.17.6 to 1.18.1 #696, #722.
diff --git a/src/site/site.xml b/src/site/site.xml
index cf3fee8aaf..484a229cc1 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -15,13 +15,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
- Commons Text
- /images/logo.png
- /index.html
-
-
+
+
+
+
+
From 3f5295bfa4032058a838290d1c888096da2204bd Mon Sep 17 00:00:00 2001
From: Gary Gregory
Date: Wed, 26 Nov 2025 13:09:26 +0000
Subject: [PATCH 159/265] Use new oak leaf logo
---
src/media/commons-logo-component-100.xcf | Bin 0 -> 25475 bytes
src/media/commons-logo-component.xcf | Bin 0 -> 150711 bytes
src/media/logo.png | Bin 0 -> 9454 bytes
src/media/logo.xcf | Bin 17288 -> 0 bytes
src/site/resources/images/logo.png | Bin 10143 -> 9454 bytes
5 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 src/media/commons-logo-component-100.xcf
create mode 100644 src/media/commons-logo-component.xcf
create mode 100644 src/media/logo.png
delete mode 100644 src/media/logo.xcf
diff --git a/src/media/commons-logo-component-100.xcf b/src/media/commons-logo-component-100.xcf
new file mode 100644
index 0000000000000000000000000000000000000000..daba87fdaf87936496a613d983e7a1a63c9817a3
GIT binary patch
literal 25475
zcmd6vd3;>Ok@$PwTpDR~OV(|TM%RpN+46m2j5&+}V`E!@jlq_6*ut_T>%g)#gUKCW
z*=!QR8Inyl$%f6fY_8w$myi&$2?+^c3x|M@T!aO}jcr{s^ZNI#_ePd%%qG9=KR@a7
z=5gei8
z4e%GTl7Zlc+SRqIYA*`3b#yiL1p{*y27+4~{+s`~4GmitEeZx2!Z6(N|G>~LXmS4U
zl1a`3z1>aC?VURVa~h~;|5;EHsPFG=?+dhdHt%Zfg=V0ut*y7U55b_HlD3m)6QeUV
zb2Um^-_zCH+S1?CdU020Tl>xp{hjq~?H#T4-JLt@TL-$kdiv@+ntJ<$UKCmzYVYi8
z?dfQuP@uDmnwq=zboaFO_O^F*29^Nt*uAqQu-_6$Dz=HbckS;@BKz9+v?i0iO}Dhx
z_w_V&(w?5y&OV#As~eK`1BlSn(c0J7YGd2FdiFH+1%gfeeO*DSq17GzEv?Ad-eyxw
zVA{L;n$N}zV0Mf6=7XGdpKd&k*mTDj+pgqE>QV1gI-v^Mpj
zjeYHXy8^4%tX+?IqOQCtHo2#@uc@V}uPLcUW6tsm2ljLXZfWfiy<-W%Y||FIs{a4v$1JU
zcSmb*#o_?}%V$IS{za^USG9KT?AsMwF{h#7Zy~>~y+x?!E|~XMsMqzhqo}4n+6D8!
zLcF1sk=ZY_jhHg*{|f!}lLdk+<~20T{%aL%{@V+z-__OEHS1#W4;vYJ=yD2kQM-(~
z)&R!d);@4Su&=$XEg0zU>9`=ctFNzn>Fn8^y|bEHx^}eA!Zc<}_H4R!c5ub=*=I_h
z(7FHov(Bru<+CSyUkqo;pS!~b=FOdgJU96dAa?MGqfEO9;diwLX3d%
zPu4d(+1#K#4cd@2H!#s?JI9(N1#i&_B!3~n>}u-W6$m!B%vm_6c}LT{rg_aR&20-8
zH?=I9J7>w!KZtnwyujF5J=7vS3cb+(nC<=e0G>TeP@k$()wCI7*wR
z{TXWO@92=B5(uuPj^5Uu9z6cq)|U4EJ?|lH+SA^#e=6a*6!yd)Jb&@--gE1zKR;o6
zXG`mV%&2Dxy05i;=dM0x=5sT8JDO1Ax!8T;JI_NcnoLdsfdz|~ES@_*%pa>1@PVMr
z&X<*iqbf@k6DpcFck#S=3nmm)F9R;H05%qp
z1=?$z?)HJ!4p|V<7wt_Q?M)L)4?1UOKXYav*xI?RaU<;s?P%(4t#4`XX>FECDA3W@
z1M>aXi2aL$f%&Wt=Pa7P72hyt(Soh>&a4G*?(fB!?+Zh)Ald7`t?VW91)=GF63szZ1
zTT4>${Zsz@|1t%bNKQ