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 2020/04/20 13:41:59 UTC

[GitHub] [commons-lang] garydgregory commented on a change in pull request #521: Simplify some if statements in StringUtils.

garydgregory commented on a change in pull request #521:
URL: https://github.com/apache/commons-lang/pull/521#discussion_r411386416



##########
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##########
@@ -330,11 +330,9 @@ 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)) {
-            return str;
-        } else if (isNotEmpty(str) && EMPTY.equals(abbrevMarker) && maxWidth > 0) {
-            return str.substring(0, maxWidth);
-        } else if (isEmpty(str) || isEmpty(abbrevMarker)) {
+        if (isNotEmpty(str) && EMPTY.equals(abbrevMarker) && maxWidth > 0) {

Review comment:
       How about `EMPTY.equals(abbrevMarker)` -> `isEmpty(abbrevMarker)` ?




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