-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b116
-
generic
-
generic
-
Verified
Platform: all
JDK: 6, 7
The following code sets minimal Basic L&F descendant and then tries to instantiate JFileChooser.
As the result NPE is thrown and some info is printed to System.err
-------------------------------------------------------------------
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class FileChooserTest {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(new BasicLookAndFeel() {
@Override public String getName() { return "A name"; }
@Override public String getID() { return "An id"; }
@Override public String getDescription() { return "A description"; }
@Override public boolean isNativeLookAndFeel() { return false; }
@Override public boolean isSupportedLookAndFeel() { return true; }
});
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
new JFileChooser();
}
});
}
}
-------------------------------------------------------------------
For JDK7b103 output is the following
java.lang.NullPointerException
at javax.swing.JFileChooser.updateUI(JFileChooser.java:1794)
at javax.swing.JFileChooser.setup(JFileChooser.java:374)
at javax.swing.JFileChooser.<init>(JFileChooser.java:347)
at javax.swing.JFileChooser.<init>(JFileChooser.java:300)
at FileChooserTest$1.run(FileChooserTest.java:20)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JFileChooser[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,approveButtonText=,currentDirectory=,dialogTitle=,dialogType=OPEN_DIALOG,fileSelectionMode=FILES_ONLY,returnValue=ERROR_OPTION,selectedFile=,useFileHiding=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:130)
at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
at javax.swing.UIManager.getUI(UIManager.java:1002)
at javax.swing.JFileChooser.updateUI(JFileChooser.java:1787)
at javax.swing.JFileChooser.setup(JFileChooser.java:374)
at javax.swing.JFileChooser.<init>(JFileChooser.java:347)
at javax.swing.JFileChooser.<init>(JFileChooser.java:300)
at FileChooserTest$1.run(FileChooserTest.java:20)
JCK tests fail because of this problem
JDK: 6, 7
The following code sets minimal Basic L&F descendant and then tries to instantiate JFileChooser.
As the result NPE is thrown and some info is printed to System.err
-------------------------------------------------------------------
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class FileChooserTest {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(new BasicLookAndFeel() {
@Override public String getName() { return "A name"; }
@Override public String getID() { return "An id"; }
@Override public String getDescription() { return "A description"; }
@Override public boolean isNativeLookAndFeel() { return false; }
@Override public boolean isSupportedLookAndFeel() { return true; }
});
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
new JFileChooser();
}
});
}
}
-------------------------------------------------------------------
For JDK7b103 output is the following
java.lang.NullPointerException
at javax.swing.JFileChooser.updateUI(JFileChooser.java:1794)
at javax.swing.JFileChooser.setup(JFileChooser.java:374)
at javax.swing.JFileChooser.<init>(JFileChooser.java:347)
at javax.swing.JFileChooser.<init>(JFileChooser.java:300)
at FileChooserTest$1.run(FileChooserTest.java:20)
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JFileChooser[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,approveButtonText=,currentDirectory=,dialogTitle=,dialogType=OPEN_DIALOG,fileSelectionMode=FILES_ONLY,returnValue=ERROR_OPTION,selectedFile=,useFileHiding=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:728)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:130)
at javax.swing.UIDefaults.getUI(UIDefaults.java:758)
at javax.swing.UIManager.getUI(UIManager.java:1002)
at javax.swing.JFileChooser.updateUI(JFileChooser.java:1787)
at javax.swing.JFileChooser.setup(JFileChooser.java:374)
at javax.swing.JFileChooser.<init>(JFileChooser.java:347)
at javax.swing.JFileChooser.<init>(JFileChooser.java:300)
at FileChooserTest$1.run(FileChooserTest.java:20)
JCK tests fail because of this problem