I have a swing application that is using JFileChooser. When I click the Open menu item from File menu it should show the File dialog box where user can select the file.
This application is running in my machine but encounters problem in another machine. File dialog box is not showing and stack trace shows that NullPointerException is thrown by JFileChooser
My machine is a 64 bit Windows 7 while the other machine is Windows 7 32 bit. Both machine are using java 1.6
To verify if its because of the 32-bit, I tried in another Windows 7 32-bit and the same application is working.
I came across this article https://bugs.openjdk.java.net/browse/JDK-4711700 which identified it as bug but already fix in 1.4.2_04. Though I am using 1.6, just to make sure I also tried the suggested work around
I put System.setProperty("swing.disableFileChooserSpeedFix", "true"); in my code but still not working
I also tried to add java -Dswing.disableFileChooserSpeedFix=true to the batch file that is launching the application and still not working
Any other suggestions or idea on this? Thanks
Below is the stack trace
ERROR actions.menu.File_Open - Error occured while opening an existing timetable. null
caused by null java.lang.NullPointerException
Writing return null; is asking for trouble.
You have a method with a boolean return (why are you writing Boolean?) so users will expect it to tell them whether it opened the file or not. Users will expect to get true or false and to be able to use that value straight off without having to check for nulls.
Of course, as Joanne says, the method you are actually using may be different.