Bug 44637 - NPE in Initializer.getPrimaryElement()
Summary: NPE in Initializer.getPrimaryElement()
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-10 05:17 EDT by Dirk Baeumer CLA
Modified: 2003-11-19 10:37 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2003-10-10 05:17:03 EDT
I20031009_2000

- create a Java project
- open java.util.List
- select method add
- run "Open Call Hierarchy" from the context menu

java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:283)
	at org.eclipse.jface.window.ApplicationWindow$1.run
(ApplicationWindow.java:444)
	at org.eclipse.swt.custom.BusyIndicator.showWhile
(BusyIndicator.java:84)
	at org.eclipse.jface.window.ApplicationWindow.run
(ApplicationWindow.java:441)
	at org.eclipse.ui.internal.WorkbenchWindow.run
(WorkbenchWindow.java:1603)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyContentProvider.getChild
ren(CallHierarchyContentProvider.java:72)
	at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren
(AbstractTreeViewer.java:716)
	at org.eclipse.jface.viewers.StructuredViewer.getFilteredChildren
(StructuredViewer.java:449)
	at org.eclipse.jface.viewers.StructuredViewer.getSortedChildren
(StructuredViewer.java:553)
	at org.eclipse.jface.viewers.AbstractTreeViewer$1.run
(AbstractTreeViewer.java:349)
	at org.eclipse.swt.custom.BusyIndicator.showWhile
(BusyIndicator.java:84)
	at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren
(AbstractTreeViewer.java:337)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel
(AbstractTreeViewer.java:913)
	at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel
(AbstractTreeViewer.java:922)
	at org.eclipse.jface.viewers.AbstractTreeViewer$5.run
(AbstractTreeViewer.java:796)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection
(StructuredViewer.java:796)
	at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged
(AbstractTreeViewer.java:785)
	at org.eclipse.jface.viewers.ContentViewer.setInput
(ContentViewer.java:238)
	at org.eclipse.jface.viewers.StructuredViewer.setInput
(StructuredViewer.java:983)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewer.setMethodWrapper
(CallHierarchyViewer.java:70)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewPart.updateView
(CallHierarchyViewPart.java:914)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewPart.refresh
(CallHierarchyViewPart.java:577)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyViewPart.setMethod
(CallHierarchyViewPart.java:199)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyUI.openInViewPart
(CallHierarchyUI.java:212)
	at org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyUI.open
(CallHierarchyUI.java:199)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.OpenCallHierarchyAction.run
(OpenCallHierarchyAction.java:187)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.OpenCallHierarchyAction.run
(OpenCallHierarchyAction.java:176)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun
(SelectionDispatchAction.java:194)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run
(SelectionDispatchAction.java:172)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:842)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:541)
	at org.eclipse.jface.action.ActionContributionItem.access$4
(ActionContributionItem.java:494)
	at org.eclipse.jface.action.ActionContributionItem$6.handleEvent
(ActionContributionItem.java:466)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2173)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1863)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2347)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:2330)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:858)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:299)
	at org.eclipse.core.launcher.Main.run(Main.java:765)
	at org.eclipse.core.launcher.Main.main(Main.java:599)
Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.Initializer.getPrimaryElement
(Initializer.java:102)
	at org.eclipse.jdt.internal.core.JavaElement.getPrimaryElement
(JavaElement.java:382)
	at org.eclipse.jdt.internal.corext.util.JavaModelUtil.toOriginal
(JavaModelUtil.java:560)
	at org.eclipse.jdt.internal.corext.callhierarchy.MethodCall.<init>
(MethodCall.java:30)
	at 
org.eclipse.jdt.internal.corext.callhierarchy.CallSearchResultCollector.addMemb
er(CallSearchResultCollector.java:42)
	at 
org.eclipse.jdt.internal.corext.callhierarchy.CallSearchResultCollector.addMemb
er(CallSearchResultCollector.java:33)
	at 
org.eclipse.jdt.internal.corext.callhierarchy.MethodReferencesSearchCollector.a
ccept(MethodReferencesSearchCollector.java:65)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.report
(MatchLocator.java:936)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.report
(MatchLocator.java:929)
	at 
org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchReportReferenc
e(MethodLocator.java:131)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1272)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1336)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1233)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process
(MatchLocator.java:870)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:603)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:640)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:749)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:568)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:495)
	at 
org.eclipse.jdt.internal.corext.callhierarchy.CallerMethodWrapper.findChildren
(CallerMethodWrapper.java:67)
	at 
org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.performSearch
(MethodWrapper.java:282)
	at 
org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.doFindChildren
(MethodWrapper.java:220)
	at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.getCalls
(MethodWrapper.java:80)
	at 
org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyContentProvider$MethodWr
apperRunnable.run(CallHierarchyContentProvider.java:40)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run
(ModalContext.java:101)
Comment 1 Dirk Baeumer CLA 2003-10-10 05:31:45 EDT
It works when creating a call hierarchy on remove(int index)
Comment 2 Jerome Lanneluc CLA 2003-10-10 05:58:09 EDT
1. What JRE are you using?
2. Which 'add' method do you select?
Comment 3 Dirk Baeumer CLA 2003-10-10 06:02:45 EDT
- Sun JDK 1.4.1_01
- boolean java.util.List#add(Object o);

Comment 4 Jerome Lanneluc CLA 2003-10-10 06:55:47 EDT
Thanks. Was able to reproduce.
Comment 5 Jerome Lanneluc CLA 2003-10-13 08:53:59 EDT
Changed Intializer.getPrimaryElement(boolean) to handle elements that are 
binary elements.

Added regression test WorkingCopyOwnerTests.getPrimaryElement4()
Comment 6 David Audel CLA 2003-11-19 10:37:42 EST
Verified.