SwingWorker.get does not throw InterruptedException

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: 6
    • Component/s: client-libs

      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();
          }
      }
      -------

            Assignee:
            Igor Kushnirskiy (Inactive)
            Reporter:
            Yury Danilevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: