Community
Participate
Working Groups
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.
Which version of Eclipse does this happen on?
3.1M5a. I'm going to download 3.1M6 today, rebuild & reinstal AJDT and add a let you know if it happens again.
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.
Sure. I'd be happy to give it a spin when it's ready.
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.
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.
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.
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.
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 ***