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

Error in method Iterator.remove() from ArrayBlockingQueue

    Details

    • Subcomponent:
    • Introduced In Build:
      b08
    • Introduced In Version:
    • Resolved In Build:
      b25
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        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

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: