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

Bug 24492

Summary: [resources] Need better message for resource files with leading whitespaces
Product: [Eclipse Project] Platform Reporter: Sven Blösl <Sven.Bloesl>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 Keywords: helpwanted
Version: 2.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Sven Blösl CLA 2002-10-08 06:26:23 EDT
Eclipse fails to build projects, which contain resource files with leading 
whitespace character. Instead an uninformative log entry is generated.
First of all i dont see, why Eclipse cannot copy such resource files.
Besides that should the log entry at least include the offending path name.
Comment 1 Sonia Dimitrov CLA 2002-10-08 09:46:51 EDT
A few requests:

1.  Please provide steps that reproduce this problem
2.  Attach the .metadata/log file
Comment 2 Sven Blösl CLA 2002-10-08 10:23:46 EDT
Take any project you like, put a file called " whatever.notjava" (without the 
quotation marks) into some java source directory, so that it will be copied 
into the respective build directory. Refresh the project list.

-> "The project was not built. It may be inconsistent, ..." in the task list 

and the log contains the following stack trace:

org.eclipse.core.internal.resources.ResourceException: Names cannot begin or 
end with whitespace.
	at org.eclipse.core.internal.resources.Resource.checkValidPath
(Resource.java:261)
	at org.eclipse.core.internal.resources.Resource.checkCopyRequirements
(Resource.java:122)
	at org.eclipse.core.internal.resources.Resource.assertCopyRequirements
(Resource.java:78)
	at org.eclipse.core.internal.resources.Resource.copy(Resource.java:350)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder$3.visit
[...]
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:40)
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.copyExtraResourcesBack
(BatchImageBuilder.java:116)
[...]
Comment 3 Sonia Dimitrov CLA 2002-10-08 11:23:52 EDT
Eclipse naming conventions do not allow leading or trailing whitespaces in 
resources.  There is no intention to change this behavior.
Comment 4 Sven Blösl CLA 2002-10-09 04:18:08 EDT
Okay, whitespaces are not allowed. But it should give a proper error message, 
which gives a hint where to find the offending file. Otherwise it is burdensome 
to find it, if you create an eclipse-project on foreign code.
Comment 5 DJ Houghton CLA 2002-10-09 08:33:32 EDT
Re-opening.
Investigate putting the full path name in the exception.

See Workspace.checkValidPath, Workspace.validateName.
Comment 6 DJ Houghton CLA 2002-11-18 14:57:59 EST

*** This bug has been marked as a duplicate of 26404 ***