Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6421373

ImageIcon does not reassert interrupt status.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 15
    • 5.0, 8, 11, 13, 14, 15
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The ImageIcon does not reassert the interrupt status of the current thread. If the interrupt signal is used to cancel a task that displays a message dialog, the ImageIcon will lose that signal.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The interrupt status of the current thread should return true. Then the caller would know if the action was canceled.
      ACTUAL -
      INTERRUPTED while loading Image
      false

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      INTERRUPTED while loading Image

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class IconTest implements Runnable {
        public IconTest() {
        }
        
        public void run() {
          Thread.currentThread().interrupt(); //simulate user requested cancel.
          JOptionPane.showMessageDialog(null, "");
          /*ImageIcon i = new ImageIcon("http://java.sun.com/im/mh_thumb_jgosling.jpg");*/
          System.out.println(Thread.interrupted());
        }

        public static void main(String[] args) {
          SwingUtilities.invokeLater(new IconTest());
        }
      }
      ---------- END SOURCE ----------

            psadhukhan Prasanta Sadhukhan
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: