Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8297530

java.lang.IllegalArgumentException: Negative length on strings concatenation

    XMLWordPrintable

Details

    • b26
    • Verified

    Backports

      Description

        Please excuse for messy generated test (attached).

        The issue happens during concatenation of relatively large strings (about a 1MB size). I would expect any other error, like OutOfMemoryError, but not a 'Negative length' given that the expression being evaluated only contains strings and '+' operators.

        The exception:
        java.lang.IllegalArgumentException: Negative length
                at java.base/jdk.internal.misc.Unsafe.allocateUninitializedArray(Unsafe.java:1378)
                at java.base/java.lang.StringConcatHelper.newArray(StringConcatHelper.java:438)
                at Test_38.method_int_int_287(Test_38.java:2215)
                at Test_38.method_float_float_435(Test_38.java:2312)
                at Test_38.mainTest(Test_38.java:2449)
                at Test_38.main(Test_38.java:2464)
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
                at java.base/java.lang.reflect.Method.invoke(Method.java:578)
                at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
                at java.base/java.lang.Thread.run(Thread.java:1591)

        Attachments

          Issue Links

            Activity

              People

                redestad Claes Redestad
                enikitin Evgeny Nikitin
                Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: