Bug 550336 - Staging view freezes on commit (NPE in AbstractTextEditor$TextEditorSavable.isDirty) Temporary fix to prevent staging view from freezing Change-Id: If330422f4d655b5d331a6fc7f6c9e4b528dc28fb Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java index 7b488a3..b3105d2 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -7178,12 +7178,31 @@ @Override public void doSave(IProgressMonitor monitor) throws CoreException { - fTextEditor.doSave(monitor); + try { + fTextEditor.doSave(monitor); + } catch (NullPointerException e) { + // This should not happen. Code added to handle the below bug. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=550336 + Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID); + ILog log = Platform.getLog(bundle); + Status status = new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, null, e); + log.log(status); + } } @Override public boolean isDirty() { - return fTextEditor.isDirty(); + try { + return fTextEditor.isDirty(); + } catch (NullPointerException e) { + // This should not happen. Code added to handle the below bug. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=550336 + Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID); + ILog log = Platform.getLog(bundle); + Status status = new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, null, e); + log.log(status); + return false; + } } /*