From 20f86e123c7e6fa0950be7a8f87a1a61f2650395 Mon Sep 17 00:00:00 2001 From: Kalyan Prasad Tatavarthi Date: Tue, 3 Sep 2019 11:59:29 +0530 Subject: 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 --- .../eclipse/ui/texteditor/AbstractTextEditor.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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 7b488a35762..b3105d2de16 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 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit @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; + } } /* -- cgit v1.2.3