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

Bug 409217

Summary: PartServiceImpl.savePart doesn't use WorkbenchAdvisor.getWorkbenchErrorHandler()
Product: [Eclipse Project] Platform Reporter: Arnaud Brunet <arnaud.brunet+eclipse>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: pwebster
Version: 4.2.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Arnaud Brunet CLA 2013-05-27 17:07:24 EDT
Hello,

The method PartServiceImpl.savePart(MPart, boolean) just logs exception and doesn't invoke the WorkbenchErrorHandler :
try {
	ContextInjectionFactory.invoke(client, Persist.class, part.getContext());
} catch (InjectionException e) {
	log("Failed to persist contents of part", "Failed to persist contents of part ({0})", //$NON-NLS-1$ //$NON-NLS-2$
			part.getElementId(), e);
	return false;
} catch (RuntimeException e) {
	log("Failed to persist contents of part via DI", //$NON-NLS-1$
			"Failed to persist contents of part ({0}) via DI", part.getElementId(), e); //$NON-NLS-1$
	return false;
}

So if an exception is thrown in the EditorPart.doSave(IProgressMonitor) method, the WorkbenchErrorHandler is not aware of the error.
And we can not catch the exception in global way.

Regards,
Arnaud
Comment 2 Arnaud Brunet CLA 2013-05-27 19:49:22 EDT
Is there any workaround .

The 4.3 version is not released yet. And this bug is major for us because we have a centralized class which process the exceptions.
Comment 3 Paul Webster CLA 2013-05-28 06:28:20 EDT
No, there's no work around.  Kepler is in RC3 right now, and will be released towards the end of June.

The fix was backported to 4.2.2+ (branch R4_2_maintenance) but if you want it there you would have to build it yourself: http://wiki.eclipse.org/Platform-releng/Platform_Build

PW
Comment 4 Arnaud Brunet CLA 2013-05-28 18:24:22 EDT
I guess i have to surround all doSave contents with a try {} catch (Throwable) { process like the ErrorHandler }

Thanks Peter.
Comment 5 Paul Webster CLA 2013-05-30 08:46:59 EDT

*** This bug has been marked as a duplicate of bug 405562 ***