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

SynchronizedNavigableSet tailSet uses wrong mutex

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u5
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b26
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      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

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

                  Dates

                  Created:
                  Updated:
                  Resolved: