-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0, 5.0
-
b15
-
generic
-
generic
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2152024 | 6u10 | Chris Hegarty | P2 | Resolved | Fixed | b20 |
JDK-2152887 | OpenJDK6 | Chris Hegarty | P3 | Resolved | Fixed | b01 |
Name: skR10005 Date: 06/26/2002
The API spec for method ThreadGroup.setMaxPriopity reads
If the pri argument is less than Thread.MIN_PRIORITY or greater than
Thread.MAX_PRIORITY, the maximum priority of the group remains unchanged.
The new JCK test
api/java_lang/ThreadGroup/setMaxPriority01/setMaxPriority0105/setMaxPriority0105.html
checks this assertion. However, this test failed under all previous
JDK versions up to JDK 1.4.1-rc.
To reproduce this failure, a simple example can be used:
=================setMaxPriority0105.java=================
import java.io.PrintStream;
public class setMaxPriority0105 {
public void run(String argv[], PrintStream log, PrintStream out) {
ThreadGroup thg = new ThreadGroup("setMaxPriority0105");
int prio = thg.getMaxPriority();
thg.setMaxPriority(Thread.MIN_PRIORITY - 1);
if(prio != thg.getMaxPriority()) {
out.println("thread group priority is changed:" +
prio + "-" + thg.getMaxPriority());
}
}
public static void main(String args[]) {
(new setMaxPriority0105()).run(args, System.err, System.out);
}
}
========================================================
The log of execution is following:
$ javac -d . setMaxPriority0105.java
$ java -version
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b15)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b15, mixed mode)
$ $ java -cp . setMaxPriority0105
thread group priority is changed:10-1
======================================================================
The API spec for method ThreadGroup.setMaxPriopity reads
If the pri argument is less than Thread.MIN_PRIORITY or greater than
Thread.MAX_PRIORITY, the maximum priority of the group remains unchanged.
The new JCK test
api/java_lang/ThreadGroup/setMaxPriority01/setMaxPriority0105/setMaxPriority0105.html
checks this assertion. However, this test failed under all previous
JDK versions up to JDK 1.4.1-rc.
To reproduce this failure, a simple example can be used:
=================setMaxPriority0105.java=================
import java.io.PrintStream;
public class setMaxPriority0105 {
public void run(String argv[], PrintStream log, PrintStream out) {
ThreadGroup thg = new ThreadGroup("setMaxPriority0105");
int prio = thg.getMaxPriority();
thg.setMaxPriority(Thread.MIN_PRIORITY - 1);
if(prio != thg.getMaxPriority()) {
out.println("thread group priority is changed:" +
prio + "-" + thg.getMaxPriority());
}
}
public static void main(String args[]) {
(new setMaxPriority0105()).run(args, System.err, System.out);
}
}
========================================================
The log of execution is following:
$ javac -d . setMaxPriority0105.java
$ java -version
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b15)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b15, mixed mode)
$ $ java -cp . setMaxPriority0105
thread group priority is changed:10-1
======================================================================
- backported by
-
JDK-2152024 (thread) ThreadGroup.setMaxPriority changes priority if param is out of range
- Resolved
-
JDK-2152887 (thread) ThreadGroup.setMaxPriority changes priority if param is out of range
- Resolved
- relates to
-
JDK-6497629 (thread) ThreadGroup.setMaxPriority checks against last set maximum, not parent's maximum
- Resolved