-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
5.0
-
None
-
generic
-
generic
run the following test program:
import javax.swing.*;
import java.io.*;
class test {
public static void main(String[] args) {
JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
jfc.setDialogType(JFileChooser.SAVE_DIALOG);
jfc.setMultiSelectionEnabled(false);
int result = jfc.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION)
{
File f = jfc.getSelectedFile();
System.out.println("f: " + f);
if (f == null) return;
}
}
}
When the jfilechoose pops up, enter a filename which does not exist in your file system. hit save.
On tiger b33, getSelectedFile will return the entered filename correctly.
On tiger b35, getSelectedFile will return null.
I tried on both winXP and solaris.
Also, I got null pointer exception sometimes too when I run the test program on my solaris box:
capoon [scratch]% /net/koori.sfbay/p/jdk06/jdk/1.5.0/beta2/b35/binaries/solaris-sparc/bin/java test
Exception in thread "main" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1116)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1059)
at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:331)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1542)
at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
at java.awt.Container.layout(Container.java:1398)
at java.awt.Container.doLayout(Container.java:1388)
at java.awt.Container.validateTree(Container.java:1470)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validate(Container.java:1445)
at java.awt.Window.pack(Window.java:487)
at javax.swing.JFileChooser.createDialog(JFileChooser.java:772)
at javax.swing.JFileChooser.showDialog(JFileChooser.java:708)
at javax.swing.JFileChooser.showSaveDialog(JFileChooser.java:645)
at test.main(test.java:9)
import javax.swing.*;
import java.io.*;
class test {
public static void main(String[] args) {
JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
jfc.setDialogType(JFileChooser.SAVE_DIALOG);
jfc.setMultiSelectionEnabled(false);
int result = jfc.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION)
{
File f = jfc.getSelectedFile();
System.out.println("f: " + f);
if (f == null) return;
}
}
}
When the jfilechoose pops up, enter a filename which does not exist in your file system. hit save.
On tiger b33, getSelectedFile will return the entered filename correctly.
On tiger b35, getSelectedFile will return null.
I tried on both winXP and solaris.
Also, I got null pointer exception sometimes too when I run the test program on my solaris box:
capoon [scratch]% /net/koori.sfbay/p/jdk06/jdk/1.5.0/beta2/b35/binaries/solaris-sparc/bin/java test
Exception in thread "main" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1116)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1059)
at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:331)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1542)
at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
at java.awt.Container.layout(Container.java:1398)
at java.awt.Container.doLayout(Container.java:1388)
at java.awt.Container.validateTree(Container.java:1470)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validateTree(Container.java:1477)
at java.awt.Container.validate(Container.java:1445)
at java.awt.Window.pack(Window.java:487)
at javax.swing.JFileChooser.createDialog(JFileChooser.java:772)
at javax.swing.JFileChooser.showDialog(JFileChooser.java:708)
at javax.swing.JFileChooser.showSaveDialog(JFileChooser.java:645)
at test.main(test.java:9)
- duplicates
-
JDK-4980406 PIT: JFileChooser hangs when navigating through the sub dirs
- Closed