This discussion is archived
1 2 Previous Next 17 Replies Latest reply: May 31, 2013 12:51 PM by 1012166 RSS

JFileChooser crashes JVM - bug basically ignored. What can I do?

swpalmer Newbie
Currently Being Moderated
See:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7160713

The bug has been marked as incomplete,needs more info, and "Low Prioroty" - Yet there is no mechanism to provide any more information. There is no way to add comments, or vote. The bug brings down the entire JVM with a native crash and it is trivial to reproduce.

I would provide any information that is asked of me - but I need a way to do it. I think I got an email request for info (It's been a while now), but replies to the email bounced, and as noted above the bug page has no way to give feedback.

Use any JFileChooser, click on the "Details" view. Then start clicking on column headings... after a few clicks the JVM crashes. Tested again with 7u6 - still crashes.
  • 1. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    RogerL (Oracle) Java Champion
    Currently Being Moderated
    Hi Swplamer,

    It may be 'trivial' but has not been able to be reproduced with the information in the report nor with other test cases at hand.
    Do you have a small, simple test case that causes the crash? Also include exact JRE version information, browser, OS.

    -Roger
  • 2. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    I'm running a 32-bit JRE on 64-bit Windows 7.
    The bug has been around for all versions of Java 7 for Windows. At least 7u2 through 7u6.
    Reproduction steps are above. Any JFileChooser used for a file open dialog... click the button to go to details view. Start clicking on column headings. JVM crashes after a few clicks. That's all there is to it. If it didn't crash for you, click a few more times, it will crash.

    When I was asked for feedbakc originally via "Incident Review Id #2226558", I wrote a program that reproduced it using the Robot class and attempted to email it. I replied to the incident review email as it said I could at the beginning of the email. All attempts to reply to that review email bounced, and as noted already there is no way to provide feedback via the bug page.

    This seems to be related to bug #7177373 as well.

    Here is the test case I tried to send back then...
    /*
    * JFileChooser Windows Crash
    */
    package filechoosercrash;
    
    import java.awt.BorderLayout;
    import java.awt.Robot;
    import java.awt.Window;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.InputEvent;
    import java.util.concurrent.CountDownLatch;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.SwingUtilities;
    
    /**
    *
    * @author scott
    */
    public class FileChooserCrash {
    
       static CountDownLatch latch = new CountDownLatch(1);
       static JFrame frame;
       static JButton button;
       static JFileChooser chooser;
       static Robot robot;
    
       /**
        * @param args the command line arguments
        */
       public static void main(final String[] args) throws Exception {
           SwingUtilities.invokeLater(new Runnable() {
    
               @Override
               public void run() {
                   try {
                       swingMain(args);
                   } catch (Exception ex) {
                       Logger.getLogger(FileChooserCrash.class.getName()).log(Level.SEVERE, null, ex);
                   }
               }
           });
    
           latch.await();
    
           // do the clicks
           sleep(3000);
           Window w = JDialog.getWindows()[1]; // better be there!
           System.out.println("w="+w);
           int detailsX = w.getX()+w.getWidth()-36;
           int detailY = w.getY()+50;
           System.out.println("details at "+detailsX+", "+detailY);
           robot.mouseMove(detailsX, detailY);
           clickMouse();
           sleep(100);
    
           int headingY = w.getY()+100;
           long now = System.currentTimeMillis();
           while(System.currentTimeMillis() - now < 30*60*100) {
               int headingX = w.getX() + 50 + (int) (Math.random() * 400);
               robot.mouseMove(headingX, headingY);
               clickMouse();
               sleep(100);
           }
       }
    
       private static void sleep(int millis) {
           try {
               Thread.sleep(millis);
           } catch (InterruptedException ex) {}
       }
    
       private static void clickMouse() {
           robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
           sleep(100);
           robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
       }
    
       private static void swingMain(String [] args) throws Exception {
           robot = new Robot();
           frame = new JFrame("JFileChooser Crash Test");
           button = new JButton("Start...");
           button.addActionListener(new ActionListener() {
    
               @Override
               public void actionPerformed(ActionEvent e) {
                   showFileChooser(frame);
               }
           });
           frame.getContentPane().add(button,BorderLayout.CENTER);
           frame.getContentPane().add(new JLabel("Press \"Start...\" and let go of the mouse.  Robot will be used to change FileChooser to details view and then quickly click column headings until the crash."), BorderLayout.SOUTH);
           frame.pack();
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           frame.setVisible(true);
       }
    
       static void showFileChooser(JFrame parent) {
           chooser = new JFileChooser("C:\\");
           latch.countDown();
           chooser.showOpenDialog(parent);
       }
    }
    -----Original Message-----
    From: Sun Microsystems [mailto:IncidentUpdateDaemon@sun.com]
    Sent: April 11, 2012 5:35 PM
    To: Scott Palmer
    Subject: Re: (Incident Review ID: 2226558) Click columns of JFileChooser in details view crashes JVM

    --- Note: you can send us updates about your Incident ---
    --- by replying to this mail. Place new information ---
    --- above these lines. Do not include attachments. ---
    --- Our system ignores attachments and anything below ---
    --- these lines. ---

    Hi Scott Palmer,

    Thank you for this report.

    We need more information to create a new Bug. In addition to the information already given, please provide the following details so that we can reproduce the problem ourselves:

    - Complete source code of an executable test case.
    To focus the investigation on what really matters, please make the
    test as small as possible.
    - Exact steps to run the test case.
    - Expected behavior and actual behavior, including the exact text of
    any output from the test case.
    - Additional configuration information that may be relevant.

    Due to the volume of reports that we receive, I cannot write a test case for each report.


    Thank you for your help.

    Regards,
    Ingrid

    Edited by: swpalmer on Aug 31, 2012 7:47 PM
    (removed speculation that it happened with Java 6)
  • 3. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    Could someone please verify that the above code reproduces the problem for them?
  • 4. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    Well... I have had a few other people try the above code. For some it crashes 30% of the time, for others it doesn't crash. Originally (back when I first reported this issue) for me it would crash 90% of the time.. now it is much more rare. But that is just in the above test app. In our application I still see the crash regularly, usually on the first click of a column heading.
  • 5. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    Changing the sort to be on the File Type column is the trigger. (Should have guessed that from the stack trace)
  • 6. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    This reproduces the problem more reliably for me.
    /*
     * JFileChooser Windows Crash
     */
    package filechoosercrash;
    
    import java.awt.AWTEvent;
    import java.awt.BorderLayout;
    import java.awt.Robot;
    import java.awt.Toolkit;
    import java.awt.Window;
    import java.awt.event.AWTEventListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.InputEvent;
    import java.util.concurrent.CountDownLatch;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.LookAndFeel;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    import javax.swing.UIManager.LookAndFeelInfo;
    import javax.swing.UnsupportedLookAndFeelException;
    
    /**
     *
     * @author scott
     */
    public class FileChooserCrash {
    
         static CountDownLatch latch = new CountDownLatch(1);
         static JFrame frame;
         static JButton button;
         static JFileChooser chooser;
         static Robot robot;
         private static AWTEventListener terminator = new AWTEventListener() {
              @Override
              public void eventDispatched(AWTEvent event) {
                   System.exit(10);
              }
         };
    
         /**
          * @param args the command line arguments
          */
         public static void main(final String[] args) throws Exception {
              SwingUtilities.invokeLater(new Runnable() {
                   @Override
                   public void run() {
                        try {
                             swingMain(args);
                        } catch (Exception ex) {
                             Logger.getLogger(FileChooserCrash.class.getName()).log(Level.SEVERE, null, ex);
                        }
                   }
              });
    
              latch.await();
    
              // do the clicks
              sleep(3000);
    
              Toolkit.getDefaultToolkit().addAWTEventListener(terminator, AWTEvent.KEY_EVENT_MASK);
              long now = System.currentTimeMillis();
              for (int c = 0; c < 10; c++) {
                   Window w = JDialog.getWindows()[1]; // better be there!
                   System.out.println("w=" + w);
                   int detailsX = w.getX() + w.getWidth() - 36;
                   int detailY = w.getY() + 50;
                   int headingY = w.getY() + 100;
                   System.out.println("details at " + detailsX + ", " + detailY);
    
                   // Click details
                   robot.mouseMove(detailsX, detailY);
                   clickMouse();
                   sleep(100);
    
                   // Click column headings
                   while (System.currentTimeMillis() - now < 2 * 1000) {
                        int headingX = w.getX() + (w.getWidth()/2) + (int) (Math.random() * (w.getWidth()/2));
                        robot.mouseMove(headingX, headingY);
                        clickMouse();
                        sleep(300);
                   }
    
                   // Cancel
                   robot.mouseMove(w.getX() + w.getWidth() - 36, w.getY() + w.getHeight() - 36);
                   clickMouse();
                   sleep(300);
    
                   // re-open
                   robot.mouseMove(frame.getX() + 36, frame.getY() + 36);
                   clickMouse();
                   sleep(1000);
                   now = System.currentTimeMillis();
              }
         }
    
         private static void sleep(int millis) {
              try {
                   Thread.sleep(millis);
              } catch (InterruptedException ex) {
              }
         }
    
         private static void clickMouse() {
              robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
              sleep(100);
              robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
         }
    
         private static void swingMain(String[] args) throws Exception {
              //switchToNimbus();
    
              robot = new Robot();
              frame = new JFrame("JFileChooser Crash Test");
              button = new JButton("Start...");
              button.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        showFileChooser(frame);
                   }
              });
              frame.getContentPane().add(button, BorderLayout.CENTER);
              frame.getContentPane().add(new JLabel("Press \"Start...\" and let go of the mouse.  Robot will be used to change FileChooser to details view and then quickly click column headings until the crash."), BorderLayout.SOUTH);
              frame.pack();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
         }
    
         static void showFileChooser(JFrame parent) {
              chooser = new JFileChooser("C:\\");
              latch.countDown();
              chooser.showOpenDialog(parent);
         }
    
         private static void switchToNimbus() throws UnsupportedLookAndFeelException, IllegalAccessException, InstantiationException, ClassNotFoundException {
              for (LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
                   if (laf.getName().startsWith("Nimbus")) {
                        System.out.println("Using " + laf.getName());
                        UIManager.setLookAndFeel(laf.getClassName());
                        break;
                   }
              }
         }
    }
  • 7. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    Well I see this was as helpful as the original bug report... I provide code to reproduce a native JVM crash in all versions of Java 7 on Windows with nothing more than an open file dialog and still nothing from Oracle.
    This is crashing shipping apps on Windows when user do nothing more than try to save their work... You would think it would be given a little attention.
  • 8. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    919566 Newbie
    Currently Being Moderated
    Hi Scott,

    The test case is now included as part of the bug report (updated report should be visible on bugs.sun.com at http://bugs.sun.com/view_bug.do?bug_id=7177373 in a day or two)

    Regards,
    Nelson

    Edited by: 916563 on Sep 6, 2012 6:51 AM
  • 9. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    Thanks,

    Have you tried it? I would like to know that someone outside my company has successfully reproduced the problem.
  • 10. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    The wrong test case was attached to the bug. The first case posted seems to be attached, but the second case reproduce the issue much more reliably.

    Still nobody can confirm they are able to reproduce this?
  • 11. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    970834 Newbie
    Currently Being Moderated
    Hi,

    I have the same issue: JFileChooser crashing when clicking on column headers (to sort column).
    I'm running Windows 7 - 64b.
    Error occured mostly when the directory is largely populated.

    My crash-dump looks similar, but slightly different:
    ...
    Stack: [0x1e890000,0x1e8e0000], sp=0x1e8de610, free space=313k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C 0x0007b384
    C [SHELL32.dll+0x8ec5b] SHGetSpecialFolderLocation+0xafa
    C [SHELL32.dll+0x8ebf6] SHGetSpecialFolderLocation+0xa95
    C [awt.dll+0xae96e] Java_sun_awt_shell_Win32ShellFolder2_compareIDsByColumn+0x1a
    J sun.awt.shell.Win32ShellFolder2$ColumnComparator$1.call()Ljava/lang/Integer;
    j sun.swing.FilePane$DirectoriesFirstComparatorWrapper.compare(Ljava/lang/Object;Ljava/lang/Object;)I+9
    j javax.swing.DefaultRowSorter.compare(II)I+152
    j javax.swing.DefaultRowSorter.access$100(Ljavax/swing/DefaultRowSorter;II)I+3
    j javax.swing.DefaultRowSorter$Row.compareTo(Ljavax/swing/DefaultRowSorter$Row;)I+12
    j javax.swing.DefaultRowSorter$Row.compareTo(Ljava/lang/Object;)I+5
    J java.util.ComparableTimSort.countRunAndMakeAscending([Ljava/lang/Object;II)I
    ...

    I noticed that bug report #7177373 is no longer available.
    Is this issue been resolved?

    kr.
  • 12. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    gimbal2 Guru
    Currently Being Moderated
    Its still there, you just need to go to bugs.sun.com and input the bug ID (7177373) yourself.

    Looks like the bug is still under review and has been given a really low priority.
  • 13. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    swpalmer Newbie
    Currently Being Moderated
    Why is the priority of this so low?

    This is critical for desktop applications to adopt Java 7.

    Attempt to load a document or save your work, and then the application disappears... not a good user experience.

    I can see from the bug comments that it has been reproduced with JDK 7 and 8.

    I'm a little ticked that the bug system is closed now so it can't be voted for and the original issue (that had a few vtes) is no-longer accessible.
  • 14. Re: JFileChooser crashes JVM - bug basically ignored. What can I do?
    gimbal2 Guru
    Currently Being Moderated
    swpalmer wrote:
    Why is the priority of this so low?
    Because "they" don't find it important? Its not very productive to ask such open ended questions in a user to user forum, plus the answer doesn't help you in any way.
    This is critical for desktop applications to adopt Java 7.
    But Java isn't really used for desktop applications on a large scale. Its more of a server language, and for embedded environments. Hence a low priority is not too hard to imagine, especially because its Swing which isn't used by the cool kids anymore. Its all JavaFX 2 now baby, you should join the party.
    I'm a little ticked that the bug system is closed now so it can't be voted for and the original issue (that had a few vtes) is no-longer accessible.
    We are at the mercy of our hosts. Hopefully soon a public jira will appear for OpenJDK, that would be really grand. The bug parade has run its course and there are far better alternatives out there today. In the mean time there are also the OpenJDK mailing lists.
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points