Bug 34069 - ResourcesPlugin.getWorkspace() should never return null
Summary: ResourcesPlugin.getWorkspace() should never return null
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-07 06:50 EST by Jerome Lanneluc CLA
Modified: 2004-09-13 12:04 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2003-03-07 06:50:09 EST
Build 20030306

As shown in bug 33998, ResourcesPlugin.getWorkspace() can return null on shut 
down. However null is not specified as a valid return value.
Comment 1 John Arthorne CLA 2003-03-11 18:40:10 EST
This will only return null if the resources plugin has already been shut down.  
Since plugins are shut down in pre-requisite order, this means the JDT UI is 
leaving threads running after its plugin shutdown() method has exited. This is 
dangerous and should be fixed.


Almost all of our API methods will fail in unpredictable ways if they are 
invoked after the plugin has shutdown.  I don't think we can reasonably document 
the behaviour of our API in these circumstances.
Comment 2 Jerome Lanneluc CLA 2003-03-12 06:58:15 EST
Entered bug 34800 agaist JDT/UI.
Comment 3 John Arthorne CLA 2003-03-25 10:12:29 EST
I think the best we can do here is throw a descriptive runtime exception stating
that the resources plugin has been shutdown.  That's what we currently do with
the runtime plugin API.
Comment 4 DJ Houghton CLA 2004-09-13 11:37:33 EDT
Runtime currently uses IllegalStateExeption in these cases.
Comment 5 John Arthorne CLA 2004-09-13 12:04:01 EDT
I updated the spec of getWorkspace() in March 2004 with the line: "The workspace
is not accessible after the resources plug-in has shutdown." I have now fixed
the implementation to throw IllegalStateException when the Resources plugin has
been shutdown. This effectively changes the exception from NullPointerException
to IllegalStateException, which is a more accurate description of the situation.