public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libgcj/6576: java.util.ResourceBundle.getResource ignores locale
@ 2002-05-06 16:32 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-05-06 16:32 UTC (permalink / raw)
  To: bruno, gcc-bugs, gcc-prs, java-prs, nobody, tromey

Synopsis: java.util.ResourceBundle.getResource ignores locale

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Mon May  6 16:32:48 2002
Responsible-Changed-Why:
    I'm handling this.
State-Changed-From-To: open->analyzed
State-Changed-By: tromey
State-Changed-When: Mon May  6 16:32:48 2002
State-Changed-Why:
    The problem here is that there is no "prog" bundle available.
    Whoever wrote our ResourceBundle interpreted the online docs
    as requiring "prog" if "prog_foo" is provided.
    I'm not certain that this is the most robust interpretation,
    but it may be defensible.
    
    I note that the JDK works correctly in this scenario.
    So, I'm inclined to agree this is a bug.
    I don't know when I can work on it; meanwhile at least we know of a workaround.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6576


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libgcj/6576: java.util.ResourceBundle.getResource ignores locale
@ 2002-09-23 10:58 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-09-23 10:58 UTC (permalink / raw)
  To: bruno, gcc-bugs, gcc-prs, java-prs, tromey

Synopsis: java.util.ResourceBundle.getResource ignores locale

State-Changed-From-To: analyzed->closed
State-Changed-By: tromey
State-Changed-When: Mon Sep 23 10:58:56 2002
State-Changed-Why:
    I've checked in a fix for this.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6576


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libgcj/6576: java.util.ResourceBundle.getResource ignores locale
@ 2002-05-06  4:26 Bruno Haible
  0 siblings, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2002-05-06  4:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6576
>Category:       libgcj
>Synopsis:       java.util.ResourceBundle.getResource ignores locale
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 06 04:26:04 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bruno Haible
>Release:        3.1 20020423 (prerelease)
>Organization:
GNU hackers
>Environment:
System: Linux linuix 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/packages/gnu-snapshot --enable-shared --enable-version-specific-runtime-libs --enable-nls
>Description:

The java.util.ResourceBundle.getBundle(String,Locale) function
appears to ignore the locale argument.

>How-To-Repeat:

$ export CLASSPATH=.
$ cat <<\EOF > prog_fr.java
/* Automatically generated by GNU msgfmt.  Do not modify!  */
public class prog_fr extends java.util.ResourceBundle {
  private static final java.util.Hashtable table;
  static {
    java.util.Hashtable t = new java.util.Hashtable();
    t.put("","Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=2; plural=(n > 1);\n");
    t.put("'Your command, please?', asked the waiter.","\u00abVotre commande, s'il vous plait\u00bb, dit le gar\u00e7on.");
    t.put("a piece of cake",new java.lang.String[] { "un morceau de gateau", "{0,number} morceaux de gateau" });
    t.put("{0} is replaced by {1}.","{1} remplace {0}.");
    table = t;
  }
  public static final java.util.Hashtable plural;
  static {
    java.util.Hashtable p = new java.util.Hashtable();
    p.put("a piece of cake","{0,number} pieces of cake");
    plural = p;
  }
  public java.lang.Object lookup (java.lang.String msgid) {
    return table.get(msgid);
  }
  public java.lang.Object handleGetObject (java.lang.String msgid) throws java.util.MissingResourceException {
    java.lang.Object value = table.get(msgid);
    return (value instanceof java.lang.String[] ? ((java.lang.String[])value)[0] : value);
  }
  public java.util.Enumeration getKeys () {
    return table.keys();
  }
  public static long pluralEval (long n) {
    return ((n > 1) ? 1 : 0);
  }
  public java.util.ResourceBundle getParent () {
    return parent;
  }
}
EOF
$ gcj -C -O -d . prog_fr.java
$ cat <<\EOF > DumpResource.java
import java.lang.reflect.*;
import java.util.*;
import java.io.*;
public class DumpResource {
  public DumpResource (String resource_name, String locale_name) {
    // Split locale_name into language_country_variant.
    String language;
    String country;
    String variant;
    language = locale_name;
    {
      int i = language.indexOf('_');
      if (i >= 0) {
        country = language.substring(i+1);
        language = language.substring(0,i);
      } else
        country = "";
    }
    {
      int j = country.indexOf('_');
      if (j >= 0) {
        variant = country.substring(j+1);
        country = country.substring(0,j);
      } else
        variant = "";
    }
    Locale locale = new Locale(language,country,variant);
    // Get the resource.
    System.out.println("Calling getBundle("+resource_name+","+locale+").");
    ResourceBundle catalog = ResourceBundle.getBundle(resource_name,locale);
  }
  public static void main (String[] args) {
    new DumpResource(args[0], args.length > 1 ? args[1] : "");
    System.exit(0);
  }
}
EOF
$ gcj -C -O -d . DumpResource.java
$ gij DumpResource prog fr
Calling getBundle(prog,fr).
Exception in thread "main" java.util.MissingResourceException: Bundle prog not found
   at 0x4025bf70: java.lang.Throwable.Throwable(java.lang.String) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4024aed6: java.lang.Exception.Exception(java.lang.String) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4024fba6: java.lang.RuntimeException.RuntimeException(java.lang.String) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x402a0ea9: java.util.MissingResourceException.MissingResourceException(java.lang.String, java.lang.String, java.lang.String) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x402a4ec9: java.util.ResourceBundle.getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x402a495b: java.util.ResourceBundle.getBundle(java.lang.String, java.util.Locale) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403d76e7: ffi_call_SYSV (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403d7697: ffi_raw_call (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4022e20b: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403e2644: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_InterpMethodInvocation) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4022c024: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403d754c: ?? (??:0)
   at 0x403d76e7: ffi_call_SYSV (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403d7697: ffi_raw_call (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4022e20b: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403e2644: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_InterpMethodInvocation) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4022c024: _Jv_InBFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
terpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x403d754c: ?? (??:0)
   at 0x40232408: gnu.gcj.runtime.FirstThread.call_main() (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x402bab18: gnu.gcj.runtime.FirstThread.run() (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4023dbcc: _Jv_ThreadRun(java.lang.Thread) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x4021a2c4: _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/packages/gnu-snapshot/lib/libgcj.so.3)
   at 0x08048a20: main (get_vector/../../../libjava/gij.cc:140)
   at 0x405de668: __libc_start_main (/lib/libc.so.6)
   at 0x08048781: _start (??:0)

When I look (using strace) what files gij is trying to open(),
I see that it searching for "./prog.properties" and "./prog.class"
but not for "./prog_fr.properties" and "./prog_fr.class". It should
search first for "./prog_fr.properties" and "./prog_fr.class" and
then only for "./prog.properties" and "./prog.class".

>Fix:

Fix the internal working of this function.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-23 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06 16:32 libgcj/6576: java.util.ResourceBundle.getResource ignores locale tromey
  -- strict thread matches above, loose matches on Subject: below --
2002-09-23 10:58 tromey
2002-05-06  4:26 Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).