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]

PATCH: SimpleDateFormat fix formats containing periods


The attached program reports an exception in SimpleDateFormat.parse without
this patch, but works properly (i.e. reports the parsed date) with the
patch.  The problem was that numeric fields were being parsed as
floating-point, even though SimpleDateFormat.parse requires them to be
integer (long, actually), so any format containing periods would fail.

References:
http://gcc.gnu.org/ml/java/2003-05/msg00185.html
http://gcc.gnu.org/ml/java/2003-05/msg00194.html

Index: libjava/ChangeLog
from  Scott Gilbertson  <scottg@mantatest.com>

* java/text/SimpleDateFormat.java (SimpleDateFormat): Added
numberFormat.setParseIntegerOnly(true).

patch is attached.

Attachment: TestSimpleDateFormat.java
Description: Binary data

Attachment: 20030520_SimpleDateFormatInteger.patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]