| Summary: | Empty/broken workbench.xmi file makes workspace unusable | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Oleg Besedin <ob1.eclipse> | ||||
| Component: | UI | Assignee: | Oleg Besedin <ob1.eclipse> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | tom.schindl | ||||
| Version: | 4.2 | ||||||
| Target Milestone: | 4.2 M7 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 214148 [details]
Error log
I put a simple fallback clause to use application default model if the modified model can't be read. In 4.3 we should work on making model save and load safer. Git reference: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=fdf4db780aacd85623c995e81788979e721fb568 Verified using I20120430-1800. You can make file persist saver by using "Resource.OPTION_SAVE_ONLY_IF_CHANGED". From Ed on the newsgroup: --------8<-------- You could use Resource.OPTION_SAVE_ONLY_IF_CHANGED which writes to either an in-memory or file system buffer and then compares it to the existing contents and replaces them only if they're different. If the first part fails, it won't try the second part... --------8<-------- File bug 378212 to use the saver persist method |
While working on another bug I've got into a state where workbench.xmi file became empty. I could not duplicate that, I'd guess that there was either an exception on shutdown or I killed Eclipse instance while save was in progress. At any rate, it turned out that having empty workbench.xmi file renders workspace unusable as Eclipse can not start. The ResourceHandler has this construct: try { resource = resourceSetImpl.getResource(uri, true); } catch (Exception e) { ... resource = resourceSetImpl.getResource(uri, false); } but that does not work as the next line assumes (and has to assume) that the root element in the resource is an application: MApplication theApp = (MApplication) applicationResource.getContents().get(0);