This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Double.parseDouble no longer parses strings with leading spaces. My app previously worked but now gets a NumberFormatException. A small test case (attached) sees the same thing. It seems to me that "length + start" is guaranteed to be no greater than "str->length()", so the old version was correct. ----- Original Message ----- From: "Tom Tromey" <tromey@redhat.com> To: "GCC libjava patches" <java-patches@gcc.gnu.org> Sent: Thursday, November 13, 2003 8:36 PM Subject: Patch: FYI: important memory-trashing fix > I'm checking this in on the trunk. > > Tom Fitzsimmons' test case pointed this out. > It turns out that in many cases we were passing the wrong length to > JvGetStringUTFRegion. Perhaps we should add a new API that doesn't > take a length argument at all, since that seems to be the most common > use by far. > > Tom > ... > * java/lang/natDouble.cc (parseDouble): Pass length of string to > JvGetStringUTFRegion. > Index: java/lang/natDouble.cc > ... > - jsize blength = _Jv_GetStringUTFRegion (str, start, length, data); > + jsize blength = _Jv_GetStringUTFRegion (str, start, str->length(), data);
Attachment:
DoubleParserBug.java
Description: Binary data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |