Stzx commented on a change in pull request #478: StringUtils.abbreviate handles 
empty abbrevMarker
URL: https://github.com/apache/commons-lang/pull/478#discussion_r341832572
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/StringUtils.java
 ##########
 @@ -332,10 +332,17 @@ 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)) {
             return str;
         }
 
+        if (abbrevMarker == null){
+            return str.substring(0, maxWidth + 1);
 
 Review comment:
   ```java
   StringUtils.abbreviate("a", null, 0, 10);
   ```
   
   May throw a `StringIndexOutOfBoundsException`.
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to