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

ImageIO fails to read the image from the file when a modeless file dialog is active, Win32

XMLWordPrintable

    • x86
    • windows_xp

      I am showing a frame on the screen with 3 buttons. Click the middle button opens up a native file dialog which is modeless. So even after the file dialog is made visible, user can still interact with the frame. When I click on the third button on the frame - 'Read Image', I am trying to read an image from a file in the current directory. I am doing this when the file dialog is visible. This results in an IIOException from ImageIO. When I dispose the fialog dialog and click on the 'Read Image' button, the image is read properly.

      This is reproducible on Mustang atleast since b59d. This is not reproducible on Tiger since FileDialog always stays modal even when modality is turned off through setModal(false). This is reproducible only on Win32 and not reproducible on XToolkit.

      I have attached a sample test. Execute the sample test. A frame will be shown. Click on 'Read Image' button. The image will be printed on the command prompt. Now click on 'Open File Dialog'. A file dialog will appear. Keeping the file dialog on the screen, click on 'Read Image' button. An IIOException will be thrown on the command prompt.

      Here is the exception -
      javax.imageio.IIOException: Can't read input file!
      at javax.imageio.ImageIO.read(ImageIO.java:1279)
      at ReadImageFileDialogTest.actionPerformed(ReadImageFileDialogTest.java:66)
      at java.awt.Button.processActionEvent(Button.java:388)
      at java.awt.Button.processEvent(Button.java:356)
      at java.awt.Component.dispatchEventImpl(Component.java:4365)
      at java.awt.Component.dispatchEvent(Component.java:4195)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

            art Artem Ananiev (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: