Project: SWT
Bug 19925 Error opening doc file causes much grief
Reported: 2002-06-11 14:20:27 | Status: resolved fixed

Build: 20020611 JDK: IBM JDK 1.3.1 - 20020403 I get an error every time I try to open a .doc file. Follow these steps: 1. New workspace 2. New simple project "Docs". 3. Drag & drop CALLBACK.DOC from the desktop into Docs. (see attachment) 4. Double click CALLBACK.DOC <- Error occurs 5. Try to exit Eclipse, no can do! Terminate Eclipse with a Ctrl-C. 6. Relaunch Eclipse... CALLBACK.DOC (& the error) returns (run screaming to the hills, AIIEEE!) The following things happen at step 5: 1. CALLBACK.DOC is opened in WordPad. 2. CALLBACK.DOC is also opened in a blank editor in Eclipse. 3. The Eclipse editor for CALLBACK.DOC is marked dirty. Revert is greyed out in the File menu, and every attempt to close CALLBACK.DOC fails, i.e. when you click the Editor X you get prompted to save, no matter what answer you give, the file remains open. This is especially nasty because it means you can't close Eclipse. I had to terminate the process with a Ctrl-C in the Java console. 4. The following appears in the log: !SESSION Jun 11, 2002 13:19:05.181 --------------------------------------------- java.fullversion=J2RE 1.3.1 IBM Windows 32 build cn131-20020403 (JIT enabled: jitc) BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86 -data c:\home\workspaces\doctest0611 -install file:C:/home/eclipse/eclipse0611/eclipse/ !ENTRY org.eclipse.ui 4 2 Jun 11, 2002 13:19:05.181 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui". !STACK 0 java.lang.NullPointerException at org.eclipse.ui.internal.editorsupport.win32.OleEditor.oleActivate(OleEditor.java:551) at org.eclipse.ui.internal.editorsupport.win32.OleEditor.activateClient(OleEditor.java:168) at org.eclipse.ui.internal.editorsupport.win32.OleEditor.access$3(OleEditor.java:166) at org.eclipse.ui.internal.editorsupport.win32.OleEditor$4.partActivated(OleEditor.java:126) at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:39) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:802) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:37) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:1031) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2039) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:330) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1685) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1581) at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:91) at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:91) at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:112) at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:177) at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:531) at org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:303) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:320) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:494) at org.eclipse.jface.viewers.StructuredViewer$3.handleOpen(StructuredViewer.java:581) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:198) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:195) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:222) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1527) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1289) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:697) at org.eclipse.core.launcher.Main.main(Main.java:530) !ENTRY org.eclipse.ui 4 4 Jun 11, 2002 13:19:05.321 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Jun 11, 2002 13:19:05.331 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.swt.ole.win32.OleClientSite.onPaint(OleClientSite.java:824) at org.eclipse.swt.ole.win32.OleClientSite.access$2(OleClientSite.java:819) at org.eclipse.swt.ole.win32.OleClientSite$1.handleEvent(OleClientSite.java:122) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:841) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:663) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1219) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1287) at org.eclipse.jface.window.Window.runEventLoop(Window.java:557) at org.eclipse.jface.window.Window.open(Window.java:537) at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:318) at org.eclipse.jface.util.SafeRunnable.handleException(SafeRunnable.java:42) at org.eclipse.ui.internal.PartListenerList$1.handleException(PartListenerList.java:42) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(InternalPlatform.java:427) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:804) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:37) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:1031) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2039) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:330) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1685) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1581) at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:91) at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:91) at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:112) at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:177) at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:531) at org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:303) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:320) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:494) at org.eclipse.jface.viewers.StructuredViewer$3.handleOpen(StructuredViewer.java:581) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:198) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:195) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:222) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1527) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1289) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:697) at org.eclipse.core.launcher.Main.main(Main.java:530) !ENTRY org.eclipse.ui 4 4 Jun 11, 2002 13:20:02.393 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Jun 11, 2002 13:20:02.393 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at at org.eclipse.swt.ole.win32.OleClientSite.access$2(OleClientSite.java:819) at org.eclipse.swt.ole.win32.OleClientSite$1.handleEvent(OleClientSite.java:122) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:841) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:663) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled Code)) at org.eclipse.jface.window.Window.open(Window.java:537) at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:318) at org.eclipse.jface.util.SafeRunnable.handleException(SafeRunnable.java:42) at org.eclipse.ui.internal.PartListenerList$1.handleException(PartListenerList.java:42) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(InternalPlatform.java:427) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:804) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:37) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:1031) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2039) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:330) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1685) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1581) at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:91) at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:91) at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:112) at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:177) at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:531) at org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:303) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:320) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:494) at org.eclipse.jface.viewers.StructuredViewer$3.handleOpen(StructuredViewer.java:581) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:198) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:195) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:222) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1527) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1289) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:697) at org.eclipse.core.launcher.Main.main(Main.java:530) !ENTRY org.eclipse.ui 4 4 Jun 11, 2002 13:21:23.500 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Jun 11, 2002 13:21:23.500 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at at org.eclipse.swt.ole.win32.OleClientSite.access$2(OleClientSite.java:819) at org.eclipse.swt.ole.win32.OleClientSite$1.handleEvent(OleClientSite.java:122) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:841) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:663) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled Code)) at org.eclipse.jface.window.Window.open(Window.java:537) at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:318) at org.eclipse.jface.util.SafeRunnable.handleException(SafeRunnable.java:42) at org.eclipse.ui.internal.PartListenerList$1.handleException(PartListenerList.java:42) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(InternalPlatform.java:427) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:804) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:37) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:1031) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2039) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:330) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1685) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1581) at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:91) at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:91) at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:112) at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:177) at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:531) at org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:303) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:320) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:494) at org.eclipse.jface.viewers.StructuredViewer$3.handleOpen(StructuredViewer.java:581) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:198) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:195) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:222) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1527) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1289) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:697) at org.eclipse.core.launcher.Main.main(Main.java:530) As I see it, there are 5 parts to this bug: 1. Can't open .doc files without an error 2. Error handling near OLE needs to guard against two editors (both internal & external) 3. No way to close the dirty editor that appears 4. Loose "save file" handling makes clean shutdown impossible 5. Restore code shouldn't restore faulty editors (particularly dirty ones!)

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java