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

Bug 342339

Summary: [EMF Runtime Extensions] Make sure that EcorePlatformUtil#getFile() methods can be safely called in standalone applications
Product: [Automotive] Sphinx Reporter: Stephan Eberle <stephaneberle9>
Component: CoreAssignee: Stephan Eberle <stephaneberle9>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.7.0   
Target Milestone: 0.7.0   
Hardware: All   
OS: All   
Whiteboard:

Description Stephan Eberle CLA 2011-04-08 20:31:00 EDT
= Problem description =
Calling EcorePlatformUtil#getFile(Resoure) and EcorePlatformUtil#getFile(URI) in standalone applications currently causes an IllegalStateException indicating that the workspace is closed. This comes from the fact that the WorkspaceSynchonizer#getFile(URI) method that is ultimately invoked by both of aforementioned methods attempts to access the workspace by calling ResourcesPlugin#getWorkspace() but the latter has never been initialized.

= Resolution proposal =
Add a Platform#isRunning() test to EcorePlatformUtil#getFile(Resoure) and EcorePlatformUtil#getFile(URI) and let them return null if it evaluates to false.
Comment 1 Stephan Eberle CLA 2011-04-08 20:31:21 EDT
Fixed as proposed in description.
Comment 2 Balazs Grill CLA 2021-07-14 02:15:27 EDT
Mass-closing Resolved tickets