| Summary: | REGRESSION: NPE in the processes or debug panel in the debugger perspective | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Olivier Thomann <Olivier_Thomann> |
| Component: | UI | Assignee: | Tod Creasey <Tod_Creasey> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | major | ||
| Priority: | P1 | CC: | veronika_irvine |
| Version: | 2.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | |||
*** Bug 6256 has been marked as a duplicate of this bug. *** This appears to be a bug in the workbench code:
ObjectActionContributorManager#contributeObjectActions(IWorkbenchPart part,
IMenuManager popupMenu, ISelectionProvider selProv)
The following code assumes that #getContributers(..) cannot return null, but it
does:
//If there is a resource class add it in
if(resourceClass == null)
contributors = getContributors(commonClass);
else
contributors = getContributors(commonClass,resourceClass);
// Do the contributions. Add menus first, then actions
boolean actualContributions = false;
for (int i = 0; i < contributors.size(); i++) {
I would add that the size() call should be removed from the condition in the for
statement. The condition is evaluated n times if the collection has n elements.
I guess the collection size doesn't change the time it is iterated. Then:
boolean actualContributions = false;
int size = contributors == null ? 0 : contributors.size();
for (int i = 0; i < size; i++) {
....
}
should fix it.
|
Using the 1122 build, I got a NPE trying to remove terminated processes from the processes panel in the debugger view. I never had this problem with the 1116 build. So this is a recent regression. After running a simple HelloWorld program, I couldn't open the popup menu from the right button of the mouse in the processes window of the debugger. I got a NPE. The source is: [public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } } ] I didn't run in debug mode. If I run in debug mode, I can remove the terminated processes again, but in this case I got a NPE in the debug window after the process has been removed from the display area. In both cases the error seems to be the same. Here is the stack trace: Log: Thu Nov 22 15:57:27 EST 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Log: Thu Nov 22 15:57:27 EST 2001 4 org.eclipse.ui 0 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.ui.internal.ObjectActionContributorManager.contributeObjectActions(O bjectActionContributorManager.java:90) at org.eclipse.ui.internal.PopupMenuExtender.addObjectActions(PopupMenuExtender.jav a:47) at org.eclipse.ui.internal.PopupMenuExtender.menuAboutToShow(PopupMenuExtender.java :68) at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:220) at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:253) at org.eclipse.jface.action.MenuManager.access$0(MenuManager.java:250) at org.eclipse.jface.action.MenuManager$1.menuShown(MenuManager.java:280) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:112) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:839) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:2893) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2587) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:988) at org.eclipse.swt.widgets.Display.windowProc(Display.java:1715) at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method) at org.eclipse.swt.widgets.Menu.setVisible(Menu.java:740) at org.eclipse.swt.widgets.Control.WM_CONTEXTMENU(Control.java:2718) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2570) at org.eclipse.swt.widgets.Display.windowProc(Display.java:1715) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1075) at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:144) at org.eclipse.swt.widgets.Control.WM_RBUTTONUP(Control.java:3554) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2618) at org.eclipse.swt.widgets.Display.windowProc(Display.java:1715) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1142) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1165) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:82 0) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.Main.main(Main.java:362)