You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/11/03 23:55:16 UTC

[GitHub] [commons-lang] garydgregory commented on a change in pull request #477: Lang 1463: StringUtils abbreviate returns String of length greater than maxWidth

garydgregory 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_r341881451
 
 

 ##########
 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:
   No magic strings, this class defines `EMPTY` for this purpose. You are missing spaces around `>`

----------------------------------------------------------------
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