This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 50987

Summary: ant/project tests failing due to space in path
Product: projects Reporter: Jan Chalupa <jchalupa>
Component: AntAssignee: Jesse Glick <jglick>
Status: CLOSED FIXED    
Severity: blocker CC: dkonecny
Priority: P3 Keywords: SPACE_IN_PATH, TEST
Version: 4.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: Patch

Description Jan Chalupa 2004-10-29 22:57:12 UTC
[custom build of 20041029 sources; JDK 1.4.2_04]

I have the complete NB source tree checked out 
in a directory with spaces in path:

C:\Documents and Settings\honza\sources

When running commit validation suite on this 
source tree, four unit tests from 
ant/project:EditablePropertiesTest are failing 
(2 fails, 2 errors). The failure message is

junit.framework.AssertionFailedError: exception 
in assertFile : C:\Documents%20and%
20Settings\honza\sources\nb_all\xtest\instance\wo
rk\sys\tests\unit\src\org\netbeans\spi\project\su
pport\ant\data\test.properties (The system 
cannot find the path specified)

The problem seems to be the URI.toPath() call in 
the filenameOfTestProperties method which 
returns spaces escaped as '%20'. The assertFile 
method in the NB junit extension cannot open 
files with escaped chars in names.

I'll attach a patch shortly.
Comment 1 Jan Chalupa 2004-10-29 23:02:26 UTC
Created attachment 18615 [details]
Patch
Comment 2 Jan Chalupa 2004-10-29 23:04:05 UTC
Should read "... problem seems to be the URL.toPath() call..."
Comment 3 Jesse Glick 2004-10-29 23:47:43 UTC
The patch is not correct but it is simple to write one that is.

*Never* extract the filename from a 'file' scheme URI using getPath
(even if you .replace('/', File.separatorChar), which this patch did
not). Always use new File(uri) which is designed for this purpose and
may have additional specialized behavior which is intentionally not
documented by the Java platform.
Comment 4 Jesse Glick 2004-10-29 23:54:04 UTC
committed     Up-To-Date  1.9        
ant/project/test/unit/src/org/netbeans/spi/project/support/ant/EditablePropertiesTest.java
Comment 5 Marian Mirilovic 2005-12-20 15:46:09 UTC
This issue was solved long time ago. Because nobody has reopened it neither
added comments, we are verifying/closing it now. 
If you are still able to reproduce the problem, please reopen. Thanks in advance.