-
Bug
-
Resolution: Fixed
-
P3
-
6, 6u10, 9, 10, 11
-
b19
-
generic, x86
-
generic, windows_vista
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8205768 | 11.0.1 | Sergey Bylokhov | P3 | Resolved | Fixed | team |
SwingWorker.get sometimes throws CancellationException if the cancel method has been invoked. To reproduce it use the following test:
---------------
import javax.swing.*;
import java.util.concurrent.ExecutionException;
public class Test {
public static void main(String[] args) throws InterruptedException, ExecutionException {
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws InterruptedException {
while (true);
}
};
worker.execute();
Thread.sleep(500);
worker.cancel(true);
worker.get();
}
}
-----------
The spec doesn't mention CancellationException so this behavior is unpredicatable.
---------------
import javax.swing.*;
import java.util.concurrent.ExecutionException;
public class Test {
public static void main(String[] args) throws InterruptedException, ExecutionException {
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws InterruptedException {
while (true);
}
};
worker.execute();
Thread.sleep(500);
worker.cancel(true);
worker.get();
}
}
-----------
The spec doesn't mention CancellationException so this behavior is unpredicatable.
- backported by
-
JDK-8205768 SwingWorker.get throws CancellationException
-
- Resolved
-
- csr for
-
JDK-8204587 SwingWorker.get throws CancellationException
-
- Closed
-
- duplicates
-
JDK-6788476 SwingWorker#get throws CancellationException is not documented
-
- Closed
-
- relates to
-
JDK-6299797 FutureTask.get should document @throws CancellationException
-
- Resolved
-
- links to