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

Vector.removeAllElements() no concurrent modification detect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.1
    • core-libs
    • beta
    • generic
    • generic
    • Verified



      Name: clC74495 Date: 12/09/99


      import java.util.*;
      public class testmod {
        Vector thevec;

        public testmod() {
          thevec = new Vector();
          thevec.addElement(null); // add one element to the vector
        }

        public void test()
        {
          Iterator it = thevec.iterator();
          thevec.removeAllElements(); // delibrate modification
          try {
            it.next();
          }
          catch (ConcurrentModificationException e1) {
            System.out.println("OK");
          }
          catch (Exception e2) {
            System.out.println("wrong exception");
          }
        }
        public static void main(String[] args) {
          testmod obj = new testmod();
          obj.test();
        }
      }
      (Review ID: 98801)
      ======================================================================

            jjb Josh Bloch (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: