Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336273 - IllegalStateException: Workspace is closed
Summary: IllegalStateException: Workspace is closed
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Szymon Brandys CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 14:10 EST by Carolyn MacLeod CLA
Modified: 2011-02-07 08:30 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2011-02-03 14:10:36 EST
While testing 3.6.2 RC3 on Windows Vista 64-bit, and running an internal Eclipse, I go this stack trace in the console:

!ENTRY org.eclipse.core.jobs 4 2 2011-02-03 13:31:34.977
!MESSAGE An internal error occurred during: "Periodic workspace save.".
!STACK 0
java.lang.IllegalStateException: Workspace is closed.
	at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:367)
	at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:41)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I am completely unable to replicate the problem (I tried 4 times).

I would be inclined to close this as "works for me", however I thought I would open the bug anyhow in case it is useful to know that this state can happen. Perhaps it would be better in future to just not report an illegal state in this case, because it doesn't really matter... the workspace was already saved correctly.
Comment 1 Szymon Brandys CLA 2011-02-04 03:42:40 EST
Looks similar to Bug 106985. 

In DelayedSnapshotJob#run we have:

if (ResourcesPlugin.getWorkspace() == null)
  return Status.OK_STATUS;

however #getWorkspace does not return null, it just throws IllegalStateException, if the workspace is null. I would just return with OK_STATUS, if the exception is thrown.
Comment 2 Szymon Brandys CLA 2011-02-07 08:30:22 EST
ResourcesPlugin#getWorkspace does not return null, it just throws IllegalStateExeption. See Bug 34069. So we need to catch the exception, log a waning and return OK_STATUS.

Fixed.