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

Bug 321497

Summary: IWorkspace.run() javadoc says it will fail but it doesn't when no scheduling rule is supplied
Product: [Eclipse Project] Platform Reporter: Tomasz Zarna <tomasz.zarna>
Component: ResourcesAssignee: Szymon Brandys <Szymon.Brandys>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jamesblackburn+eclipse, remy.suen
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 311526    
Attachments:
Description Flags
Fix v01 none

Description Tomasz Zarna CLA 2010-08-02 08:24:51 EDT
When I was reviewing a patch attached to bug 311526 I came across IWorkspace.run() javadoc which confused me. The doc says the method will fail when no scheduling rule is supplied and an attempt to change resources is done. But this is exactly what happens in James' patch from bug 311526. He wraps the import projects op (which definitely changes resources) in a WorkspaceModifyOperation with a null rule, so I would expect it to fail. Question: is the patch wrong or is the javadoc outdated?
Comment 1 James Blackburn CLA 2010-08-02 08:37:15 EDT
Certainly the JavaDoc you're referring to here looks wrong to me:

"If no scheduling rule is supplied, then any attempt to change resources will fail"

Certainly when batching workspace change events in a WorkspaceJob, the scheduling rule is set to null by default: see InternalWorkspaceJob#run.

From what I can see the JobManager ignores a null rule for scheduling and is happy for it begin()/end() it.
Comment 2 Szymon Brandys CLA 2010-08-02 08:59:19 EDT
(In reply to comment #1)
Indeed. This should be fixed.
Comment 3 Szymon Brandys CLA 2010-08-02 10:08:15 EDT
Created attachment 175713 [details]
Fix v01
Comment 4 Szymon Brandys CLA 2010-08-02 10:10:07 EDT
The javadoc is fixed in HEAD.
Comment 5 Szymon Brandys CLA 2010-08-02 10:10:29 EDT
.