You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by Turan91 <gi...@git.apache.org> on 2018/10/01 23:39:57 UTC
[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...
GitHub user Turan91 opened a pull request:
https://github.com/apache/commons-lang/pull/362
Add a check to StringUtils.repeat() for large length repeat value
I have added a check to ensure that the resultant String from the repeat is not larger than the maximum allowed length.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Turan91/commons-lang master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-lang/pull/362.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #362
----
commit cc0ea0cf47fcb27f2da6e48770a770274825b32d
Author: Turan Suleyman <tu...@...>
Date: 2018-10-01T23:34:47Z
Added changes for StringUtils.repeat()
commit 3acb09d40d3c2be99ae8049f60d2b66bb46b7fef
Author: Turan Suleyman <tu...@...>
Date: 2018-10-01T23:36:48Z
Added changes for StringUtils.repeat()
----
---
[GitHub] commons-lang issue #362: Add a check to StringUtils.repeat() for large lengt...
Posted by Turan91 <gi...@git.apache.org>.
Github user Turan91 commented on the issue:
https://github.com/apache/commons-lang/pull/362
> I'm somewhat wary of simply comparing the values, as it's not always intuitive and doesn't save us much in the way of performance. Perhaps comparing it to Integer.MAX_VALUE is a bit more appropriate?
What do you mean?
---
[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...
Posted by aaabramov <gi...@git.apache.org>.
Github user aaabramov commented on a diff in the pull request:
https://github.com/apache/commons-lang/pull/362#discussion_r226915778
--- Diff: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ---
@@ -1592,6 +1592,12 @@ public void testRepeat_StringInt() {
final String str = StringUtils.repeat("a", 10000); // bigger than pad limit
assertEquals(10000, str.length());
assertTrue(StringUtils.containsOnly(str, 'a'));
+ try {
+ StringUtils.repeat("aaa",Integer.MAX_VALUE);
--- End diff --
Missing space between parameters
---
[GitHub] commons-lang issue #362: Add a check to StringUtils.repeat() for large lengt...
Posted by MarkDacek <gi...@git.apache.org>.
Github user MarkDacek commented on the issue:
https://github.com/apache/commons-lang/pull/362
I'm somewhat wary of simply comparing the values, as it's not always intuitive and doesn't save us much in the way of performance. Perhaps comparing it to Integer.MAX_VALUE is a bit more appropriate?
---
[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...
Posted by Turan91 <gi...@git.apache.org>.
Github user Turan91 commented on a diff in the pull request:
https://github.com/apache/commons-lang/pull/362#discussion_r234053572
--- Diff: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ---
@@ -1592,6 +1592,12 @@ public void testRepeat_StringInt() {
final String str = StringUtils.repeat("a", 10000); // bigger than pad limit
assertEquals(10000, str.length());
assertTrue(StringUtils.containsOnly(str, 'a'));
+ try {
+ StringUtils.repeat("aaa",Integer.MAX_VALUE);
--- End diff --
Good spot. Thanks
---
[GitHub] commons-lang issue #362: Add a check to StringUtils.repeat() for large lengt...
Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:
https://github.com/apache/commons-lang/pull/362
[![Coverage Status](https://coveralls.io/builds/19293484/badge)](https://coveralls.io/builds/19293484)
Coverage increased (+0.0009%) to 95.253% when pulling **3acb09d40d3c2be99ae8049f60d2b66bb46b7fef on Turan91:master** into **69e843890c09861a168c6fe77d63fc72f0c73195 on apache:master**.
---