RFR: 8230743 - StringJoiner does not handle too large strings correctly

Paul Sandoz paul.sandoz at oracle.com
Mon Jun 1 19:44:42 UTC 2020


Oh, so easy to miss. Better yet use TestNG's Assert.fail, or for simple cases declare the expected exception as an argument of the test annotation.

Paul.

> On Jun 1, 2020, at 12:39 PM, Martin Buchholz <martinrb at google.com> wrote:
> 
> Missing "throw"; We should have an assertThrows test method (many
> people have written such, including myself).
> 
> +        try {
> +            new StringJoiner(maxString, maxString, "").toString();
> +            new AssertionError("Should have thrown OutOfMemoryError");
> 
> On Mon, Jun 1, 2020 at 8:58 AM Jim Laskey <james.laskey at oracle.com> wrote:
>> 
>> Change NegativeArraySizeException to OutOfMemoryError. Tests added.
>> 
>> Cheers,
>> 
>> -- Jim
>> 
>> webrev: http://cr.openjdk.java.net/~jlaskey/8230743/webrev-00/index.html <http://cr.openjdk.java.net/~jlaskey/8230743/webrev-00/index.html>
>> jbs: https://bugs.openjdk.java.net/browse/JDK-8230743 <https://bugs.openjdk.java.net/browse/JDK-8230743>
>> 



More information about the core-libs-dev mailing list