Bug 73784 - [search] java search internal error
Summary: [search] java search internal error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 78452 79975 136710 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-13 14:15 EDT by bernhard schmidt CLA
Modified: 2006-04-14 03:20 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bernhard schmidt CLA 2004-09-13 14:15:42 EDT
right click on a method of class shown in the package explorer throws the
following exception:

An internal error occurred during: "Java Search".
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
java.lang.String.substring(Unknown Source)
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getQualifiedName(PossibleMatch.java:107)
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.<init>(PossibleMatch.java:40)
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:872)
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
org.eclipse.jdt.core.search.SearchEngine.findMatches(SearchEngine.java:468)
org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:757)
org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:125)
org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:83)
org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Frederic Fusier CLA 2004-09-14 05:07:38 EDT
In order to help us to reproduce the problem, please provide some more information:
 - build you're using
 - does it happen on each method of any class in Package Exlplorer or only on 
   specific ones?
 - if specific ones, then attach class(es) which contain(s) failing method(s)
Comment 2 bernhard schmidt CLA 2004-09-14 05:27:49 EDT
hi

sorry i forgot to provide the conditions, but the problem occured when i am
setting up with the left hand the linux box and with the right hand i worked
on my java project.

Version: 3.0.0
Build id: 200406251208

the problem occurs only when i search references for the method:

	public void setCursor(MultilineTextPosition pos)

hope this helps.

best regards
benny
Comment 3 Frederic Fusier CLA 2004-10-28 07:11:18 EDT
Unfortunately this method seems not to be in Eclipse 3.0 code.
I cannot find MultilineTextPosition class...
If this is a piece of your code, I need a complete example to help me to
reproduce this problem, thanks
Another question, could you have a try with 3.0.1 build and let us know if this
problem also occurs with this build?
Comment 4 Channing Walton CLA 2004-11-01 07:09:29 EST
I've had this problem with I20041013 (3.1.0 stream).

I was searching for declarations of a method in the workspace.


!ENTRY org.eclipse.core.runtime 4 2 Nov 01, 2004 11:52:19.279
!MESSAGE An internal error occurred during: "Java Search".
!STACK 0
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1768)
	at
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getQualifiedName(PossibleMatch.java:109)
	at
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.<init>(PossibleMatch.java:41)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:911)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.core.search.SearchEngine.findMatches(SearchEngine.java:472)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:761)
	at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:125)
	at
org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:83)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 5 Frederic Fusier CLA 2004-11-01 07:27:01 EST
Which kind of method? A specific one or an existing of rt.jar library or eclipse
plugins?
If this is a specific method (ie. one of your projects in your workspace or your
own librairies...), would it be possible to have a sample example to help us to
reproduce this exception?
Thanks
Comment 6 Markus Keller CLA 2004-11-05 06:36:18 EST
I can reproduce this in 200411042000 in my development workspace by searching
for references to Object#clone() from a jdk1.5.0 rt.jar.

My workspace has compiler compliance level 1.4 and a j9 vm as default jre. I
have several project configured with jdk1.5.0.

However, I could not reproduce it in a fresh workspace so far.
Comment 7 Markus Keller CLA 2004-11-05 06:48:33 EST
Search for declarations of clone() gives the same problem, but only after many
matches have been reported. Reference search fails immediately.

Frederic, please contact me if you want me to debug something with my dev
workspace (where I can reliably reproduce it).
Comment 8 Frederic Fusier CLA 2004-11-05 08:05:06 EST
Thanks Markus for the inputs.
I'll jave a look on them next week and let you know if I need your workspace...
Comment 9 Frederic Fusier CLA 2004-11-09 11:04:40 EST
OK, I got it looking for declaration of clone() using rt.jar 1.5.
Thanks Markus for your efficient help on this :-)
Comment 10 Frederic Fusier CLA 2004-11-09 11:58:14 EST
Here a simple scenario to reproduce this problem:
1) Open a workspace using Sun JRE 1.5.0
2) Set workspace default VM to 1.5.0
3) Create new project and create following class:
    X.java:
	public class X {
		Object foo() throws CloneNotSupportedException {
			return this.clone();
		}
	}
4) select clone method in statement: return this.clone();
5) Search for declaration of this method in Workspace

Then, you get Java Search error dialog:
An internal error occured during: "Java Search".
Comment 11 Frederic Fusier CLA 2004-11-09 16:26:53 EST
Fixed.

It seems that some class file has a source file name without ".java" extension.
Protect qualified name construction from this...

[jdt-core-internal]
Changes done in PossibleMatch#getQualifiedname()
No test case added, just verify that no error occurs while executing comment 10
scenario...
Comment 12 Frederic Fusier CLA 2004-11-12 06:54:15 EST
*** Bug 78452 has been marked as a duplicate of this bug. ***
Comment 13 Frederic Fusier CLA 2004-12-02 06:46:06 EST
*** Bug 79975 has been marked as a duplicate of this bug. ***
Comment 14 Olivier Thomann CLA 2004-12-14 15:24:33 EST
Verified in 200412140800
Comment 15 Frederic Fusier CLA 2004-12-29 05:36:32 EST
*** Bug 81916 has been marked as a duplicate of this bug. ***
Comment 16 Frederic Fusier CLA 2006-04-14 03:20:36 EDT
*** Bug 136710 has been marked as a duplicate of this bug. ***