Project: Eclipse_Platform_UI
Bug 88604 [EditorMgmt] [Perspectives] NPE in PerspectiveListenerList.fireEvent when debug flag is on
Reported: 2005-03-20 19:32:36 | Status: verified fixed

build I20050315 + latest UI from head When running the tests, the perspective-oriented tests in IWorkbenchPageTests fail with an NPE like the following Thread [main] (Suspended (exception NullPointerException)) PerspectiveListenerList.fireEvent(SafeRunnable, IPerspectiveListener, IPerspectiveDescriptor, String) line: 55 PerspectiveListenerList.firePerspectiveChanged(IWorkbenchPage, IPerspectiveDescriptor, String) line: 107 WorkbenchWindow.firePerspectiveChanged(IWorkbenchPage, IPerspectiveDescriptor, String) line: 1035 WorkbenchPage.closeEditors(IEditorReference[], boolean) line: 1041 WorkbenchPage.closeAllEditors(boolean) line: 967 WorkbenchPage.dispose() line: 1334 WorkbenchWindow.closePage(IWorkbenchPage, boolean) line: 698 WorkbenchPage$5.run() line: 933 BusyIndicator.showWhile(Display, Runnable) line: 69 WorkbenchPage.close() line: 931 IWorkbenchPageTest.testGetOpenPerspectives() line: 1606 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 85 NativeMethodAccessorImpl.invoke(Method, Object, Object[]) line: 58 DelegatingMethodAccessorImpl.invoke(Method, Object, Object[]) line: 60 Method.invoke(Object, Object[]) line: 391 IWorkbenchPageTest(TestCase).runTest() line: 154 IWorkbenchPageTest(TestCase).runBare() line: 127 TestResult$1.protect() line: 106 TestResult.runProtected(Test, Protectable) line: 124 TestResult.run(TestCase) line: 109 IWorkbenchPageTest(TestCase).run(TestResult) line: 118 TestSuite.runTest(Test, TestResult) line: 208 TestSuite.run(TestResult) line: 203 ApiTestSuite(TestSuite).runTest(Test, TestResult) line: 208 ApiTestSuite(TestSuite).run(TestResult) line: 203 UiTestSuite(TestSuite).runTest(Test, TestResult) line: 208 UiTestSuite(TestSuite).run(TestResult) line: 203 RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String) line: 474 RemotePluginTestRunner(RemoteTestRunner).run() line: 342 RemotePluginTestRunner.main(String[]) line: 36 UITestApplication$1.run() line: 110 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 118 Display.runAsyncMessages(boolean) line: 2873 Display.readAndDispatch() line: 2532 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1501 Workbench.runUI() line: 1465 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 305 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143 IDEApplication.run(Object) line: 103 UITestApplication.run(Object) line: 39 PlatformActivator$1.run(Object) line: 228 EclipseStarter.run(Object) line: 338 EclipseStarter.run(String[], Runnable) line: 151 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 85 NativeMethodAccessorImpl.invoke(Method, Object, Object[]) line: 58 DelegatingMethodAccessorImpl.invoke(Method, Object, Object[]) line: 60 Method.invoke(Object, Object[]) line: 391 Main.invokeFramework(String[], URL[]) line: 315 Main.basicRun(String[]) line: 268 Main.run(String[]) line: 942 Main.main(String[]) line: 926 Lines 54 and 55 of PerspectiveListenerList are: if (UIStats.isDebugging(UIStats.NOTIFY_PERSPECTIVE_LISTENERS)) { label = description + perspective.getId(); It's failing because perspective is null. This is only hit when -debug is set (NOTIFY_PERSPECTIVE_LISTENERS is now on by default when -debug is set).

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java