commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [commons-lang] bbeckercscc commented on a change in pull request #477: Lang 1463: StringUtils abbreviate returns String of length greater than maxWidth
Date Mon, 04 Nov 2019 16:12:55 GMT
bbeckercscc commented on a change in pull request #477: Lang 1463: StringUtils abbreviate returns
String of length greater than maxWidth
URL: https://github.com/apache/commons-lang/pull/477#discussion_r342134805
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/StringUtils.java
 ##########
 @@ -332,10 +331,13 @@ public static String abbreviate(final String str, final String abbrevMarker,
fin
      * @since 3.6
      */
     public static String abbreviate(final String str, final String abbrevMarker, int offset,
final int maxWidth) {
-        if (isEmpty(str) || isEmpty(abbrevMarker)) {
+        if (isEmpty(str) && isEmpty(abbrevMarker)) {
+            return str;
+        } else if (isNotEmpty(str) && "".equals(abbrevMarker) && maxWidth>0)
{
 
 Review comment:
   Thanks for the explanation, I removed the magic string

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message