JDK-4810032 : REGRESSION: Japanese DateFormat parser regression
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-01-29
  • Updated: 2003-12-11
  • Resolved: 2003-09-30
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 tigerFixed
Related Reports
Relates :  
Relates :  
Relates :  
Description

Name: rmT116609			Date: 01/29/2003


FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
The 1.4.1 JRE is now claiming that a certain "formal" Japanese date format that used to be parseable with the "FULL" style is now considered invalid. It is a format where the numeric components of the date are immediately followed by corresponding label characters for "year", "month", etc.

By the way, I couldn't find published specs on what patterns are considered valid date/time formats for each locale, nor an API for getting them. That would be helpful.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the example on a 1.3.1_03 and 1.4.1 JRE. You get an exception on the latter. (I am told it worked on 1.4.0 too.)


EXPECTED VERSUS ACTUAL BEHAVIOR :
1.3.1_03 result:
Sat Feb 01 00:00:00 EST 2003

1.4.1 result:
java.text.ParseException: Unparseable date: "2003?2?1?"
        at java.text.DateFormat.parse(DateFormat.java:334)
        at Test.main(Test.java:24)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.text.ParseException: Unparseable date: "2003?2?1?"
        at java.text.DateFormat.parse(DateFormat.java:334)
        at Test.main(Test.java:24)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.Locale;
import java.util.Date;
import java.text.DateFormat;
import java.text.ParseException;

public class Test {

	public static void main(String[] args)
	{
		String s = "2003\u5e742\u67081\u65e5"; // "2003y2m1d"
		Locale l = new Locale("ja", "JP");
		DateFormat dff = DateFormat.getDateInstance(DateFormat.FULL, l);
		Date d = null;
		try {
			d = dff.parse(s);
			System.out.println(d);
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
	
}
---------- END SOURCE ----------

Release Regression From : 1.4.0_03
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 180503) 
======================================================================

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

EVALUATION Regression caused by fix for 4685470, Dateformat has no day of the week with FULL option on Japanese, Simplified and T[raditional Chinese]. ###@###.### 2003-01-29 As the above evaluator said, FULL patterns for Japanese and Chinese were changed in JDK1.4.1 as fix for 4685470. Day-of-Week field is required in Japanese FULL pattern since JDK1.4.1. For example, String s = "2003\u5e742\u67081\u65e5 (\u571f\u66dc\u65e5)"; // "2003y2m1d (EEEE)" can be parsed in JDK1.4.1. Or, using SimpleDateFormat instead DateFormat may help the user because a customized pattern can be applicable. However, I assign this bug to L10N team to evaluate this bug more carefully to determine which is better as Japanese FULL pattern, with or without Day-of-Week field. For example, Japanese FULL pattern in ICU doesn't have Day-of-Week field. And I agree: | I couldn't find published specs on what patterns are considered valid | date/time formats for each locale, nor an API for getting them. | That would be helpful. ###@###.### 2003-01-30 There are no specs for the pattern. A lot of Locale Data are inherited from IBM. I am not sure if they provided any spec to i18n team. I would like to target this bug for tiger since it's too rushed for mantis. ###@###.### 2003-01-29 ---- As Michael said, there are no specs about DateFormat for Japanese and no Standard and RFC have defined this strictly as far as I know. And also I think that 4685470 for Japanese is not necessarily a bug because the API Specification for DateFormat says: "Use getDateInstance to get the normal date format for that country. There are other static factory methods available. Use getTimeInstance to get the time format for that country. Use getDateTimeInstance to get a date and time format. You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale, but generally: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * SHORT is completely numeric, such as 12.13.52 or 3:30pm * MEDIUM is longer, such as Jan 12, 1952 * LONG is longer, such as January 12, 1952 or 3:30:32pm * FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST." I'm going to remove "(EEEE)" from LocaleElements_ja.java. ###@###.### 2003-09-19
19-09-2003