I don't think that trying to throw an OutOfMemoryError is going to be useful here.
Imran: What is the scenario? Is this behavior expected by some application or is this just something you came across? I suggest we leave it as NPE. Regards, Tim Paulex Yang (JIRA) wrote: > [ > https://issues.apache.org/jira/browse/HARMONY-5088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546162 > ] > > Paulex Yang commented on HARMONY-5088: > -------------------------------------- > > I got problem to comply with RI 1.6_03 here, new > BigInteger(Integer.MAX_VALUE, (Random)null) throws OutOfMemoryError on both > windows/linux, while my modification like below throws NPE. > > - numberLength = (numBits + 31) >> 5; > + numberLength = (numBits + 31) >>> 5; > > I have no idea how to make a OOME except explicitly new one, which is too > ugly to me. Any ideas? > > >> [classlib][math] BigInteger(int numBits, Random rnd) constructor contains >> overflow >> ----------------------------------------------------------------------------------- >> >> Key: HARMONY-5088 >> URL: https://issues.apache.org/jira/browse/HARMONY-5088 >> Project: Harmony >> Issue Type: Bug >> Components: Classlib >> Reporter: Imran Ghory >> Assignee: Paulex Yang >> >> If numBits = Integer.MAX_VALUE then you have an integer overflow situation >> on the following lines: >> numberLength = (numBits + 31) >> 5; >> digits = new int[numberLength]; >
