JDK-4406600 : BigInteger and BigDecimal constructors accept invalid string
  • Type: Bug
  • Component: other-libs
  • Sub-Component: other
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-01-21
  • Updated: 2001-02-02
  • Resolved: 2001-02-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Description

Name: boT120536			Date: 01/21/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

Constructor BigDecimal("0-128") works, even though "0-128" is badly formatted.
Similar result with BigInteger("0-128").

This is inconsistent with java.lang wrappers like Integer, which throw a
NumberFormatException.  It also appears to contradict the JavaDoc help for
BigInteger and BigDecimal.

On my machine the following program works.  I think it should throw a
NumberFormatException.

import java.math.*;
public class Application1 {
  public static void main(String[] args) {
    BigInteger bd=new BigInteger("0-128");
    System.out.println("Got "+bd+" (class "+bd.getClass().getName()+")");
    System.exit(1);
  }
}
(Review ID: 115508) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta
14-06-2004

EVALUATION Fixed.
11-06-2004

WORK AROUND Name: boT120536 Date: 01/21/2001 Before using BigDecimal(String) and BigInteger(String), check for illegal format. ======================================================================
11-06-2004