JDK-4510198 : format method of SimpleDateFormat class, for fr locale, returns timezone as "TU"
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: x86
  • Submitted: 2001-10-03
  • Updated: 2002-07-08
  • Resolved: 2002-06-26
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
1.4.1 rcFixed
Related Reports
Relates :  
Description
format method of SimpleDateFormat class in case of fr locale,
when time zone is set as "GMT" returns "TU" instead of "GMT".
It is not the case if time zone is srt as "GMT+00:00"

Mentiond below is the program and output too.

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


 class BugTest {

     public static void main(String args[]) throws Exception {
         
         DateFormat df = DateFormat.getDateTimeInstance(); 
         Locale[] loc = df.getAvailableLocales();
         String[] tzones = {"GMT", "GMT+00:00","GMT-00:00", "GMT+02:40"};
         boolean pass = true;

         for(int k=0; k<tzones.length; k++) {

             for(int i=0; i<loc.length;i++) {
                 Locale.setDefault(loc[i]);
                 TimeZone tz1 = TimeZone.getTimeZone(tzones[k]); 
              // System.out.println(loc[i]);
                 SimpleDateFormat sdf = new SimpleDateFormat("M/d/yyyy z");
                 sdf.setTimeZone(tz1);
                 String datebuf = (sdf.format(new Date(),new StringBuffer(),new FieldPosition(0))).toString();
             //  System.out.println("Formatted-date :"+datebuf);
             //  System.out.println("Time-zone: "+tzones[k]);
                 if(datebuf.indexOf("GMT")==-1) {
                     System.out.println("Test failed for Locale :"+loc[i]);
                     System.out.println("Time-zone: "+tzones[k]);
                     System.out.println("Formatted-date :"+datebuf);
                     pass=false;  
                 }
             }
         }
     
         if(pass) {
             System.out.println("Test Passed");
             }
     
     
     
     }


 }

**********Output******************************

Test failed for Locale :fr
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_BE
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_BE_EURO
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_CA
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_CH
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_FR
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_FR_EURO
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_LU
Time-zone: GMT
Formatted-date :10/3/2001 TU
Test failed for Locale :fr_LU_EURO
Time-zone: GMT
Formatted-date :10/3/2001 TU

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

EVALUATION This behavior is the result of localizing time zone display names. See bug# 4381181. (A time zone ID and display names, including abbreviations, are different. "GMT+hh:mm" is a custom time zone ID. See java.util.TimeZone API doc.) Though the use of "TU" doesn't seem to be a bug, I'd like the l10n team to evaluate this. ###@###.### 2001-10-04 ###@###.### 2002-05-07 ******** l10n evaluation template - begin *********** Evaluation : I've confirmed the "GMT" over "TU" part, but not "UTC" vs. "TUC". I'll fix the first part anyway. sccsdiff info (e.g. sccs diffs -r1.30 1.31 Activator_fr.java): sccs diffs DateFormatZoneData_fr.java ------- DateFormatZoneData_fr.java ------- 96,97c96,97 < String GMT[] = new String[] {"Heure de Greenwich", "TU", < "Heure de Greenwich", "TU"} ; --- > String GMT[] = new String[] {"Heure de Greenwich", "GMT", > "Heure de Greenwich", "GMT"} ; List file(s) to be delivered : src/share/classes/sun/text/resources/DateFormatZoneData_fr.java Target Build : Hopper Beta Additional Info : ******** l10n evaluation template - end*********** The bug was verified fixed in b12, and b13, but it's broken again in b14. ###@###.### 2002-06-05 Since it's too late for hopper-beta, we will commit to fix it in hopper-rc. ###@###.### 2002-06-05 ###@###.### 2002-06-19 This must have been overwritten with the last vendor putback. I've done the change again now. ============================================== Verified with b16, fixed. ###@###.### 2002-06-28
28-06-2002

SUGGESTED FIX Use "GMT" instead of "TU" in DateFormatZoneData_fr*.java. It might be better to change "TUC" to "UTC" as well. ###@###.### 2002-02-21
21-02-2002