Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 383315 - NPE in FullSourceWorkspaceSearchTests.testSearchBinaryMethod()
Summary: NPE in FullSourceWorkspaceSearchTests.testSearchBinaryMethod()
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.8.1   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-22 10:06 EDT by Tomasz Zarna CLA
Modified: 2012-08-14 05:35 EDT (History)
3 users (show)

See Also:
satyam.kandula: review+


Attachments
Fix v01 (2.11 KB, patch)
2012-06-22 10:22 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (8.07 KB, application/octet-stream)
2012-06-22 10:22 EDT, Tomasz Zarna CLA
no flags Details
Fix v02 (7.27 KB, patch)
2012-06-25 07:27 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2012-06-22 10:06:13 EDT
master

Got hit by the NPE when running JDT perf tests. See bug 382778, comment 14 for the origin.

-- Error Log from JUnit --
Class: org.eclipse.jdt.core.tests.performance.FullSourceWorkspaceSearchTests
Method: testSearchBinaryMethod
Actual: null
Expected: null
Stack Trace:
java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.search.matching.SuperTypeNamesCollector.collectSuperTypeNames(SuperTypeNamesCollector.java:231)
	at org.eclipse.jdt.internal.core.search.matching.SuperTypeNamesCollector.collect(SuperTypeNamesCollector.java:213)
	at org.eclipse.jdt.internal.core.search.matching.MethodLocator.initializePolymorphicSearch(MethodLocator.java:119)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1238)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:95)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:231)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:584)
	at org.eclipse.jdt.core.tests.performance.FullSourceWorkspaceSearchTests.search(FullSourceWorkspaceSearchTests.java:178)
	at org.eclipse.jdt.core.tests.performance.FullSourceWorkspaceSearchTests.testSearchBinaryMethod(FullSourceWorkspaceSearchTests.java:567)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Comment 1 Tomasz Zarna CLA 2012-06-22 10:22:49 EDT
Created attachment 217740 [details]
Fix v01

The 'superclass' can be null, need to check for that before using it.

+ some typos found when looking around
Comment 2 Tomasz Zarna CLA 2012-06-22 10:22:52 EDT
Created attachment 217741 [details]
mylyn/context/zip
Comment 3 Satyam Kandula CLA 2012-06-25 02:04:56 EDT
The changes look good, but I think there are couple of other places that I have goofed up :(. Request you to take care of them too. 
The other calls in collectSuperTypeNames should have passed the argument 'path' rather than null. Can you please take care of this? Also can you please try to get a testcase both for the null and this problem? Thanks. 

We should get this change in 3.8.1.
Comment 4 Tomasz Zarna CLA 2012-06-25 02:18:31 EDT
(In reply to comment #3)
> The other calls in collectSuperTypeNames should have passed the argument 'path'
> rather than null. Can you please take care of this? 

Do I need to file a new bug for this or can I fix it here?
Comment 5 Satyam Kandula CLA 2012-06-25 02:25:01 EDT
Y(In reply to comment #4)
> (In reply to comment #3)
> > The other calls in collectSuperTypeNames should have passed the argument 'path'
> > rather than null. Can you please take care of this? 
> 
> Do I need to file a new bug for this or can I fix it here?
you can fix it here.
Comment 6 Tomasz Zarna CLA 2012-06-25 07:27:36 EDT
Created attachment 217805 [details]
Fix v02

Fixed nulls from comment 3, added tests for fix v01 and for the nulls.
Comment 7 Satyam Kandula CLA 2012-06-25 10:15:53 EDT
Patch looks good.
Comment 8 Srikanth Sankaran CLA 2012-07-05 11:50:49 EDT
Thanks Tom.

In general, we avoid "drive by shooting" of bugs: i.e while working on
some fix, if we discover problems in unrelated areas, we don't include them
in the current fix, but raise a fresh defect. In particular we strive to
avoid "noise diffs", reformatting, introduction of blank lines, spaces etc.

However, including fixes for typos and grammatical errors is 
always welcome :) Thanks!

Released in master via http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=8d19f5a1e4b345e3efd30be48a0614ea130c9e08.
Comment 10 Jay Arthanareeswaran CLA 2012-08-07 01:22:33 EDT
The test run fine now.
Verified for 4.3 M1 with build I20120805-2000.
Comment 11 Srikanth Sankaran CLA 2012-08-14 05:35:25 EDT
Verified for 3.8.1 using Build id: M20120809-1000