libgcj/5029: Date.toString() fail when LANG=FR_fr

michel.chevanne@alcatel.fr michel.chevanne@alcatel.fr
Sun Oct 28 04:26:00 GMT 2001


>Number:         5029
>Category:       libgcj
>Synopsis:       Date.toString() fail when LANG=FR_fr
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 06 00:56:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     michel.chevanne@alcatel.fr
>Release:        gcc 3.0.2
>Organization:
>Environment:
Linux  2.2.18-SMP
Suse Linux 7.1 distribution
>Description:
When LANG=fr_FR, 

date.toString() throw a null pointer exception in
DateFormatSymbols.formatsForKey 
- There is a related problem : LANG=fr_FR is not correctly
parsed (it should correspond to user.language=fr and user.region=FR)
- Workaround : set the language to en/US
>How-To-Repeat:
Test program :


import java.util.*;
public class Test {

    public static void main(String [] args) {
	System.err.println(System.getProperty("user.language"));	
	System.err.println(System.getProperty("user.region"));

	// by default, on my computer, user.language and user.region have these values
	// (because LANG=FR_fr)
	System.setProperty("user.language", "LC");
	System.setProperty("user.region", "CT");

	Date d = new Date();
	System.out.println(d.toString());
    }

}

>Fix:
The exception is thrown because the parameter res is null.
(in DateFormatSymbols.formatForKey)
This parameter is null because the constructor of DateFormatSymbols has not found gnu.gcj.text.LocaleData.
A search in the source code of libjava indicates that :
only the files 
gnu/gcj/text/LocaleData_en.java and
gnu/gcj/text/LocaleData_en_US.java
but not gnu/gcj/text/LocaleData.java which would have
been loaded by default.

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Java-prs mailing list