Project: Eclipse_Platform_UI
Bug 377031 Empty/broken workbench.xmi file makes workspace unusable
Reported: 2012-04-17 16:48:48 | Status: verified fixed

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);

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java