ham1 commented on a change in pull request #440: Fix static code issues
URL: https://github.com/apache/commons-lang/pull/440#discussion_r315437426
##########
File path: src/main/java/org/apache/commons/lang3/StringUtils.java
##########
@@ -6378,8 +6378,8 @@ private static String replace(final String text, String
searchString, final Stri
}
final int replLength = searchString.length();
int increase = replacement.length() - replLength;
- increase = increase < 0 ? 0 : increase;
- increase *= max < 0 ? 16 : max > 64 ? 64 : max;
+ increase = Math.max(increase, 0);
+ increase *= Math.min(max, 0);
Review comment:
That is a very good spot, not sure what happened here. I've fixed it now.
Interesting that no tests picked it up.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services