JDK-4963902 : Update BigDecimal and BigInteger to use StringBuilder instead of StringBuffer
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.math
  • Affected Version: 5.0
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2003-12-04
  • Updated: 2003-12-19
  • Resolved: 2003-12-19
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
5.0 b32Fixed
Related Reports
Relates :  
Description
The BigDecimal and BigInteger classes were written to use StringBuffer's internally while generating a String to output.  Since all the operations on those StringBuffers occur within a single method and the StringBuffer does not escape the method, these uses of StringBuffer should be replaced with the unsynchronized StringBuilder.

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

SUGGESTED FIX rc/share/classes/java/math>sccs sccsdiff -r1.48 -r1.49 BigDecimal.java ------- BigDecimal.java ------- 2693c2693 < StringBuffer buf=new StringBuffer(coeff.length+14); --- > StringBuilder buf=new StringBuilder(coeff.length+14); src/share/classes/java/math>sccs sccsdiff -r1.63 -r1.64 BigInteger.java ------- BigInteger.java ------- 2639c2639 < StringBuffer buf = new StringBuffer(numGroups*digitsPerLong[radix]+1); --- > StringBuilder buf = new StringBuilder(numGroups*digitsPerLong[radix]+1); ###@###.### 2003-12-07
07-12-2003

EVALUATION A fine idea. ###@###.### 2003-12-04
04-12-2003