This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git

commit c70707e760f7df0cb62561c1d5df0a075bed1b37
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Aug 21 17:08:31 2023 -0400

    [TEXT-228] Fix TextStringBuilder to over-allocate when ensuring
    capacity #452
    
    - Normalize Javadoc tags and first word
    - Fix other Javdoc punctuation
---
 src/changes/changes.xml                               |  1 +
 .../org/apache/commons/text/TextStringBuilder.java    | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e4cef5e3..afb9c337 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -62,6 +62,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                  type="fix" dev="ggregory" due-to="Dimitrios 
Efthymiou">Fix exception message in IntersectionResult to make set-theoretic 
sense #438.</action>
     <action                  type="fix" dev="ggregory" due-to="Dimitrios 
Efthymiou, Gary Gregory">Add null-check in 
RandomStringGenerator#Builder#selectFrom() to avoid NullPointerException 
#434.</action>
     <action                  type="fix" dev="ggregory" due-to="Dimitrios 
Efthymiou, Gary Gregory">Add null-check in 
RandomStringGenerator#Builder#withinRange() to avoid 
NullPointerException.</action>
+    <action issue="TEXT-228" type="fix" dev="ggregory" due-to="Alex Herbert, 
Gary Gregory">Fix TextStringBuilder to over-allocate when ensuring capacity 
#452.</action>
     <!-- ADD -->
     <action issue="TEXT-224" type="add" dev="ggregory" due-to="PJ Fanning, 
Gary Gregory">Set SecureProcessing feature in XmlStringLookup by 
default.</action>
     <action issue="TEXT-224" type="add" dev="ggregory" due-to="Gary 
Gregory">Add StringLookupFactory.xmlStringLookup(Map&lt;String, 
Boolean&gt;...).</action>
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java 
b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 50aa3c7f..d7462a06 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -1312,10 +1312,11 @@ public class TextStringBuilder implements CharSequence, 
Appendable, Serializable
     }
 
     /**
-     * Appends one of both separators to the StrBuilder. If the builder is 
currently empty it will append the
-     * defaultIfEmpty-separator Otherwise it will append the standard-separator
-     *
+     * Appends one of both separators to the StrBuilder. If the builder is 
currently empty, it will append the
+     * defaultIfEmpty-separator, otherwise it will append the 
standard-separator.
+     * <p>
      * Appending a null separator will have no effect. The separator is 
appended using {@link #append(String)}.
+     * </p>
      * <p>
      * This method is for example useful for constructing queries
      * </p>
@@ -1832,9 +1833,11 @@ public class TextStringBuilder implements CharSequence, 
Appendable, Serializable
     /**
      * Tests the capacity and ensures that it is at least the size specified.
      *
-     * <p>Note: This method can be used to minimise memory reallocations during
+     * <p>
+     * Note: This method can be used to minimise memory reallocations during
      * repeated addition of values by pre-allocating the character buffer.
      * The method ignores a negative {@code capacity} argument.
+     * </p>
      *
      * @param capacity the capacity to ensure
      * @return this, to enable chaining
@@ -1848,11 +1851,13 @@ public class TextStringBuilder implements CharSequence, 
Appendable, Serializable
     }
 
     /**
-     * Ensure that the buffer is at least the size specified. The {@code 
capacity} argument
+     * Ensures that the buffer is at least the size specified. The {@code 
capacity} argument
      * is treated as an unsigned integer.
      *
-     * <p>This method will raise an {@link OutOfMemoryError} if the capacity 
is too large
+     * <p>
+     * This method will raise an {@link OutOfMemoryError} if the capacity is 
too large
      * for an array, or cannot be allocated.
+     * </p>
      *
      * @param capacity the capacity to ensure
      * @throws OutOfMemoryError if the capacity cannot be allocated
@@ -1886,7 +1891,7 @@ public class TextStringBuilder implements CharSequence, 
Appendable, Serializable
     }
 
     /**
-     * Create a positive capacity at least as large the minimum required 
capacity.
+     * Creates a positive capacity at least as large the minimum required 
capacity.
      * If the minimum capacity is negative then this throws an 
OutOfMemoryError as no array
      * can be allocated.
      *

Reply via email to