Project: Eclipse_Platform_UI
Bug 29107 [Preferences] Error thrown in PreferencePage.performOk/Apply/Cancel locks Eclipse
Reported: 2003-01-07 14:30:30 | Status: closed fixed

An error thrown inside the overriden methods performOk and performCancel (and performApply) in a PreferencesPage will cause Eclipse to run into a deadlock as soon as the user displays that page. Imagine a new plugin developed using the latest version of the eclipse libraries using methods that did not exist in previous versions. Running it on an older version can lead to NoSuchMethodErrors (that's what happened to me). Imagine those errors in performOk and performCancel on a PreferencesPage. The Error will not be caught and there is no way for the user to exit the preferences or eclipse without killing it. Reproduction: 1. create a new plugin project containing a preferences page. 2. Override methods as follows: public boolean performOk() { throw new NoSuchMethodError("No way out!"); } public boolean performCancel() { throw new NoSuchMethodError("No way out!"); } 3. Run the plugin and go to the preferences page. 4. Try to exit the preferences pages or eclipse Possible solution: Catch any throwable when calling those methods from the environment and report an error message to the user when the method throws any. Exit the preferences anyway (or let the user decide what to do). This problem has been reproduced on 2.1M3 and 2.1M4.

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java