JDK-7163812 : Unparseable date: 22 lutego 2012 by DateFormat in Polish locale
  • Type: Bug
  • Component: globalization
  • Sub-Component: locale-data
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-04-24
  • Updated: 2012-12-20
  • Resolved: 2012-07-20
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.
JDK 8
8Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
JDK1.7.0_01

ADDITIONAL OS VERSION INFORMATION :
Windows 7

A DESCRIPTION OF THE PROBLEM :
SimpleDateFormat class gives invalid date for "29-lutego-2012", however it validates and parse 29-luty-2012

lutego and luty means February in english locale.

REGRESSION.  Last worked in version 7

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Set Polish locale to your Java application
2. Create instance of SimpleDateFormat
3. Pass string value 22 lutego 2012 to parse

See the code snippet:



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Value should parse and display "Wed Feb 22 00:00:00 IST 2012" on console
ACTUAL -
Exception

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.text.ParseException: Unparseable date: "22 lutego 2012"
	at java.text.DateFormat.parse(Unknown Source)
	at TestDateFormat.main(TestDateFormat.java:22)

REPRODUCIBILITY :
This bug can be reproduced always.

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


public class TestPolishDateFormat {
	public static void main(String[] args) {
		Locale locale = new Locale("pl", "PL");
		//Set  polish local
		Locale.setDefault(locale);
		//Get instance of SimpleDateFormat
		SimpleDateFormat longFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.LONG);
		
		try {
			
			Date date = longFormat.parse("22 luty 2012"); // This value parse successfully
			System.out.println(date);
			
			date = longFormat.parse("22 lutego 2012");  // This fails
			System.out.println(date);
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
For Polish locale use luty instead of lutego for February month

Comments
EVALUATION I try the testing program with Java 5 and 6 and it also throws the exception there. Looks like this is not a regression. The fix depends on 7079560. When 7079560 is fixed, I can follow the change of resource file in that CR to add data in FormatData_pl.java.
02-05-2012