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

java.text.CollationElementIterator.reset() throws NullPointerException

XMLWordPrintable

    • 1.1.8
    • sparc
    • solaris_2.5
    • Verified



        Name: dfC67450 Date: 01/06/98



        The java.text.CollationElementIterator.reset() method does not work correctly.
        This method throws NullPointerException when string under iteration is empty.

        Here is the test demonstrating the bug:

        -----------------TestA.java------------------------
        import java.text.*;

        public class TestA {
            public static void main (String args[]){
              RuleBasedCollator rbc = null;
              try {
                rbc = new RuleBasedCollator("< a < b");
              } catch (ParseException e) {
                 System.out.println("Unexpected ParseException: "+e);
              }
              CollationElementIterator iterator =
                    rbc.getCollationElementIterator("");
              iterator.reset();
              if (iterator.next() == iterator.NULLORDER) System.out.println("Ok");
            }
        }
        ---------Output from the test in JDK1.1.6---------------------
        java.lang.NullPointerException
                at java.text.CollationElementIterator.reset(CollationElementIterator.java:125)
                at TestA.main(TestA.java:13)

        ---------Output from the test in JDK1.1.5---------------------
        Ok
        --------------------------------------------------------------

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

              lwernersunw Laura Werner (Inactive)
              dfazunensunw Dmitri Fazunenko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: