Bug 64421 - ArrayIndexOutOfBoundsException in PackageReferenceLocator.matchReportReference()
Summary: ArrayIndexOutOfBoundsException in PackageReferenceLocator.matchReportReference()
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 RC1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-27 14:54 EDT by Yaniv Inbar CLA
Modified: 2004-05-28 15:18 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yaniv Inbar CLA 2004-05-27 14:54:12 EDT
I get the stack trace below.  I cannot release code for project on which this 
occurred.

I was able to trace it in the debugger.  This were all true:
* positions.length == 2
* last == 4
* reference instanceof QualifiedTypeReference
* typeBinding instanceof ReferenceBinding
* pkgBinding.compoundName.length == 4

Please let me know if you need more information.

java.lang.ArrayIndexOutOfBoundsException: 3
	at 
org.eclipse.jdt.internal.core.search.matching.PackageReferenceLocator.matchRepo
rtReference(PackageReferenceLocator.java:198)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1349)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1584)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1595)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1439)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process
(MatchLocator.java:1102)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:735)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:766)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:863)
	at 
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches
(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.core.search.SearchEngine.findMatches
(SearchEngine.java:469)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:758)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:728)
Comment 1 Olivier Thomann CLA 2004-05-27 15:23:17 EDT
What build are you using?
Any steps to reproduce?
Comment 2 Yaniv Inbar CLA 2004-05-27 16:48:03 EDT
Version: 3.0.0
Build id: 200405211200

-- create a java project saxon

-- Create a CVS repository as described here:
http://sourceforge.net/cvs/?group_id=29872

-- "Check Out As"  on HEAD > saxon7 > net ; check out into an existing 
project ; saxon ; Finish

-- select /saxon3/net/sf/saxon/dom

-- Search > Java ; search string: * ; search for: Package ; Limit To: 
References ; Scope: Selected Resources ; Search

!ENTRY org.eclipse.core.runtime 4 2 May 27, 2004 13:33:45.531
!MESSAGE An internal error occurred during: "Search for References to "*" in 
Selection".
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 3
	at 
org.eclipse.jdt.internal.core.search.matching.PackageReferenceLocator.matchRepo
rtReference(PackageReferenceLocator.java:198)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1349)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1584)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1439)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process
(MatchLocator.java:1102)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:735)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:766)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:863)
	at 
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches
(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.core.search.SearchEngine.findMatches
(SearchEngine.java:469)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:758)
	at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run
(JavaSearchQuery.java:125)
	at 
org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run
(InternalSearchUI.java:82)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 3 Frederic Fusier CLA 2004-05-28 05:34:01 EDT
I can reproduce using your steps even with latest builds, thx.
It's a side effect of bug 54962 fix.
Comment 4 Frederic Fusier CLA 2004-05-28 05:58:54 EDT
Finally after deeper analyse, it's not a regression due to bug 54962.

In certain circumstances the package binding which is found in
matchReportReference method can have more items than positions array of node
reference parameter.

Last position was not limited in all cases to positions.length...
Comment 5 Frederic Fusier CLA 2004-05-28 07:38:51 EDT
I've also find problem when last position equals 0 (ie. in fact when we failed 
to find a valid compound name...).
When this case happens, then return immediately.
Comment 6 Frederic Fusier CLA 2004-05-28 10:11:00 EDT
Fixed and released in HEAD.

[jdt-core-internal]
Change done in PackageReferencelocator.matchReportReference(ASTNode,...) method.

Test case added in JavaSearchTests
Comment 7 Olivier Thomann CLA 2004-05-28 15:18:34 EDT
Verified in 200405281200