-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional, Version 2002, Service Pack 2
A DESCRIPTION OF THE PROBLEM :
InternalError is thrown when calling setCurrentDirectory of JFileChooser on a non directory file which is defined as Directory file.
When the File is both a non directory file and considered as Directory then an Internal Error is thrown by JFileChooser. The exception can occur in a case where a customize file chooser let the users to navigate and load files from inside a ZIP or JAR file archive. The JDK versions of 1.6.0_02 or below does not throw this exception.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a jar on the test system.
Change the source code File "C:\\test\\test.jar" to use any jar file on the test system.
Run code. and Press "View File Chooser" button.
Observe error.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The jar file specified should be selected as a default directory. Run the same code with JDK version 1.6.0_02 or any 1.5.0 JDK or below and see the expected result.
ACTUAL -
java.lang.InternalError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.InternalError: Unable to bind C:\test\test.jar to parent
at sun.awt.shell.Win32ShellFolder2$4.call(Win32ShellFolder2.java:400)
at sun.awt.shell.Win32ShellFolder2$4.call(Win32ShellFolder2.java:385)
at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Win32ShellFolderManager2.java:491)
at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Win32ShellFolder2.java:384)
at sun.awt.shell.Win32ShellFolder2$18.call(Win32ShellFolder2.java:1091)
at sun.awt.shell.Win32ShellFolder2$18.call(Win32ShellFolder2.java:1089)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:458)
at java.lang.Thread.run(Thread.java:619)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class Test {
public static void main(String[] args) {
final JFrame mainFrame = new JFrame();
mainFrame.getContentPane().setLayout(new BorderLayout());
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setMinimumSize(new Dimension(100, 100));
JButton view = new JButton("View File Chooser");
mainFrame.add(view,BorderLayout.NORTH);
view.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
File file = new File ("C:\\test\\test.jar"){
public boolean isDirectory(){
return true;
}
};
JFileChooser filechooser = new JFileChooser();
filechooser.setCurrentDirectory(file);
filechooser.showOpenDialog(mainFrame);
}
});
mainFrame.setVisible(true);
}
}
---------- END SOURCE ----------
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional, Version 2002, Service Pack 2
A DESCRIPTION OF THE PROBLEM :
InternalError is thrown when calling setCurrentDirectory of JFileChooser on a non directory file which is defined as Directory file.
When the File is both a non directory file and considered as Directory then an Internal Error is thrown by JFileChooser. The exception can occur in a case where a customize file chooser let the users to navigate and load files from inside a ZIP or JAR file archive. The JDK versions of 1.6.0_02 or below does not throw this exception.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a jar on the test system.
Change the source code File "C:\\test\\test.jar" to use any jar file on the test system.
Run code. and Press "View File Chooser" button.
Observe error.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The jar file specified should be selected as a default directory. Run the same code with JDK version 1.6.0_02 or any 1.5.0 JDK or below and see the expected result.
ACTUAL -
java.lang.InternalError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.InternalError: Unable to bind C:\test\test.jar to parent
at sun.awt.shell.Win32ShellFolder2$4.call(Win32ShellFolder2.java:400)
at sun.awt.shell.Win32ShellFolder2$4.call(Win32ShellFolder2.java:385)
at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Win32ShellFolderManager2.java:491)
at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Win32ShellFolder2.java:384)
at sun.awt.shell.Win32ShellFolder2$18.call(Win32ShellFolder2.java:1091)
at sun.awt.shell.Win32ShellFolder2$18.call(Win32ShellFolder2.java:1089)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:458)
at java.lang.Thread.run(Thread.java:619)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class Test {
public static void main(String[] args) {
final JFrame mainFrame = new JFrame();
mainFrame.getContentPane().setLayout(new BorderLayout());
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setMinimumSize(new Dimension(100, 100));
JButton view = new JButton("View File Chooser");
mainFrame.add(view,BorderLayout.NORTH);
view.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
File file = new File ("C:\\test\\test.jar"){
public boolean isDirectory(){
return true;
}
};
JFileChooser filechooser = new JFileChooser();
filechooser.setCurrentDirectory(file);
filechooser.showOpenDialog(mainFrame);
}
});
mainFrame.setVisible(true);
}
}
---------- END SOURCE ----------