public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: vpuskas@eunet.yu To: gcc-gnats@gcc.gnu.org Subject: libgcj/10421: java.text.Collator.getInstance returns null for "de" locale Date: Wed, 16 Apr 2003 09:36:00 -0000 [thread overview] Message-ID: <20030416092854.17593.qmail@sources.redhat.com> (raw) >Number: 10421 >Category: libgcj >Synopsis: java.text.Collator.getInstance returns null for "de" locale >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Apr 16 09:36:02 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Vladimir Puskas >Release: 3.3 20030415 (prerelease) >Organization: >Environment: RedHat 8.0 & Slackware 8.0 >Description: Collator.getInstance returns null for "de" locale. Sample code throws NullPointerException, 'cause getInstance doesn't create Collator. Problem is in RuleBasedCollator constructor which doesn't handle '&' reset properly. The fix bellow solves the problem for me. I don't know if this could be related to PR 9613. >How-To-Repeat: /* TestCollator.java */ import java.text.Collator; import java.text.RuleBasedCollator; import java.util.Locale; class TestCollator { public static void main (String[]argv) throws Throwable { Collator c = Collator.getInstance (new Locale ("de")); printCompare (c, "stra\u00dfe", "stra\u00dfe"); printCompare (c, "M\u00fcnchen", "Muenchen"); c = new RuleBasedCollator ("<a<b<c&c<d<e"); printCompare (c, "bc", "bc"); printCompare (c, "abcde", "abcd"); } public static void printCompare (Collator c, String one, String two) { System.out.println (one +"-("+ c.compare (one, two) +")-"+ two); } } /* End of TestCollator.java */ >Fix: --- gcc-cvs/libjava/java/text/RuleBasedCollator.java 2001-09-07 02:15:47.000000000 +0200 +++ gcc-local/libjava/java/text/RuleBasedCollator.java 2003-03-05 10:41:39.000000000 +0100 @@ -286,12 +286,24 @@ if (argument.length() == 0) throw new ParseException ("invalid character", save); String arg = argument.toString(); - int item_index = vec.indexOf(arg); + char arg_c = arg.charAt (0); + int item_index = -1; + boolean remove2 = false; + for (int i = vec.size () - 1; i > 0; --i ) { + RBCElement rbc = (RBCElement) vec.elementAt (i); + if (arg_c == rbc.key.charAt (0)) { + item_index = i; + if (arg.equals (rbc.key)&&(c == rbc.relation)) { + remove2 = true; + } + break; + } + } if (c != '&') { // If the argument already appears in the vector, then we // must remove it in order to re-order. - if (item_index != -1) + if ((item_index != -1)&&remove2) { vec.removeElementAt(item_index); if (insertion_index >= item_index) >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2003-04-16 9:36 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030416092854.17593.qmail@sources.redhat.com \ --to=vpuskas@eunet.yu \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).