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

CollationElementIterator.setText() throws unexpected IndexOutOfBoundsException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • sparc
    • solaris_2.6



      Name: auR10023 Date: 10/22/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b24"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
          api/java_text/CollationElementIterator/index.html#ColltnElmtIter[CollationElementIterator0011]


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      java.text
      Class CollationElementIterator
      ...

      setText

      public void setText(CharacterIterator source)

          Set a new string over which to iterate.

      Parameters:
      source - the new source text.Since:
      1.2


      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================

      Method java.text.CollationElementIterator.setText(CharacterIterator) throws
       unexpected IndexOutOfBoundsException during second execution.
          
      Minimized test:
      ===============
      ------- Test.java -------
      import java.text.*;
      class Test {
          public static void main(String[] args) {
              try {
                  RuleBasedCollator rbc = new RuleBasedCollator("< c, C < d; D");
                  CollationElementIterator iterator =
                      rbc.getCollationElementIterator("");
                  CharacterIterator source =
                      new StringCharacterIterator("xyz abc1234567890", 7, 7, 7);
                  iterator.setText(source);
                  source =
                      new StringCharacterIterator("xyz abcc1234567890", 7, 8, 7);
                  iterator.setText(source);
              } catch (ParseException e) {
              }
          }
      }

      ------- end-of-Test.java -------

      Minimized test output:
      ======================

      #java Test
      Exception in thread "main" java.lang.IndexOutOfBoundsException
              at sun.text.UCharacterIterator$CharacterIteratorWrapper.setIndex(UCharacterIterator.java:311)
              at sun.text.Normalizer.reset(Normalizer.java:849)
              at sun.text.Normalizer.setText(Normalizer.java:1065)
              at java.text.CollationElementIterator.setText(CollationElementIterator.java:500)
              at Test.main(Test.java:13)



      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      Specific Machine Info:
      =====================
      SunOS archer 5.8 Generic_108528-24 sun4u sparc SUNW,Ultra-4

      ======================================================================

            sherman Xueming Shen
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: