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/04 15:43:58 UTC

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

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_r342118221
 
 

 ##########
 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:
   I added the spaces. What are you implying about the magic strings? Forgive me, I'm not as experienced of a programmer.

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