Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350419

Summary: QueuedBuildData cannot handle projects names with spaces
Product: [Modeling] TMF Reporter: Mark Christiaens <mark.g.j.christiaens>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: damian_gonzalez, mark.g.j.christiaens, sebastian.zarnekow
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR1   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 344373, 349887    
Attachments:
Description Flags
proposed patch sven.efftinge: iplog+

Description Mark Christiaens CLA 2011-06-27 06:05:55 EDT
Build Identifier: 20110301-1815

In org.eclipse.xtext.builder.impl.QueuedBuildData.queueURI(URI) the projectName is extracted from an URI with this code: 

String projectName = uri.segment(1);

If the project's name contains a space then you end up with "%20" in your projectName.  The project names used by eclipse are not escaped.  

Reproducible: Always
Comment 1 Mark Christiaens CLA 2011-06-27 06:06:39 EDT
Doing this as a patch:

...
	public void queueURI(URI uri) {
		if (uri.isPlatformResource()) {
			String projectName = URI.decode (uri.segment(1));
			...
Comment 2 Mark Christiaens CLA 2011-06-27 06:09:18 EDT
BTW,

In order to patch this, I had to pretty much copy the entire QueuedBuildData class because its fields are private.  Maybe make those protected?

BTW (2),

This bug also manifests itself as follows: If you create a new project with a space in its name and the project creation also immediately opens a file in that project, then that file doesn't get build properly.  So, it's probably useful to triage the existing bug reports to see if they could be caused by this flaw.
Comment 3 Knut Wannheden CLA 2011-06-28 01:38:12 EDT
Created attachment 198703 [details]
proposed patch

I believe the IStorage2UriMapper should be used here.
Comment 4 Sebastian Zarnekow CLA 2011-07-12 17:09:44 EDT
Mark, thanks for the ticket and the detailed description on how to reproduce the issue.

Thanks for patch and the pointer to the IStorage2URIMapper, Knut. 

Pushed a slightly modified solution to master. Please verify.
Comment 5 Michael Clay CLA 2011-08-03 15:19:07 EDT
*** Bug 353425 has been marked as a duplicate of this bug. ***
Comment 6 Karsten Thoms CLA 2017-09-19 16:52:00 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:03:18 EDT
Closing all bugs that were set to RESOLVED before Neon.0