Bug 89326 - String index of of range in JavaSearchNameEnvironment.<init>
Summary: String index of of range in JavaSearchNameEnvironment.<init>
Status: RESOLVED DUPLICATE of bug 98547
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-29 04:02 EST by Rafal Krzewski CLA
Modified: 2005-08-03 05:57 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 Rafal Krzewski CLA 2005-03-29 04:02:51 EST
Sometimes I am getting the following exception when I attempt to run JUnit tests
in my AJ-enabled project:

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.JavaSearchNameEnvironment.<init>(JavaSearchNameEnvironment.java:62)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.initialize(MatchLocator.java:820)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:841)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:928)
	at
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1045)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:196)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:382)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:512)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.searchMethod(TestSearchEngine.java:106)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.searchMethod(TestSearchEngine.java:97)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.searchSuiteMethods(TestSearchEngine.java:245)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.collectTypes(TestSearchEngine.java:182)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.doFindTests(TestSearchEngine.java:144)
	at
org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration.findTestsInContainer(JUnitBaseLaunchConfiguration.java:144)
	at
org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration.getTestTypes(JUnitBaseLaunchConfiguration.java:131)
	at
org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration.launch(JUnitBaseLaunchConfiguration.java:75)
	at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:590)
	at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:515)
	at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:795)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:993)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)

This prevents the test from starting. A workaround for that is restarting the
workbench.

I have also seen this similar error when using Refactor > Rename: The trace also
started with:

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.JavaSearchNameEnvironment.<init>(JavaSearchNameEnvironment.java:62)

Unfortunately I am not able to reliably reproduce this bug :-(

I am using local builds of AspectJ/AJDT CVS HEAD.
Comment 1 Matt Chapman CLA 2005-04-01 03:43:26 EST
Which version of Eclipse does this happen on?
Comment 2 Rafal Krzewski CLA 2005-04-04 03:02:54 EDT
3.1M5a. I'm going to download 3.1M6 today, rebuild & reinstal AJDT and add a let
you know if it happens again.
Comment 3 Matt Chapman CLA 2005-04-04 04:02:08 EDT
Rafal, I'd recommend holding off on the AJDT side of that for a day or two as
AJDT doesn't compile on M6 yet, because of the internal API we use. I've fixed
some of it, but have a fair bit more to do. I'll append here when it at least
compiles.
Comment 4 Rafal Krzewski CLA 2005-04-04 04:14:43 EDT
Sure. I'd be happy to give it a spin when it's ready.
Comment 5 Matt Chapman CLA 2005-04-05 13:09:00 EDT
Okay, CVS HEAD should now compile on 3.1M6. You need to install a "bootstrap"
version of AJDT first to build the sources with it, which is available here:
http://www.eclipse.org/downloads/download.php?file=/technology/ajdt/31/dev/update/ajdt_1.2.0.20050405164513_archive.zip
Known issues with the M6 support remain the AJ export wizards and launch
configurations. Let us know if this problem still happens, or you spot any other
problems.
Comment 6 Rafal Krzewski CLA 2005-04-06 09:14:53 EDT
I've compiled AspectJ and AJDT with 3.1M6 and got it running without any
apparent problems. I'll try working a bit on my toy project in the following
days and keep an eye on this issue.
Comment 7 Rafal Krzewski CLA 2005-04-07 04:48:53 EDT
It is still happening with 3.1M6 + CVS HEAD AJDT from yesterday (April 6th), but
the stacktrace is a bit different:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1768)
	at
org.eclipse.jdt.internal.core.util.Util.getNameWithoutJavaLikeExtension(Util.java:890)
	at
org.eclipse.jdt.internal.core.search.matching.PossibleMatch.getQualifiedName(PossibleMatch.java:101)
	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:1079)
	at
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:208)
	at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:394)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:532)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.searchMethod(TestSearchEngine.java:106)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.searchMethod(TestSearchEngine.java:97)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.searchSuiteMethods(TestSearchEngine.java:245)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.collectTypes(TestSearchEngine.java:182)
	at
org.eclipse.jdt.internal.junit.util.TestSearchEngine.doFindTests(TestSearchEngine.java:144)
	at
org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration.findTestsInContainer(JUnitBaseLaunchConfiguration.java:144)
	at
org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration.getTestTypes(JUnitBaseLaunchConfiguration.java:131)
	at
org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration.launch(JUnitBaseLaunchConfiguration.java:75)
	at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:590)
	at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:515)
	at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:731)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:929)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)

The tests lanucher worked after starting eclipse, failed after doing some
development, and then worked againg after restarting eclipse.
Comment 8 Sian January CLA 2005-04-07 06:01:17 EDT
The test failure you mentioned in comment 7 was fixed this morning (7th 
April).  I think this second exception was probably unrelated to the error you 
mentioned initially.
Comment 9 Sian January CLA 2005-08-03 05:57:19 EDT
Although the exception is slightly different I think this is probably a 
duplicate of 98547.

*** This bug has been marked as a duplicate of 98547 ***