JDK-6351074 : JFileChooser removes leading space in filename
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0,1.4.1,5.0,5.0u5,6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS:
    linux,solaris_8,windows_98,windows_xp linux,solaris_8,windows_98,windows_xp
  • CPU: x86,sparc
  • Submitted: 2005-11-16
  • Updated: 2016-05-11
  • Resolved: 2011-05-18
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.
JDK 7
7 b38Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
JFileChooser removes leading space in the name of file selected by user. It means that such files cannot be selected by JFileChooser. Attaching simple project that demonstrates the problem (type 'ant run' in project directory and the select file ' anything' in the filechooser).

Comments
EVALUATION We should replace trimming name of file by removing whitespaces from end of filename
27-08-2008

EVALUATION After I studied the issue closely, I decided to re-open this bug. Actually, this bug does exist on either 1.4 or 1.5, not only on 1.5u6, and can be observed if only the single file started with space is selected. This code needs to be revised (BasicFileChooserUI.java, lines 791-794): if (filename != null) { // Remove whitespace from beginning and end of filename filename = filename.trim(); }
22-11-2005

EVALUATION Cannot reproduce it on both 1.4.1 and 1.5.0. The attached test works fine, the file named ' anything' can be selected via JFileChooser. The bug initiator didn't specify the JDK version, probably he used an older one.
21-11-2005