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

SortedSet.clear() throws java.lang.IllegalStateException

XMLWordPrintable

    • beta2
    • generic
    • generic
    • Verified

      method clear() in interface java.util.SortedSet throws java.lang.IllegalStateException

      with b67 ,this exception is thrown on almost all platforms ( I tried on Solaris 8 & 9 , Win2000,win98 and Redhat7.1 )

      with b66 the same works fine.


      testcase
      -------------------
       TreeSet treeSet = new TreeSet();
                  for (int i = 1; i <=10; i++) {
                      treeSet.add(new Integer(i));
                   
                  }
                  SortedSet sortedSubSet =treeSet.subSet(new Integer(4),new Integer(10));
                  sortedSubSet.clear();
      -----------------------------------


      Please see the attached testcase :
      -----------------------------------

      testresult
      -----------------------------------
      #java.lang.IllegalStateException
      # at java.util.TreeMap$Iterator.remove(TreeMap.java:1030)
      # at java.util.AbstractCollection.clear(AbstractCollection.java:417)
      # at java.util.AbstractMap.clear(AbstractMap.java:320)
      # at java.util.TreeSet.clear(TreeSet.java:218)
      # at SubSet.SubSetTest06(SubSet.java:369)
      # at SubSet.main(SubSet.java:136)
      #Exception in thread "main" java.lang.Exception: Test Fail
      # at TestHelper.exit(TestHelper.java:102)
      # at SubSet.main(SubSet.java:181)

      -----------------------------------


      Verified in b75( Aug 17 2001)
      Sreejith A K

            jjb Josh Bloch
            saksunw Sreejith Ak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: