JDK-4300507 : API: DateFormat.parse() is not correct in ar locale
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.3
  • CPU: sparc
  • Submitted: 1999-12-18
  • Updated: 2009-06-10
  • Resolved: 2009-06-10
Related Reports
Duplicate :  
Description
Dateformat parsing doesn't look correct in Solaris2.7 ar locale as below. The test was PASS in en/ja locale though. The test report is in, /net/sqesvr/export/disk3/i18n_exec/report/iss/kestrel/fcsR/ar/27/auto/dateformat_report.html

The test suite was completed recently and executed from the kestrel fcs R build. 
In order to reproduce, attached codes.
1) java Conan

java.text.ParseException: Unparseable date: "31-������-00 08:00 ���"
        at java.text.DateFormat.parse(DateFormat.java:331)
        at DateFormatTour.formatParseTest(DateFormatTour.java:152)
        at DateFormatTour.test(DateFormatTour.java:127)
        at Conan.<init>(Conan.java:76)
        at Conan.main(Conan.java:135)
java.text.ParseException: Unparseable date: "28-������-01 08:00 ���"
        at java.text.DateFormat.parse(DateFormat.java:331)
        at DateFormatTour.formatParseTest(DateFormatTour.java:152)
        at DateFormatTour.test(DateFormatTour.java:127)
        at Conan.<init>(Conan.java:76)
        at Conan.main(Conan.java:135)
java.text.ParseException: Unparseable date: "30-������-98 02:00 ��"
        at java.text.DateFormat.parse(DateFormat.java:331)
        at DateFormatTour.formatParseTest(DateFormatTour.java:152)
        at DateFormatTour.test(DateFormatTour.java:127)
        at Conan.<init>(Conan.java:76)
        at Conan.main(Conan.java:135)

bae-chul.kim@eng 1999-12-17

Comments
WORK AROUND Use "/" as the date field separator. Note that "/" is the default separator for the ar locale. masayoshi.okutsu@Eng 1999-12-20
20-12-1999

EVALUATION SimpleDateFormat uses DecimalFormat in a locale sensitive way. In ar locale, "31-" of "31-������-00 08:00 ���" is interpreted as the negative value, -31. Then, the parser fails to parse the rest of the string since it doesn't match the pattern "dd-MMM-yy". masayoshi.okutsu@Eng 1999-12-20 It's not clear about the locale dependecy on date fields at the API spec level. masayoshi.okutsu@Eng 2000-02-10
20-12-1999