Bug 125178 - [search] AIOOBE in PatternLocator when searching for dependency extent from manifest
Summary: [search] AIOOBE in PatternLocator when searching for dependency extent from m...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-25 11:10 EST by Tom Hofmann CLA
Modified: 2006-02-15 05:04 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2006-01-25 11:10:17 EST
I20060124

Steps (not reproducable):
- have a syntax error in a CU (in org.eclipse.jface.text in my case), file is dirty (not saved)
- open the manifest of the org.eclipse.jface.text plug-in with the PDE editor
- go to the dependencies page and select a dependency (org.eclipse.core.runtime)
- from the ctx menu, select "Compute dependency extent"

-> got this

java.lang.ArrayIndexOutOfBoundsException: 0
at org.eclipse.jdt.internal.core.search.matching.PatternLocator.matchNameValue(PatternLocator.java:269)
at org.eclipse.jdt.internal.core.search.matching.PatternLocator.matchesName(PatternLocator.java:244)
at org.eclipse.jdt.internal.core.search.matching.TypeReferenceLocator.match(TypeReferenceLocator.java:83)
at org.eclipse.jdt.internal.core.search.matching.MatchLocatorParser.getTypeReference(MatchLocatorParser.java:311)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeEnterVariable(Parser.java:2673)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:4799)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8560)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8730)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8695)
at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:7488)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.parseAndBuildBindings(MatchLocator.java:1453)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:956)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1055)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1173)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:206)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:491)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:532)
at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentOperation.searchForTypesUsed(DependencyExtentOperation.java:149)
at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentOperation.checkForJavaDependencies(DependencyExtentOperation.java:135)
at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentOperation.execute(DependencyExtentOperation.java:77)
at org.eclipse.pde.internal.ui.search.dependencies.DependencyExtentQuery.run(DependencyExtentQuery.java:43)
at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:94)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Frederic Fusier CLA 2006-01-26 11:49:40 EST
I've reproduce it... It seems that searching for dependencies means that PDE takes all selected plugin types (org.eclipse.core.runtime in your example) and search for references for each one in current plugin (org.eclipse.jface.text in your example).

Unfortunately it also searches for references of anonymous types...! This kind of type has an empty name and built search pattern as an empty char arrays as simple name and Search Engine does not handle properly this kind of pattern...

I'll add test to avoid to fail in this case but PDE may also avoid to search for this kind of reference which will never return any match...
Wassim, what's your mind about this point?
Comment 2 Wassim Melhem CLA 2006-01-26 13:17:25 EST
sure.  sounds good to me.  so all we're talking about here is check that IType.isAnonymous() returns false before we search for references to it, right?
Comment 3 Frederic Fusier CLA 2006-01-26 13:26:29 EST
That's right...

Comment 4 Frederic Fusier CLA 2006-01-26 17:02:12 EST
Fixed and released in HEAD.

When pattern name is an empty char array, then only return accurate if compared name is also empty.

Changes done in PatternLocator.matchNameValue(...).

Test case added in JavaSearchBugsTests
Comment 5 Wassim Melhem CLA 2006-01-27 01:16:22 EST
The PDE side of things was addressed in bug 125442.  thanks frederic.
Comment 6 Frederic Fusier CLA 2006-01-27 04:22:05 EST
Welcome, wassim :-)

Note to verifier that you *definitely* need to have a dirty editor while searching for dependencies otherwise bug cannot happen (there's no anonymous reference in index files => Search Engine will reach pattern locator only if there's at least one working copy in search scope...)
Comment 7 David Audel CLA 2006-02-15 05:04:52 EST
Verified for 3.2 M5 using build I20060215-0010