[kaffe] Non-default locales not working (java.text.DateFormat)

Daniel Bonniot Daniel.Bonniot at inria.fr
Thu Sep 2 02:05:42 PDT 2004


Hi,

I can't get any non-default locale to work with the following program:


import java.util.Date;
import java.text.DateFormat;

public class Bug
{
   static DateFormat longDate = DateFormat.getDateTimeInstance();

   public static void main(String[] args)
   {
     System.out.println(longDate.format(new Date()));
   }
}


With the default POSIX locale it works fine:

$ kaffe Bug
2-Sep-04 11:01:16 AM

But otherwise it fails:

$ LC_ALL=fr_FR kaffe Bug
java.lang.ExceptionInInitializerError
    <<No stacktrace available>>
Caused by: java.util.MissingResourceException: resource not found
    at java.util.ResourceBundle.getObject (ResourceBundle.java:202)
    at java.util.ResourceBundle.getStringArray (ResourceBundle.java:214)
    at java.text.DateFormatSymbols.<init> (DateFormatSymbols.java:104)
    at java.text.SimpleDateFormat.<init> (SimpleDateFormat.java:213)
    at java.text.DateFormat.computeInstance (DateFormat.java:412)
    at java.text.DateFormat.getDateTimeInstance (DateFormat.java:490)
    at java.text.DateFormat.getDateTimeInstance (DateFormat.java:462)
    at Bug.<clinit> (Bug.java:6)

$ LC_ALL=fr kaffe Bug
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/NullPointerException
         at java.lang.System.initProperties(System.java:native)
         at java.lang.System.<clinit>(System.java:43)
         at java.lang.ClassLoader.<init>(ClassLoader.java:115)
         at java.lang.ClassLoader.<init>(ClassLoader.java:111)
         at java.security.SecureClassLoader.<init>(SecureClassLoader.java:23)
         at java.net.URLClassLoader.<init>(URLClassLoader.java:541)
         at kaffe.lang.AppClassLoader.<init>(AppClassLoader.java:237)
         at kaffe.lang.AppClassLoader.<clinit>(AppClassLoader.java:35)
Aborted

It works in all cases with Sun's JVM, so the locales are present on the 
system. And in the worst case, I think kaffe should revert to the default 
locale istead of failing.

I'm using kaffe 1.1.5 prerelease, on Debian GNU/Linux.

Cheers,

Daniel





More information about the kaffe mailing list