Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4847375
Votes 17
Synopsis JFileChooser Create New Folder button is disabled incorrectly
Category java:classes_swing
Reported Against b42 , 1.4.1 , 1.4.2 , tiger-rc
Release Fixed 7(b20)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6293350 , 4522927 , 4946237 , 5053691 , 4939819
Submit Date 11-APR-2003
Description


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

FULL OS VERSION :
 customer  Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When using the JFileChooser, the 'Create New Folder' button is disabled when the user has navigated to:

1) The root of any drive
2) The user's 'My Documents' folder.
3) The Desktop

In all of these cases, the creation of a new folder should be allowed as it is in any other Windows application.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JFileChooser
2. Navigate to the root of a drive.


EXPECTED VERSUS ACTUAL BEHAVIOR :
The 'Create New Folder' button should be enabled.
The 'Create New Folder' button is disabled.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(parent);
---------- END SOURCE ----------
(Review ID: 182806) 
======================================================================
Posted Date : 2005-11-08 00:52:18.0
Work Around
N/A
Evaluation
This bug is caused by java.io bug 4939819, and depends on it being fixed.
Note: This bug should not be closed as a duplicate of that bug until after
verifying that it works as expected.

  xxxxx@xxxxx   2004-11-11 21:21:40 GMT
Comments
  
  Include a link with my name & email   

Submitted On 22-MAY-2003
alfredojahn
Looks 1.4.2 fixes 2 of the 3... The create new folder icon
is still disabled when you navigate to "My Documents"
folder. Is this going to be fixed in the final release? 


Submitted On 28-FEB-2004
Hitoshi@Tanabe
'New Folder' cannot create to 'My Music' and 'My Picture' 
and other Folder on WindowsXP(Japanese OS)


Submitted On 18-OCT-2004
robinr
This bug is really annoying. 

I can work around it since I'm writing new code that needs the create directory function.  Using WXP SP2 swedish, JRE1.4.2_06


Submitted On 03-NOV-2004
Plasticbiker
My Documents part of this bug STILL exists in jdk1.5


Submitted On 22-SEP-2006
Here is my workaround:


	public static void main(String args[]) {

		....

		// A litte fix for WinXP
		if (System.getProperty("os.name").equals("Windows XP"))
			fixMyDocumentsRights();

		....
	}

	/**
	 * Fixes the fact that you can't create a folder in My Documents with
	 * JFileChooser unless a bit has been unset. This bit doesn't seem to affect
	 * Windows applications.
	 */
	public static void fixMyDocumentsRights() {
		try {
			Runtime.getRuntime().exec("attrib -r \"%USERPROFILE%/My Documents\"");
		} catch (IOException e) {
			log.warn(e.getMessage());
		}
	}


Submitted On 30-JAN-2007
Dr_Hok
This bug persists in JDK1.6.0 (with My Documents, My Music, My Pictures and Desktop; drive roots are not affected).

The workaround ("attrib -r ...") doesn't work if My Documents is redirected to a network share.


Submitted On 14-JAN-2008
And 1 year later, with the release of JDK1.6.0_04 is still there :(


Submitted On 05-AUG-2008
carcour
Can the fix be backported to Java 6 as it's an important bug.

Thanks,

Carl Antaki


Submitted On 15-DEC-2008
There is a similar fix suggested in this thread, but it has a minor flaw.
Try the below one instead, it works, (i have tested this)
try {
			Runtime.getRuntime().exec("attrib -r "%USERPROFILE%\My Documents"");
		} catch (IOException e) {
			log.warn(e.getMessage());
		}

Or if you want to suggest a workaround for the customers who already have this bug. Ask them to run the below command in a command prompt window
attrib -r "%USERPROFILE%\My Documents"

This is a one time requirement, it is sufficient if they run this once on the machine that faces this bug.



PLEASE NOTE: JDK6 is formerly known as Project Mustang