Bug 104657 - [Undo] NPE in OperationHistoryActionHandler
Summary: [Undo] NPE in OperationHistoryActionHandler
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Susan McCourt CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-21 09:59 EDT by Markus Keller CLA Friend
Modified: 2005-09-26 16:40 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA Friend 2005-07-21 09:59:45 EDT
N20050721-0010

Probably caused by the fix for bug 103379.

The test log for org.eclipse.jdt.ui.tests.AutomatedSuite (
http://download.eclipse.org/downloads/drops/N20050721-0010/testresults/consolelogs/win32_consolelog.txt
) contains several suspicious intances of the NPE below, although tests don't
fail because of this.

org.eclipse.jdt.text.tests such as BracketInserterTest fail in HEAD because of
this (there was another bug in the test, which has been corrected > 20050721).

     [java] !MESSAGE Failed to execute runnable (java.lang.NullPointerException)
     [java] !STACK 0
     [java] org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.NullPointerException)
     [java] 	at org.eclipse.swt.SWT.error(SWT.java:2942)
     [java] 	at org.eclipse.swt.SWT.error(SWT.java:2865)
     [java] 	at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126)
     [java] 	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3114)
     [java] 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2768)
     [java] 	at
org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.runEventLoop(EventLoopProgressMonitor.java:123)
     [java] 	at
org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.isCanceled(EventLoopProgressMonitor.java:97)
     [java] 	at
org.eclipse.core.internal.jobs.ThreadJob.isCanceled(ThreadJob.java:127)
     [java] 	at org.eclipse.core.internal.jobs.ThreadJob.joinRun(ThreadJob.java:157)
     [java] 	at
org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:88)
     [java] 	at
org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:190)
     [java] 	at
org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:96)
     [java] 	at
org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:1674)
     [java] 	at
org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1714)
     [java] 	at
org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1739)
     [java] 	at
org.eclipse.jdt.testplugin.JavaProjectHelper.delete(JavaProjectHelper.java:264)
     [java] 	at
org.eclipse.jdt.ui.tests.core.CodeFormatterUtilTest.tearDown(CodeFormatterUtilTest.java:78)
     [java] 	at junit.framework.TestCase.runBare(TestCase.java:130)
     [java] 	at junit.framework.TestResult$1.protect(TestResult.java:106)
     [java] 	at junit.framework.TestResult.runProtected(TestResult.java:124)
     [java] 	at junit.framework.TestResult.run(TestResult.java:109)
     [java] 	at junit.framework.TestCase.run(TestCase.java:118)
     [java] 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
     [java] 	at junit.framework.TestSuite.run(TestSuite.java:203)
     [java] 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
     [java] 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
     [java] 	at junit.framework.TestResult.runProtected(TestResult.java:124)
     [java] 	at junit.extensions.TestSetup.run(TestSetup.java:23)
     [java] 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
     [java] 	at junit.framework.TestSuite.run(TestSuite.java:203)
     [java] 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
     [java] 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
     [java] 	at junit.framework.TestResult.runProtected(TestResult.java:124)
     [java] 	at junit.extensions.TestSetup.run(TestSetup.java:23)
     [java] 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
     [java] 	at junit.framework.TestSuite.run(TestSuite.java:203)
     [java] 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
     [java] 	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
     [java] 	at junit.framework.TestResult.runProtected(TestResult.java:124)
     [java] 	at junit.extensions.TestSetup.run(TestSetup.java:23)
     [java] 	at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:313)
     [java] 	at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:199)
     [java] 	at org.eclipse.test.UITestApplication$3.run(UITestApplication.java:188)
     [java] 	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
     [java] 	at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
     [java] 	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3114)
     [java] 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2768)
     [java] Unhandled event loop exception
     [java] 	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
     [java] Reason:
     [java] 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
     [java] 	at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
     [java] 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
     [java] 	at
org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
     [java] 	at
org.eclipse.test.UITestApplication.runApplication(UITestApplication.java:131)
     [java] 	at org.eclipse.test.UITestApplication.run(UITestApplication.java:58)
     [java] 	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
     [java] 	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
     [java] 	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] 	at java.lang.reflect.Method.invoke(Method.java:324)
     [java] 	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
     [java] 	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
     [java] 	at org.eclipse.core.launcher.Main.run(Main.java:973)
     [java] 	at org.eclipse.core.launcher.Main.main(Main.java:948)
     [java] Caused by: java.lang.NullPointerException
     [java] 	at
org.eclipse.ui.operations.OperationHistoryActionHandler.getWorkbenchWindow(OperationHistoryActionHandler.java:301)
     [java] Failed to execute runnable (java.lang.NullPointerException)
     [java] 	at
org.eclipse.ui.operations.OperationHistoryActionHandler.getHistory(OperationHistoryActionHandler.java:224)
     [java] 	at
org.eclipse.ui.operations.UndoActionHandler.shouldBeEnabled(UndoActionHandler.java:71)
     [java] 	at
org.eclipse.ui.operations.OperationHistoryActionHandler.update(OperationHistoryActionHandler.java:343)
     [java] 	at
org.eclipse.ui.operations.OperationHistoryActionHandler$1.run(OperationHistoryActionHandler.java:129)
     [java] 	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
     [java] 	at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
     [java] 	... 62 more
Comment 1 Susan McCourt CLA Friend 2005-07-21 18:05:41 EDT
Oops - I scanned this quickly while reviewing a sea of newly assigned bugs and 
thought that tests were not failing, so I did not address yet.  I just reread 
the comment and realized the text tests are failing.  This may fail again in 
tonight's build, depending on whether I get a chance to get back to this 
tonight, but it is next on my list.
Comment 2 Markus Keller CLA Friend 2005-07-22 08:41:49 EDT
Sorry for my lousy ordering of issues. I don't think I would have understood
this PR correctly on first reading either ... .

However, the bug does not seem to be too severe, since it only happens in the
tests -- I could not reproduce it manually. You probably have to be very quick
at deleting a project after doing a text change.
Comment 3 Susan McCourt CLA Friend 2005-07-22 21:19:45 EDT
Fixed in HEAD > 20050722.

This was indeed related to the fix for bug #103379.  In that fix, the 
handler's site was nulled out during dispose to fix some leaks.  In the test 
cases, the action handler was being run in an async which occurred after the 
handler had been disposed, and was attempting to access the site.  Added 
checks so that the handler will not NPE when accessed after disposal.

I still see intermittent failures in the JDT Text Suites 
(testAngleBracketsBeforeMethodDecl15) but this does not seem to be related at 
all the OperationHistoryActionHandler.

Comment 4 Douglas Pollock CLA Friend 2005-07-26 12:00:42 EDT
Nick gives +1.  Good to go for 3.1.1. 
Comment 5 Susan McCourt CLA Friend 2005-08-01 15:43:52 EDT
committed change to R3_1_maintenance branch.
Available >20050801
Comment 6 Susan McCourt CLA Friend 2005-08-09 12:42:17 EDT
Verified in I20050808-2000 (3.2 M1 test pass) via test suites and visual 
inspection of source.

Leaving this bug marked "fixed" (vs. "verified") so it can be verified again 
against 3.1.1 when the time comes
Comment 7 Michael Van Meekeren CLA Friend 2005-09-26 16:40:55 EDT
verified on Motif 3.1.1 build M200509231430

by running the org.eclipse.jdt.text.tests.JdtTextTestSuite tests and the test
suite that contains the CodeFormatterUtilTest