JDK-8075173 : DateFormat in german locale returns wrong value for month march
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 8u40
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-03-13
  • Updated: 2016-08-24
  • Resolved: 2015-03-25
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 JDK 9
8u60Fixed 9 b57Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows 7 Professional Service Pack 1

A DESCRIPTION OF THE PROBLEM :
The java.text.DateFormat.format() method returns inconsistent values for months if the Date object comes from a Calendar with german Locale and a time value in March:
For a pattern "MMM" the format is "Mrz"
For a pattern "MMM yyyy" the format is "M��r 2015"


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the provided class

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
M��r
M��r 2015

or 

Mrz
Mrz 2015

ACTUAL -
Mrz
M��r 2015

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;

public class CalendarLocaleMarchBug {

	public static void printDate (Calendar c, String pattern) {
		SimpleDateFormat f = new SimpleDateFormat(pattern);
		f.setCalendar(c);
		String res1 =  f.format(c.getTime());
		System.out.println(res1);		
	}
	
	public static void main(String[] args) {
		Calendar c = new GregorianCalendar(Locale.GERMAN);
		c.set(2015,02,20);
		printDate(c,"MMM");
		printDate(c,"MMM yyyy");
	}

}
---------- END SOURCE ----------


Comments
M��r will be used for both format and stand-alone month names.
24-03-2015

The format and stand-alone forms of month names are supported since JDK 8. At that time format and/or stand-alone month names were derived from CLDR. CLDR uses M��r, while JDK has traditionally been using Mrz.
24-03-2015