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

SynchronizedNavigableSet tailSet uses wrong mutex

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8u5
    • core-libs
    • b26
    • generic
    • generic
    • Verified

    Backports

      Description

        FULL PRODUCT VERSION :


        A DESCRIPTION OF THE PROBLEM :
        In the version of the tailSet method taking two arguments, in the implementation of java.util.Collections.SynchronizedNavigableSet, the method creates a new SynchronizedNavigableSet using the default mutex (this) rather than the correct mutex object for that set.

        This is the offending code:

            public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
                synchronized (mutex) {
                    return new SynchronizedNavigableSet<>(ns.tailSet(fromElement, inclusive));
                }
            }

        Should be:

            public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
                synchronized (mutex) {
                    return new SynchronizedNavigableSet<>(ns.tailSet(fromElement, inclusive), mutex);
                }
            }


        REPRODUCIBILITY :
        This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

                mduigou Mike Duigou
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: