-
Bug
-
Resolution: Fixed
-
P3
-
1.0
-
1.0.2
-
sparc
-
solaris_2.4
-
Not verified
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.
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.