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

fp.bugs 3090 thread.setMaxPriority() sets threadgroup priority based on index

    Details

    • Subcomponent:
    • Resolved In Build:
      1.0.2
    • CPU:
      sparc
    • OS:
      solaris_2.4
    • Verification:
      Not verified

      Description

      To followup on this bug, please contact ###@###.###

      This one comes from a customer.
      From: rosanna@caribe (Rosanna Lee)
      To: hagen@scndprsn
      Subject: Re: setMaxPriority bug report


      I don't have a code example, because I found this bug
      by inspection of the logic.

      Existing code:

      1 public final synchronized void setMaxPriority(int pri) {
      2 checkAccess();
      3 if (pri < Thread.MIN_PRIORITY) {
      4 maxPriority = Thread.MIN_PRIORITY;
      5 } else if (pri < maxPriority) {
      6 maxPriority = pri;
      7 }
      8 for (int i = 0 ; i < ngroups ; i++) {
      9 groups[i].setMaxPriority(i);
      10 }
      11 }


      The problem is with line 9. The current logic will set the
      maxPriority of groups[1] to 1, groups[2] to 2, groups[3] to 3, etc.

      Since the intention of this routine is to set the
      maxPriority to 'pri', line 9 should be replaced with

      9 groups[i].setMaxPriority(pri);

      You can verify both the original problem and the fix
      by creating a hierarchy of ThreadGroups and call setMaxPriority()
      on the root, and inspect the maxPriorities of the children groups.

        Attachments

          Activity

            People

            • Assignee:
              fyellinsunw Frank Yellin (Inactive)
              Reporter:
              vssriniv Vijay Srinivasan (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: