This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new f3e834a [TEXT-190] Add @javadoc for WordUtils.abbreviate lower
new ee61b91 Merge branch 'pr-181'
f3e834a is described below
commit f3e834a8e3966dfe10ed53e3fd16f05f2fc2a127
Author: Benjamin Bing <[email protected]>
AuthorDate: Thu Oct 29 13:11:07 2020 -0700
[TEXT-190] Add @javadoc for WordUtils.abbreviate lower
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/text/WordUtils.java | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 642fd6c..fae2236 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,6 +53,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary
Gregory">Update commons.jacoco.version 0.8.5 to 0.8.6; fixes Java 15
build.</action>
<action type="fix" dev="ggregory" due-to="Gary
Gregory">Update spotbugs.plugin.version 4.0.4 to 4.1.4; fixes Java 16 build
#175.</action>
<!-- ADD -->
+ <action issue="TEXT-190" type="add" dev="kinow" due-to="Benjamin
Bing">Document negative limit for WordUtils abbreviate method</action>
<action issue="TEXT-188" type="add" dev="kinow" due-to="Jakob
Vesterstrøm">Speed up LevenshteinDistance with threshold by exiting
early</action>
<action issue="TEXT-185" type="add" dev="ggregory" due-to="Larry West,
Gary Gregory">Release Notes page hasn't been updated for 1.9 release
yet.</action>
<!-- UPDATE -->
diff --git a/src/main/java/org/apache/commons/text/WordUtils.java
b/src/main/java/org/apache/commons/text/WordUtils.java
index 4c487ce..fa36c11 100644
--- a/src/main/java/org/apache/commons/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/text/WordUtils.java
@@ -828,7 +828,7 @@ public class WordUtils {
*
* @param str the string to be abbreviated. If null is passed,
null is returned.
* If the empty String is passed, the empty string is
returned.
- * @param lower the lower limit.
+ * @param lower the lower limit; negative value is treated as zero.
* @param upper the upper limit; specify -1 if no limit is desired.
* If the upper limit is lower than the lower limit, it
will be
* adjusted to be the same as the lower limit.
@@ -859,7 +859,6 @@ public class WordUtils {
public static String abbreviate(final String str, int lower, int upper,
final String appendToEnd) {
Validate.isTrue(upper >= -1, "upper value cannot be less than -1");
Validate.isTrue(upper >= lower || upper == -1, "upper value is less
than lower value");
-
if (StringUtils.isEmpty(str)) {
return str;
}