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

Choosing "Delete" from Windows 10 context menu freezes java.awt.FileDialog

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      windows_10

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.10586]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Stock Windows 10

      A DESCRIPTION OF THE PROBLEM :
      When opening a java.awt.FileDialog right-clicking a file in the context menu and choosing "Delete" the FileDialog as well as the entire application freezes and becomes unusable. Please see test source code below.

      If you right click and create a new file and then delete that file within the dialog, this does not happen.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      * compile and run the provided source in Windows 10
      * click the "select file" button
      * navigate to a directory with a file that can be deleted
      * right click on this file
      * Choose "Delete" from the context menu that appears
      * The application will freeze and become completely unresponsive, only closable via Task Manager

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would expect one of the following:
      * "Delete" is not an option in the drop-down
      * "Delete" works as in other windows file selection dialogs, deleting the file and allowing the application to continue functioning as normal.
      ACTUAL -
      The application totally freezes.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Thread dump at time of freeze (may or may not be useful):

      2016-07-14 11:59:59
      Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode):

      "JMX server connection timeout 22" #22 daemon prio=5 os_prio=0 tid=0x0000000016c2b000 nid=0x1248 in Object.wait() [0x000000001f6df000]
         java.lang.Thread.State: TIMED_WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000eb298e08> (a [I)
      at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run(Unknown Source)
      - locked <0x00000000eb298e08> (a [I)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "RMI Scheduler(0)" #21 daemon prio=5 os_prio=0 tid=0x0000000016c28000 nid=0x554 waiting on condition [0x000000001f5de000]
         java.lang.Thread.State: TIMED_WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x00000000eb15a7f0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
      at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "RMI TCP Connection(1)-10.0.2.15" #20 daemon prio=5 os_prio=0 tid=0x0000000016261800 nid=0x9d0 runnable [0x000000001f4de000]
         java.lang.Thread.State: RUNNABLE
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.socketRead(Unknown Source)
      at java.net.SocketInputStream.read(Unknown Source)
      at java.net.SocketInputStream.read(Unknown Source)
      at java.io.BufferedInputStream.fill(Unknown Source)
      at java.io.BufferedInputStream.read(Unknown Source)
      - locked <0x00000000eb2650e0> (a java.io.BufferedInputStream)
      at java.io.FilterInputStream.read(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$16/1986908738.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - <0x00000000eb16cb40> (a java.util.concurrent.ThreadPoolExecutor$Worker)

      "RMI TCP Accept-0" #19 daemon prio=5 os_prio=0 tid=0x000000001625e800 nid=0xe68 runnable [0x000000001f2df000]
         java.lang.Thread.State: RUNNABLE
      at java.net.DualStackPlainSocketImpl.accept0(Native Method)
      at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source)
      at java.net.AbstractPlainSocketImpl.accept(Unknown Source)
      at java.net.PlainSocketImpl.accept(Unknown Source)
      - locked <0x00000000eb15ca48> (a java.net.SocksSocketImpl)
      at java.net.ServerSocket.implAccept(Unknown Source)
      at java.net.ServerSocket.accept(Unknown Source)
      at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "Thread-3" #17 prio=6 os_prio=0 tid=0x0000000016133800 nid=0xde0 runnable [0x000000001d4df000]
         java.lang.Thread.State: RUNNABLE
      at sun.awt.windows.WFileDialogPeer._show(Native Method)
      at sun.awt.windows.WFileDialogPeer.access$000(Unknown Source)
      at sun.awt.windows.WFileDialogPeer$1.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "DestroyJavaVM" #15 prio=5 os_prio=0 tid=0x00000000023ae000 nid=0xed4 waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

         Locked ownable synchronizers:
      - None

      "AWT-EventQueue-0" #13 prio=6 os_prio=0 tid=0x0000000016412000 nid=0x117c waiting on condition [0x0000000016b6b000]
         java.lang.Thread.State: WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x00000000ead52e90> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
      at java.util.concurrent.locks.LockSupport.park(Unknown Source)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
      at java.awt.EventQueue.getNextEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.WaitDispatchSupport$2.run(Unknown Source)
      at java.awt.WaitDispatchSupport$4.run(Unknown Source)
      at java.awt.WaitDispatchSupport$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.awt.WaitDispatchSupport.enter(Unknown Source)
      at java.awt.Dialog.show(Unknown Source)
      at java.awt.Component.show(Unknown Source)
      at java.awt.Component.setVisible(Unknown Source)
      at java.awt.Window.setVisible(Unknown Source)
      at java.awt.Dialog.setVisible(Unknown Source)
      at us.grider.FileDialogTest$ChooseFile.actionPerformed(FileDialogTest.java:87)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$500(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "AWT-Windows" #11 daemon prio=6 os_prio=0 tid=0x000000001640b000 nid=0x830 runnable [0x000000001695e000]
         java.lang.Thread.State: RUNNABLE
      at sun.awt.windows.WToolkit.eventLoop(Native Method)
      at sun.awt.windows.WToolkit.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "AWT-Shutdown" #10 prio=5 os_prio=0 tid=0x0000000016406800 nid=0x5a8 in Object.wait() [0x000000001685e000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000ead4f208> (a java.lang.Object)
      at java.lang.Object.wait(Unknown Source)
      at sun.awt.AWTAutoShutdown.run(Unknown Source)
      - locked <0x00000000ead4f208> (a java.lang.Object)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "Java2D Disposer" #9 daemon prio=10 os_prio=2 tid=0x0000000016404000 nid=0xbd8 in Object.wait() [0x000000001675f000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000ead49ef8> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(Unknown Source)
      - locked <0x00000000ead49ef8> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(Unknown Source)
      at sun.java2d.Disposer.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "Service Thread" #8 daemon prio=9 os_prio=0 tid=0x0000000014ad6000 nid=0x13a0 runnable [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

         Locked ownable synchronizers:
      - None

      "C1 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x0000000014a5d800 nid=0xd60 waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

         Locked ownable synchronizers:
      - None

      "C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x0000000014a5a800 nid=0x2dc waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

         Locked ownable synchronizers:
      - None

      "Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x0000000014a59800 nid=0xd5c waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

         Locked ownable synchronizers:
      - None

      "Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000014a58000 nid=0x121c runnable [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

         Locked ownable synchronizers:
      - None

      "Finalizer" #3 daemon prio=8 os_prio=1 tid=0x00000000024a8800 nid=0xd0 in Object.wait() [0x0000000015a9f000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000eab08ee0> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(Unknown Source)
      - locked <0x00000000eab08ee0> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(Unknown Source)
      at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x000000000249f000 nid=0x604 in Object.wait() [0x000000001599f000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000eab06b50> (a java.lang.ref.Reference$Lock)
      at java.lang.Object.wait(Unknown Source)
      at java.lang.ref.Reference.tryHandlePending(Unknown Source)
      - locked <0x00000000eab06b50> (a java.lang.ref.Reference$Lock)
      at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)

         Locked ownable synchronizers:
      - None

      "VM Thread" os_prio=2 tid=0x0000000014a27000 nid=0x12c0 runnable

      "GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00000000023c6000 nid=0x8c8 runnable

      "GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00000000023c7800 nid=0x1208 runnable

      "GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00000000023c9000 nid=0x638 runnable

      "VM Periodic Task Thread" os_prio=2 tid=0x0000000014adb000 nid=0x29c waiting on condition

      JNI global references: 488


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package us.grider;

      import javax.swing.AbstractAction;
      import javax.swing.BoxLayout;
      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JLabel;
      import javax.swing.SwingUtilities;
      import javax.swing.WindowConstants;

      import java.beans.PropertyChangeEvent;
      import java.beans.PropertyChangeListener;

      import java.awt.FileDialog;
      import java.awt.Frame;
      import java.awt.MenuItem;
      import java.awt.PopupMenu;

      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      public class FileDialogTest {

        public static void main(String[] args) {
          try {
            Runnable showApplication = new Runnable() {
              @Override
              public void run() {
                FileDialogTestFrame frame = new FileDialogTestFrame();
                frame.setVisible(true);
              }
            };
            SwingUtilities.invokeAndWait(showApplication);
          } catch (Exception e) {
            // silence compiler warning
          }
        }

        static class FileDialogTestFrame extends JFrame {
          public FileDialogTestFrame() {
            setTitle("File Dialog Test");

            setSize(100, 100);
            FileNameDisplay display = new FileNameDisplay();
            ChooseFile chooser = new ChooseFile(this);
            chooser.addPropertyChangeListener(display);
            JPanel panel = new JPanel();
            panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
            panel.add(new JButton(chooser));
            panel.add(display);
            add(panel);

            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          }
        }

        static class FileNameDisplay extends JLabel implements PropertyChangeListener {
          public FileNameDisplay() {
            setText("no file selected");
          }

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getNewValue() == null) {
              return;
            } else if (evt.getNewValue().equals("")) {
              setText("no file selected");
            } else {
              setText(evt.getNewValue().toString());
            }
          }
        }

        static class ChooseFile extends AbstractAction {
          private Frame parent;
          private String selectedFile = "";

          public ChooseFile(Frame parent) {
            super("select file");
            this.parent = parent;
          }

          @Override
          public void actionPerformed(ActionEvent a) {
            FileDialog dialog = new FileDialog(parent, "choose a file", FileDialog.LOAD);
            dialog.setVisible(true);
            String oldFile = selectedFile;
            selectedFile = dialog.getFile();
            firePropertyChange("selectedFile", oldFile, selectedFile);
          }
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Avoid right-clicking to delete a file.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aivanov Alexey Ivanov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: