-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6
-
generic
-
generic
When worker thread in doInBackground method is interrupted then worker.get throws ExecutionException whereas the spec state that InterruptedException should be thrown.
You may reproduce it with usage of the following code:
------------
import javax.swing.*;
import java.util.concurrent.ExecutionException;
public class Test {
public static void main(String[] args) throws ExecutionException, InterruptedException {
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws InterruptedException {
Thread.currentThread().interrupt();
Thread.sleep(100);
return null;
}
};
worker.execute();
Thread.sleep(100);
worker.get();
}
}
-------
You may reproduce it with usage of the following code:
------------
import javax.swing.*;
import java.util.concurrent.ExecutionException;
public class Test {
public static void main(String[] args) throws ExecutionException, InterruptedException {
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws InterruptedException {
Thread.currentThread().interrupt();
Thread.sleep(100);
return null;
}
};
worker.execute();
Thread.sleep(100);
worker.get();
}
}
-------