JDK-4639610 : REGRESSION: new File(java.net.URL.getFile()) failed when directory has spaces
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-02-19
  • Updated: 2002-02-19
  • Resolved: 2002-02-19
Related Reports
Duplicate :  
Description

Name: gm110360			Date: 02/19/2002


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

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
Inconsistancy problem (when upgarding from 1.3 to 1.4)

When using URL.getFile() of directory with white spaces the
white spaces becomes %20

When creaing new File with %20 the file generation fails

I.E new File(Class.getResource("").getFile).exists()
return false if Class path have whith spaces.

This problem occures in j2sdk1.4 but doesn't occur in
j2sdk1.3

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.create class A.class put it in directory
c:\directoy a\class (directory with white space)
2.in another class execute
 new File(A.class.getResource("").getFile).exists();
3.this will return false; Although the directory exists.

EXPECTED VERSUS ACTUAL BEHAVIOR :
new File(A.class.getResource("resource/").getFile).exists();
should return true, as it used to in 1.3.1

but in 1.4.0 it returns false.

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
new File(MyClass.class.getResource("resource/").getFile()).exists()
---------- END SOURCE ----------

Release Regression From : 1.3.1
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 139823) 
======================================================================

Comments
EVALUATION Duplicate 4466485. -- iag@sfbay 2002-02-19
19-02-2002