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

Error in method Iterator.remove() from ArrayBlockingQueue

XMLWordPrintable

    • b08
    • b25
    • generic
    • generic

        During backporting test fixes was found product issue which was hidden by test error.
        Method remove() from ArrayBlockingQueue's iterator work incorrectly
        if delete no first element. For example:

        import java.util.Iterator;
        import java.util.concurrent.ArrayBlockingQueue;

        public class ABQueue {

            public static void main(String[] args) throws Exception {
                ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(3);
                queue.add(1);
                queue.add(2);
                queue.add(3);
                System.out.println("Size before: "+queue.size());
                Iterator<Integer> i = queue.iterator();
                i.next();
                i.next();
                i.remove();
                i.next();
                i.remove();
                System.out.println("Size after: "+queue.size());
            }
        }

        Results for 1.6.0_29b11:
        java.exe ABQueue
        Size before: 3
        Size after: 1

        Results for 1.6.0_30b12:
        java.exe ABQueue
        Size before: 3
        Size after: 2

              dmeetry Dmeetry Degrave (Inactive)
              psemenov Pavel Semenov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: