JDK-4879395 : JFileChooser causes "Could not bind shell folder to interface" error
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2003-06-16
  • Updated: 2006-03-09
  • Resolved: 2006-03-09
Description
Name: jk109818			Date: 06/16/2003


FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

FULL OS VERSION :
Windows NT Version 4.0

A DESCRIPTION OF THE PROBLEM :
If the system policy prevents a user from accessing network neighbourhood any program that attempts to create a JFileChooser object will fail with the error -

Caused by: java.lang.InternalError: Could not bind shell folder to interface
        at sun.awt.shell.Win32ShellFolder2.initSpecial(Native Method)
        at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.getNetwork(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.compareShellFolders(Unknown So
urce)
        at sun.awt.shell.Win32ShellFolder2.compareTo(Unknown Source)
        at sun.awt.shell.ShellFolder.compareTo(Unknown Source)
        at java.util.Arrays.mergeSort(Unknown Source)
        at java.util.Arrays.mergeSort(Unknown Source)
        at java.util.Arrays.sort(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
        at sun.awt.shell.ShellFolder.get(Unknown Source)
        at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponent
s(Unknown Source)
        at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
        at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknow
n Source)
        at javax.swing.JComponent.setUI(Unknown Source)
        at javax.swing.JFileChooser.updateUI(Unknown Source)
        at javax.swing.JFileChooser.setup(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set the policy for a user to prevent them from accessing the network neighbourhood.  This will set the NoNetHood value under the following registry key to 1 -

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

With this value set to one run any java program that creates a JFileChooser.  It should fail with the above error.  Setting the value of the registry key to 0 will allow the JFileChooser to operate correctly.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The file chooser should open normally
ACTUAL -
The file chooser failed with the "Could not bind shell folder to interface"

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Caused by: java.lang.InternalError: Could not bind shell folder to interface
        at sun.awt.shell.Win32ShellFolder2.initSpecial(Native Method)
        at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.getNetwork(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.compareShellFolders(Unknown So
urce)
        at sun.awt.shell.Win32ShellFolder2.compareTo(Unknown Source)
        at sun.awt.shell.ShellFolder.compareTo(Unknown Source)
        at java.util.Arrays.mergeSort(Unknown Source)
        at java.util.Arrays.mergeSort(Unknown Source)
        at java.util.Arrays.sort(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
        at sun.awt.shell.ShellFolder.get(Unknown Source)
        at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponent
s(Unknown Source)
        at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
        at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknow
n Source)
        at javax.swing.JComponent.setUI(Unknown Source)
        at javax.swing.JFileChooser.updateUI(Unknown Source)
        at javax.swing.JFileChooser.setup(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)
        at javax.swing.JFileChooser.<init>(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.JFileChooser;
public class TestFileChooser
{
	public static void main(String args[])
	{
		JFileChooser fc = new JFileChooser();
		fc.showOpenDialog(null);
	}
}

---------- END SOURCE ----------
(Review ID: 188185) 
======================================================================

Comments
EVALUATION Closed as NT 4.0 is not supported since Java 1.5.0
09-03-2006

EVALUATION Reproducible as described on NT4.0 (see Comments). I don't know how to go about reproducing this on Win2k or above. I believe this happens in the code added for 4712307. The bug doesn't happen when running w/ swing.disableFileChooserSpeedFix. ###@###.### 2003-06-16 The workaround for this bug avoids the problem, but slows down network access. It's only valid for 1.4.2 however, and since NT is no longer a supported platform for 1.5.0, it is unlikely that this bug will be fixed. *Note* Please report any occurences of this bug on Windows platforms other than NT when running with 1.5 beta or later. Thanks. ###@###.### 2004-04-21
21-04-2004

WORK AROUND Running w/ the runtime flag "-Dswing.disableFileChooserSpeedFix=true" avoids the problem. ###@###.### 2003-06-16 This workaround is for 1.4.2 only. ###@###.### 2004-04-21
16-06-2003