You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Imran Ghory (JIRA)" <ji...@apache.org> on 2007/08/20 01:37:30 UTC
[jira] Created: (HARMONY-4650) BigInteger(int signum, int digits[])
constructor bug
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
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.
[jira] Closed: (HARMONY-4650) BigInteger(int signum, int digits[])
constructor bug
Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Hindess closed HARMONY-4650.
---------------------------------
Closing as this is fixed in the current code.
> 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.
[jira] Resolved: (HARMONY-4650) BigInteger(int signum, int
digits[]) constructor bug
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ 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.