JDK-4723745 : 1.4 REGRESSION: Metal & Windows FileChooserUI classes cannot be used without She
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows_nt,windows_2000
  • CPU: x86
  • Submitted: 2002-07-31
  • Updated: 2017-05-16
  • Resolved: 2003-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2_04 04Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
Name: jk109818			Date: 07/31/2002


FULL PRODUCT VERSION :
build 1.4.0-b92

FULL OPERATING SYSTEM VERSION :
Linux all versions

ADDITIONAL OPERATING SYSTEMS :
Windows all versions



A DESCRIPTION OF THE PROBLEM :
The MetalFileChooserUI and the WindowsFileChooserUI
have a dependence on the class sun.awt.shell.ShellFolder.
This was introduced in the 1.4 release.

This makes it very hard to extend these classes.
I suggest the following changes:

A new public method setShellUse(boolean state)
this should set the private useShell variable.

In line 1661 of the MetalFileChooserUI and
File sf = ShellFolder.getShellFolder(canonical)
this should only occur when useShell is true otherwise
sf = canonical.
Currently exceptions are being thrown and silently caught
at line 1683 causing the directory combo box not to update.

This also applies to line 1863 of the WindowsFileChooserUI.


REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
An example of where/why you might want to do someting like
this exist as part of the Apache Slide open-source project

src/contrib/webdavgui - the SPFileChooser and
SPMetalFileChooserUI classes, it's basically a filechooser
that lets you browse WebDav resources

EXPECTED VERSUS ACTUAL BEHAVIOR :
The directory combo-box should update when a new directory
has been entered or exited - this is not occuring.

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
see above
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Metal/Windows FileChooserUI classes:

public void setShellUse(boolean state) {
    useShell = state;
}

line 1863 in WindowsUI and 1661 in MetalUI
File sf;
if (useShell)
   sf = ShellFolder.getShellFolder(canonical);
else
    sf = canonical;
(Review ID: 145565) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.2_04 tiger FIXED IN: 1.4.2_04 tiger INTEGRATED IN: 1.4.2_04 tiger tiger-b19
2004-06-14

EVALUATION This needs to be fixed for anm upcoming release. I have changed the category from rfe to bug. ###@###.### 2002-07-31 The use of ShellFolder.createShellFolder() now only happens if the private variable useShellFolder is true. A new client property on JFileChooser, "FileChooser.useShellFolder", can now be set to force this behavior on or off. ###@###.### 2003-08-29
2003-08-29

WORK AROUND I suppose a drastic workaround could be to use reflection to patch in a custom ShellFolderManager in the ShellFolder class. ###@###.### 2002-07-31 The ShellFolder classes are package private, so they can't be extended. The only workaround available seems to be to override createDirectoryComboBoxModel() and provide a modified class that doesn't use ShellFolder. ###@###.### 2003-08-21
2003-08-21