Bug 58196 - StringIndexOutOfBoundsException when searching for method
Summary: StringIndexOutOfBoundsException when searching for method
Status: RESOLVED DUPLICATE of bug 67600
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 RC3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 53052 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-12 16:17 EDT by Stanley Shiah CLA
Modified: 2004-06-17 07:45 EDT (History)
3 users (show)

See Also:


Attachments
Test case (3.83 KB, application/octet-stream)
2004-04-12 22:03 EDT, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stanley Shiah CLA 2004-04-12 16:17:12 EDT
This bug related (if not causing) bugzilla 53052.

Steps to reproduce:
-------------------
1. Start Eclipse in a new workspace.
2. Create a new Java project.
3. Create the three java files (in the appropriate package) described in 
bugzilla 53052.
4. Click Search -> Search.
5. Select "Java Search", then enter:
   Search string: "run()" (no quotes)
   Search for: method
   Limit to: Declarations
   Scope: workspace
   ... then click the Search button.

An error window appears, with title "Error Running Jobs". The body of the 
window says: "ERROR: Search for Declarations: An internal error occurred 
during: "Search for Declarations"."

This is the contents of the .log file...

!SESSION Apr 12, 2004 16:01:03.719 ---------------------------------------------
java.fullversion=J2RE 1.4.2 IBM Windows 32 build cndev-20040322 (JIT enabled: 
jitc)
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
!ENTRY org.eclipse.core.runtime 4 2 Apr 12, 2004 16:01:03.766
!MESSAGE An internal error occurred during: "Search for Declarations".
!STACK 0
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java(Compiled Code))
	at org.eclipse.jdt.internal.core.SourceMapper.findSourceFileName
(SourceMapper.java:862)
	at 
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getSourceFileName
(PossibleMatch.java:123)
	at 
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getQualifiedName
(PossibleMatch.java:98)
	at org.eclipse.jdt.internal.core.search.matching.PossibleMatch.<init>
(PossibleMatch.java(Inlined Compiled Code))
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches
(JavaSearchParticipant.java(Compiled Code))
	at 
org.eclipse.jdt.internal.core.search.pattern.InternalSearchPattern.findMatches
(InternalSearchPattern.java(Compiled Code))
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:739)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:707)
	at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run
(JavaSearchQuery.java:114)
	at 
org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run
(InternalSearchUI.java:68)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62)
Comment 1 Stanley Shiah CLA 2004-04-12 16:25:48 EDT
*** Bug 53052 has been marked as a duplicate of this bug. ***
Comment 2 Olivier Thomann CLA 2004-04-12 22:03:46 EDT
Created attachment 9407 [details]
Test case

I tried to reproduce using latest integration build without success.
Could you please try to reproduce using the attached test case?

If you can reproduce, please specify your Eclipse build.

Thanks.
Comment 3 Stanley Shiah CLA 2004-04-13 08:56:26 EDT
I just reproduced the problem with the attached test case, using the 
20040331_1308 WSWB 3.0M8 build (Hyades is broken when used with Eclipse M9).

I did a little more digging, and it appears that this problem *is* in the 3.0 
M8 stable build, but is *not* in the I20040407 M9 build. I can only guess that 
someone has already fixed this problem in another bug...

In light of this, I think we should wait until Hyades works with M9, and will 
try again.

Thanks in advance.
Comment 4 Jerome Lanneluc CLA 2004-05-12 07:56:11 EDT
Closing for now. Please reopen if you can reproduce.
Comment 5 Pat McCarthy CLA 2004-06-16 14:50:03 EDT
I'm getting the same on RC2.
Comment 6 Pat McCarthy CLA 2004-06-16 14:51:32 EDT
Was about to open new bug.  This will not let me click reopen. (Not my 
creation?)

Like the technique to find based on return type (Enter "* String", select 
method and definition).

Tried it today to see if I could find return values of String[], but it 
failed. Reproduced several times but was in my target eclipse.  Reproduced in 
base RC2 eclipse without the array portion.  

Search did find the hit, was looking for and answer of getDefault() where this 
was the method for a specific plugin and the return value was that plugin 
class.  But search also failed, just as it did in my target system test as 
well.

Seems to fail anytime I use the Hints/Tips documented technique for finding a 
method by return type.

An internal error occurred during: "Java Search".
java.lang.StringIndexOutOfBoundsException
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.String.substring(String.java)
	at org.eclipse.jdt.internal.core.SourceMapper.findSourceFileName
(SourceMapper.java)
	at 
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getSourceFileName
(PossibleMatch.java)
	at 
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getQualifiedName
(PossibleMatch.java)
	at org.eclipse.jdt.internal.core.search.matching.PossibleMatch.<init>
(PossibleMatch.java)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:855)
	at 
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches
(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.core.search.SearchEngine.findMatches
(SearchEngine.java:468)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:757)
	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 7 Jerome Lanneluc CLA 2004-06-17 05:31:01 EDT
Reopening to investigate.
Comment 8 Jerome Lanneluc CLA 2004-06-17 05:32:06 EDT
I suspect that the condition to get this problem depends on the JRE that is on 
the build path. Can you please indicate which JRE is on the build path and its 
version ?
Comment 9 Jerome Lanneluc CLA 2004-06-17 06:00:27 EDT

*** This bug has been marked as a duplicate of 67600 ***
Comment 10 Pat McCarthy CLA 2004-06-17 07:40:23 EDT
JRE Info
java.assistive=ON
java.awt.fonts=
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.path=E:\Eclipse-3.0\RC2\eclipse\startup.jar
java.class.version=48.0
java.compiler=j9jit21
java.ext.dirs=e:\eclipse-3.0\jre\lib\ext
java.fullversion=J2RE 1.4.2 IBM J9 build 20040519 (JIT enabled)
java.home=e:\eclipse-3.0\jre
java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
java.library.path=e:\eclipse-3.0\jre\bin;.;e:\eclipse-3.0\jre\bin;C:\PROGRAM 
FILES\THINKPAD\UTILITIES;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32
\Wbem;C:\Program Files\IBM\Infoprint Select;C:\Utilities;C:\Program 
Files\IBM\Personal Communications\;C:\Program Files\IBM\Trace 
Facility\;C:\Notes;C:\Infoprint;
java.runtime.name=J9 - VM for the Java(TM) platform
java.runtime.version=2.1
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.4
java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory
java.vendor=IBM Corporation
java.vendor.url=http://www.ibm.com/
java.version=1.4.2
java.vm.info=J2RE 1.4.2 IBM J9 build 20040519 (JIT enabled)
java.vm.name=IBM J9SE VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=IBM Corporation
java.vm.version=2.1
jxe.current.romimage.version=6
jxe.lowest.romimage.version=6
line.separator=
Comment 11 Jerome Lanneluc CLA 2004-06-17 07:45:25 EDT
Thanks. So this is the same problem as bug 67600.