garydgregory commented on code in PR #1644:
URL: https://github.com/apache/commons-lang/pull/1644#discussion_r3247859614
##########
src/main/java/org/apache/commons/lang3/StringUtils.java:
##########
@@ -6117,7 +6117,12 @@ public static String repeat(final String repeat, final
int count) {
if (inputLength == 1 && count <= PAD_LIMIT) {
return repeat(repeat.charAt(0), count);
}
- final int outputLength = inputLength * count;
+ final int outputLength;
+ try {
+ outputLength = Math.multiplyExact(inputLength, count);
+ } catch (final Exception e) {
+ throw new IllegalArgumentException("Count too large for input");
Review Comment:
If you agree it's wrong, then why did you propose it in the first place?!
Why did I just waste an hour?! :(
If we start documenting everything that's different from the JRE, we'll
never end, and confuse users. Just imagine, every time a new Java version comes
out, we'd document all the little differences with our APIs, yikes...
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]