LinkedBlockingQueue.toArray(x) does not set "one-past" element of x to null

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 6
    • Affects Version/s: 6
    • Component/s: core-libs
    • b49
    • generic
    • generic
    • Verified

        This program:

        import java.util.*;
        import java.util.concurrent.*;

        public class Bug {
            public static void main(String[] args) throws Throwable {
        Collection<Integer> c = new LinkedBlockingQueue<Integer>();
        Integer[] a = new Integer[1];
        a[0] = 42;
        System.out.println(c.toArray(a)[0]);
            }
        }

        should print "null", but actually prints 42.

              Assignee:
              Martin Buchholz
              Reporter:
              Martin Buchholz
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: