JDK-4994312 : Incompatibility SimpleDateFormat.applyLocalizedPattern between Sun JDK versions
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: generic
  • Submitted: 2004-02-13
  • Updated: 2004-03-29
  • Resolved: 2004-03-29
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 b45Fixed
Related Reports
Relates :  
Relates :  
Description
According to the Javadoc, the applyLocalizedPattern method on
SimpleDateFormat is supposed to take a localized date pattern and
initialize the SimpleDateFormat object with that format.  This will
allow us to use that SimpleDateFormat object on a Date object to format
a date string.  However, it would appear that for JDK 1.4.x, this method
no longer accepts localized pattern - i.e. in German, the localized
pattern for a date would be "tt.MM.uuuu", where the non-localized
pattern would be "dd.MM.yyyy".  In 1.3.x, using that pattern works fine,
but in 1.4.x, it no longer accepts that pattern.

Reproduction Case:

I have the following test program, test2.java:

import java.text.*;
import java.util.*;

public class test2 {
  public static void main(String args[]) {
    try {
      SimpleDateFormat df = (SimpleDateFormat)
	DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
      df.applyLocalizedPattern("tt.MM.uuuu");
      System.out.println(df.format(new Date()));
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }
}


When I use JDK 1.3.1_04 to run this program, I get :
10.02.2004

When I use JDK 1.4.2_03 to run this program, I get:
java.lang.IllegalArgumentException: Illegal pattern  character 't'
at
java.text.SimpleDateFormat.translatePattern(SimpleDateFormat.java:1730)
at
java.text.SimpleDateFormat.applyLocalizedPattern(SimpleDateFormat.java:1
785)    at test2.main(test2.java:8)

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

EVALUATION Name: nl37777 Date: 02/15/2004 Regression introduced in J2RE 1.4.0 by revision 1.18 of DateFormatZoneData_de.java. ====================================================================== The expected fix for this bug conflicts with the fix which is being putback by the L10N team for 4265184 soon. ###@###.### 2004-02-16 The putback for 4265184is going to be extended with the following ******** l10n evaluation template - begin *********** Evaluation : localPatternChars needs to be modified. sccsdiff info (e.g. sccs diffs -r1.30 1.31 Activator_fr.java): sccs diffs DateFormatZoneData_de.java ------- DateFormatZoneData_de.java ------- 723c723 < {"localPatternChars", "GjMtkHmsSEDFwWahKzZ"}, --- > {"localPatternChars", "GuMtkHmsSEDFwWahKzZ"}, List file(s) to be delivered : j2se:/src/share/classes/sun/text/resources/DateFormatZoneData_de.java Target Build : tiger-beta2 Additional Info : ******** l10n evaluation template - end*********** ###@###.### 2004-03-08
08-03-2004