harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulex Yang (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-4650) BigInteger(int signum, int digits[]) constructor bug
Date Mon, 20 Aug 2007 03:47:31 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paulex Yang resolved HARMONY-4650.
----------------------------------

    Resolution: Fixed
      Assignee: Paulex Yang

Good catch! Although I cannot find a test to show the bug, neither, but I got more confidence
by comparing it with another public constructor BigInteger(int signum, byte[] magnitude)'s
implementation. [1]

Fix commited at r567537, please verify it. Thank you, Imran.

[1]
    public BigInteger(int signum, byte[] magnitude) {
        ...
        if (magnitude.length == 0) {
            sign = 0;
            numberLength = 1;
            digits = new int[] { 0 }; //digits is field here
        } else {
            sign = signum;
            putBytesPositiveToIntegers(magnitude); //To convert the byte array to a int array
as digts
            cutOffLeadingZeroes();
        }
    }

> BigInteger(int signum, int digits[]) constructor bug
> ----------------------------------------------------
>
>                 Key: HARMONY-4650
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4650
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Imran Ghory
>            Assignee: Paulex Yang
>            Priority: Minor
>
> The following constructor appears to contain a bug, it looks like "digits = new int[]
{ 0 };" is supposed to be  "this.digits = new int[] { 0 };".  I haven't quite figured out
how to cause this bug to be visible via the public API yet, but I wouldn't be surprised if
it was.
>     BigInteger(int signum, int digits[]) {
>         if (digits.length == 0) {
>             sign = 0;
>             numberLength = 1;
>             digits = new int[] { 0 };
>         } else {
>             sign = signum;
>             numberLength = digits.length;
>             this.digits = digits;
>             cutOffLeadingZeroes();
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message