Harmony
  1. Harmony
  2. HARMONY-1047

[classlib][math]exception compatibility: new BigInteger(Integer.MAX_VALUE, (Random)null)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Different exception behaviour when create a huge BigInteger.

      Actually it's impossible to create BigInteger with numBits=Integer.MAX_VALUE, but RI throws an Exception while Harmony throws an Error.

      Test --------------------------------------------------------------

      mport java.math.BigInteger;
      import java.util.Random;

      public class bug9282 {
      public static void main(String args[] )

      { new BigInteger(Integer.MAX_VALUE, (Random)null); }


      }

      Output -------------------------------------------------------

      RI
      java.lang.NegativeArraySizeException: Negative size-268435455
      at java.math.BigInteger.randomBits(BigInteger.java:471)
      at java.math.BigInteger.<init>(BigInteger.java:464)
      at bug9282.main(bug9282.java:6)

      Harmony
      java.lang.OutOfMemoryError
      <no stack trace available>

      1. HARMONY-1047.patch
        0.6 kB
        Nellya Udovichenko
      2. HARMONY-1047-test.patch
        0.8 kB
        Nellya Udovichenko

        Issue Links

          Activity

          Denis Kishenko created issue -
          Nellya Udovichenko made changes -
          Field Original Value New Value
          Attachment HARMONY-1047.patch [ 12348839 ]
          Nellya Udovichenko made changes -
          Attachment HARMONY-1047-test.patch [ 12348840 ]
          Alexei Zakharov made changes -
          Patch Info [Patch Available]
          Tim Ellison made changes -
          Assignee Tim Ellison [ tellison ]
          Tim Ellison made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Tim Ellison made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Paulex Yang made changes -
          Link This issue is related to HARMONY-5088 [ HARMONY-5088 ]

            People

            • Assignee:
              Tim Ellison
              Reporter:
              Denis Kishenko
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development