2

Non-reproducable crash (no error/exception). Happens when I run a dialog to select a folder only 1 out of 10 times. Code:

public String getFilePathFromDialog(String dialogTitle) {
    JFileChooser fileChooser;
    fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(dialogTitle);
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fileChooser.setAcceptAllFileFilterUsed(true);
    if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        return fileChooser.getSelectedFile().toString();
    } else {
        return "";
    }
}

It crashes my application. After this I can only close it with: Ctrl+Alt+Delete -> Task Manager -> Kill it -> Then I get "Java(TM) Platform SE binary is not responding" and I hit Close button

Am I doing something wrong or is it a bug?

I found the crash dump file as Peter mentioned below. Here is some of it:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x62a5ff52, pid=5516, tid=5312
#
# Problematic frame:
# C  [nvd3dum.dll+0x2fff52]
#
Current thread (0x04323400):  JavaThread "AWT-Windows" daemon [_thread_in_native, id=5312, stack(0x04d60000,0x04db0000)]
siginfo: ExceptionCode=0xc0000005, writing address 0x04ee9004
Kai
  • 38,985
  • 14
  • 88
  • 103
Stefanos Kargas
  • 10,547
  • 22
  • 76
  • 101
  • If it is crashing you should get a crash dump in the default working directory of your application. See this link for more details http://stackoverflow.com/questions/1880166/is-it-possible-to-specify-where-jvms-crash-dumps-go Are you using Java 6 update 23? – Peter Lawrey Dec 17 '10 at 11:10
  • 1
    Do you maybe have network drives mapped on that computer? Java might try to read from those network drives to list them in the dialog. When the network is for some reason slow or temprarily unreachable, that might make your program seem to hang for a while. – Jesper Dec 17 '10 at 12:00
  • I do have many network drives. Maybe it has to do with this. But it doesn't slow down, instead it totally crashes. Either it starts immediatelly or it crashes forever. Thanks anyway. Good point. I set the Desktop as CurrentDirectory (Default directory to start the dialog) and I think it doesn't do it anymore. So your comment was useful. – Stefanos Kargas Dec 17 '10 at 13:24
  • Peter, I am using: NetBeans 6.8, Java 1.6.0_17. I found the crash dump file and I added it in my question – Stefanos Kargas Dec 17 '10 at 13:41

3 Answers3

2
# Problematic frame:
# C  [nvd3dum.dll+0x2fff52]

That'll be your NVidia video driver?

Note this is not on the AWT EDT thread, but an internal system thread. You might try disabling Direct Draw 3D (there is some system property for doing that).

Tom Hawtin - tackline
  • 145,806
  • 30
  • 211
  • 305
  • I googled the specific dll + "Java error" and they say in the forums that it is a bug that is solved in 1.6.0_21. I'll update and hope it never shows up again. – Stefanos Kargas Dec 23 '10 at 11:21
2

I've seen something like this on Windows when the JVM was running very close the maximum memory allocated allocated to it by the OS. The user then opens a dialog, possibly on a network drive, this loads some additional OS resources (perhaps DLLs), and then the JVM runs out of memory (not heap but memory allocated to the JVM itself) and then crashes.

Steve Kuo
  • 61,876
  • 75
  • 195
  • 257
1

Make sure that the code is invoked on EDT.

Also, just an observation (nothing to do with the crash), it is better to declare variable fileChooser and assign it in the same statement (immutability):

final JFileChooser fileChooser = new JFileChooser();
01es
  • 5,362
  • 1
  • 31
  • 40