Bug 310213

Summary: AIOOBE in IndexSelector.initializeIndexLocations()
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, Olivier_Thomann, satyam.kandula
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: Other   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Stephan Herrmann CLA 2010-04-22 19:18:57 EDT
I just had the opportunity to single-step into an AIOOBE:

The relevant stack looks like this:

IndexSelector.initializeIndexLocations() line: 205	
IndexSelector.getIndexLocations() line: 283	
JavaSearchParticipant.selectIndexes(SearchPattern, IJavaSearchScope) line: 107	
PatternSearchJob.getIndexes(IProgressMonitor) line: 79	
PatternSearchJob.ensureReadyToRun() line: 50	
IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor) line: 174	
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 214	
BasicSearchEngine.search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 515	
SearchEngine.search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 582	

The exception was caused by a search pattern with a focus type like
java.lang.Object or java.lang.Throwable etc.
In these cases ReferenceCollection.internQualifiedNames(char[][][])
returns EmptyQualifiedNames, so that qualifiedNames[0] goes bonkers.
Comment 1 Olivier Thomann CLA 2010-04-22 19:28:34 EDT
Thanks Stephan.
Could you please specify the build ID?
Comment 2 Stephan Herrmann CLA 2010-04-22 19:47:36 EDT
(In reply to comment #1)
> Thanks Stephan.
> Could you please specify the build ID?

Sorry, forgot to mention: I'm sitting on I20100330-0800,
but I just updated my workspace to jdt core's v_A45 (so that's
what I stepped through).

If any line numbers don't match that'd mean I have changes in those files,
but the classes involved should actually be "clean".
Comment 3 Frederic Fusier CLA 2010-04-24 18:12:47 EDT
Created attachment 166008 [details]
Proposed patch

Just add a check whether the returned array is empty or not. In this case, keep the qualified name as is...
Comment 4 Frederic Fusier CLA 2010-04-24 18:13:53 EDT
(In reply to comment #3)
> Created an attachment (id=166008) [details]
> Proposed patch
> 
> Just add a check whether the returned array is empty or not. In this case, keep
> the qualified name as is...

Released for 3.6M7 in HEAD stream.
Comment 5 Satyam Kandula CLA 2010-04-27 08:38:42 EDT
Verified for 3.6M7 using build I20100424-2000
Comment 6 Satyam Kandula CLA 2010-04-27 08:42:05 EDT
(In reply to comment #5)
> Verified for 3.6M7 using build I20100424-2000
I actually used the build I20100426-0852
Comment 7 Jay Arthanareeswaran CLA 2010-04-27 08:59:02 EDT
Verified.