[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...

Turan91
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 <turansuleyman@...>
Date:   2018-10-01T23:34:47Z

    Added changes for StringUtils.repeat()

commit 3acb09d40d3c2be99ae8049f60d2b66bb46b7fef
Author: Turan Suleyman <turansuleyman@...>
Date:   2018-10-01T23:36:48Z

    Added changes for StringUtils.repeat()

----


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] commons-lang issue #362: Add a check to StringUtils.repeat() for large lengt...

Turan91
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**.



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...

Turan91
In reply to this post by Turan91
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


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] commons-lang pull request #362: Add a check to StringUtils.repeat() for larg...

Turan91
In reply to this post by Turan91
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


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] commons-lang issue #362: Add a check to StringUtils.repeat() for large lengt...

Turan91
In reply to this post by Turan91
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?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] commons-lang issue #362: Add a check to StringUtils.repeat() for large lengt...

Turan91
In reply to this post by Turan91
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?


---