United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4723745 : 1.4 REGRESSION: Metal & Windows FileChooserUI classes cannot be used without She

Details
Type:
Enhancement
Submit Date:
2002-07-31
Status:
Resolved
Updated Date:
2003-11-11
Project Name:
JDK
Resolved Date:
2003-09-05
Component:
client-libs
OS:
windows_nt,linux,windows_2000
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0,1.4.2
Fixed Versions:
1.4.2_04 (04)

Related Reports
Backport:
Duplicate:
Duplicate:
Relates:
Relates:

Sub Tasks

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



Hardware and Software, Engineered to Work Together