JDK-4923243 : Space chars at end of directory name confuses java.io.File.list()Shou
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2003-09-16
  • Updated: 2017-11-13
  • Resolved: 2004-02-20
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
5.0 b40Fixed
Related Reports
Relates :  
Relates :  
Description
On Windows, if you give a directory name with space-chars at the end
(like "C:\foo\ ") to java.io.File then

isDirectory() will return true, but the list() method
will return null even if there are files in the directory:

This breaks the contract between isDirectory()
and list(), which is if isDirectory() returns true then
list() must not return null. This situation arises from
bug 4849568.

Comments
SUGGESTED FIX 2c2 < * @(#)WinNTFileSystem_md.c 1.14 03/08/25 --- > * %W% %E% 338a339,345 > /* remove trailing space chars from directory name */ > len = wcslen (search_path); > while (search_path[len-1] == ' ') { > len --; > } > search_path [len] = 0; > This works on Windows 2000. Didn't test on any other version
03-09-2004

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b40 tiger-beta2
03-09-2004

EVALUATION Should make an effort to find resources to fix this in tiger. ###@###.### 2003-11-18
18-11-2003