Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4141640

Support for Swedish/Danish gone in 1.1.6: Collator.getInstance throws exception

XMLWordPrintable

    • 1.1.6
    • x86
    • windows_nt



      Name: clC74495 Date: 05/25/98


      The following program ran in 1.1.5 but
      crashes in 1.1.6:

      // This program worked fine in jdk 1.1.5 but is broken
      // in 1.1.6 generating an Array Index out of bounds at
      // RuleBasedCollator.getContractValues()

      import java.util.Locale;
      import java.text.Collator;

      public class test {
        public static void main(String args[]) {
      Collator collator = Collator.getInstance(new Locale("sv", "SE", ""));
        }
      }

      ================================================================
      Carlos.Lucasius@Canada (May 25, 1998):

      Verified that this bug occurs exactly as described.
      It's a general win32 bug, as I have also observed
      it on win95. It does not occur on Solaris, though.
      Also, the bug seems to have been already fixed in
      JDK1.2beta4 -- not sure about JDK1.1.7...

      (Review ID: 29573)
      ======================================================================



      ================================================================
      Carlos.Lucasius@Canada (May 28, 1998):
      Similar report from Denmark:

      When creating a Collator, with this statement:
        
          Collator myCollator=Collator.getInstance();

      in JDK1.1.6 (Win32), I get the following exception:

      java.lang.ArrayIndexOutOfBoundsException: 10 >= 10
        at java.lang.Throwable.<init>(Compiled Code)
        at java.util.Vector.elementAt(Compiled Code)
        at java.text.RuleBasedCollator.getContractValues(Compiled Code)
        at java.text.RuleBasedCollator.addContractOrder(Compiled Code)
        at java.text.RuleBasedCollator.build(Compiled Code)
        at java.text.RuleBasedCollator.<init>(Compiled Code)
        at java.text.Collator.getInstance(Compiled Code)
        at java.text.Collator.getInstance(Compiled Code)
        at MyClass.MyMethod(Compiled Code)

      It works fine in JDK1.1.5.
      My locale is Denmark.

      company - NetKompagniet , email - ###@###.###
      (Review ID: 29158)

      ================================================================
      Carlos.Lucasius@Canada (May 28, 1998):
      Similar bug from Sweden (again):

       I get the below exception when I try to sort my strings on jdk1.1.6
      With Symantec Visual CafePDE however it works all right.
       I tried both the using the default Locale and the Swedish one but got
      similar errors.
      Apperantly it has something to do with the swedish characters å,ä and ö
      because when I replaced theses characters with a,a and o it worked fine.

      Good Luck with the bug (if there is one?)
      /David Lilljegren

      //Method invoking the sort
      private void printSortedSet(OrderedSet os){
           BinaryPredicate bp = new StringComparer();
           OrderedSet abSorted = new OrderedSet( bp);
           Collator coll=Collator.getInstance(new Locale("SV","sv"));
           System.out.println("CheckPoint I");
           for(Enumeration e=os.elements();e.hasMoreElements();){
               abSorted.add(coll.getCollationKey((String)e.nextElement() ));
               System.out.println("Checkpoint II");
           }

      //Method called by the jgl.OrderedSet to compare the objects
      public boolean execute(Object first,Object second){
           System.out.println("Comparing");
           System.out.println(((CollationKey)first).getSourceString());
           System.out.println(((CollationKey)second).getSourceString());
           int comp= ((CollationKey)first).compareTo((CollationKey)second);
           return comp<0;
       }

      //Output in DOS "_" is a å
      CheckPoint I
      Checkpoint II
      Comparing
      byggnad
      programmeringsspr_k
      Comparing
      byggnad
      programmeringsspr_k
      Checkpoint II
      Exception occurred during event dispatching:
      java.lang.ArrayIndexOutOfBoundsException: 2 >= 2
              at java.lang.Throwable.<init>(Compiled Code)
              at java.util.Vector.elementAt(Compiled Code)
              at java.text.RuleBasedCollator.getContractValues(Compiled Code)
              at
      java.text.RuleBasedCollator.getContractValues(RuleBasedCollator.java:
      926)
              at java.text.CollationElementIterator.nextContractChar(Compiled
      Code)
              at java.text.CollationElementIterator.next(Compiled Code)
              at java.text.RuleBasedCollator.getCollationKey(Compiled Code)
              at waf.dli.syntaxChecker.SyntaxChecker.printSortedSet(Compiled
      Code)
              at waf.dli.syntaxChecker.SyntaxChecker.secondKbsCheck(Compiled
      Code)
              at
      waf.dli.syntaxChecker.SyntaxChecker.start(SyntaxChecker.java:195)
              at
      waf.dli.syntaxChecker.SyntaxCheckerFrame.checkRelation(SyntaxCheckerF
      rame.java:110)
              at
      waf.dli.syntaxChecker.SyntaxCheckerFrame.buttonOpen_Clicked(SyntaxChe
      ckerFrame.java:75)
              at
      waf.dli.syntaxChecker.SyntaxCheckerFrame$Action.actionPerformed(Synta
      xCheckerFrame.java:269)
              at java.awt.Button.processActionEvent(Compiled Code)
              at java.awt.Button.processEvent(Compiled Code)
              at java.awt.Component.dispatchEventImpl(Compiled Code)
              at java.awt.EventDispatchThread.run(Compiled Code)

      (company - TaData , email - ###@###.###)
      (Review ID: 32442)

            lwernersunw Laura Werner (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: