This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
This exception is reported frequently in the course of using the IDE. I do not see a particular pattern to when it comes up, although I am sure there is one. Here is a stack trace: Annotation: Parser error java.lang.StringIndexOutOfBoundsException: String index out of range: 34625 at java.lang.String.<init>(String.java:197) at java.lang.String.copyValueOf(String.java:2233) at org.netbeans.modules.java.gj.V8TreeTranslator.getString(V8TreeTranslator.java:136) at org.netbeans.modules.java.gj.V8TreeTranslator._case(V8TreeTranslator.java:491) at org.netbeans.lib.javac.v8.tree.Tree$VarDef.visit(Tree.java:493) at org.netbeans.modules.java.gj.V8TreeTranslator._case(V8TreeTranslator.java:303) at org.netbeans.lib.javac.v8.tree.Tree$ClassDef.visit(Tree.java:407) at org.netbeans.modules.java.gj.V8TreeTranslator._case(V8TreeTranslator.java:188) at org.netbeans.lib.javac.v8.tree.Tree$TopLevel.visit(Tree.java:344) at org.netbeans.modules.java.gj.V8TreeTranslator.process(V8TreeTranslator.java:94) at org.netbeans.modules.java.gj.ParserEngine.completeRequest(ParserEngine.java:353) at org.netbeans.modules.java.gj.ParserEngine.parseObject(ParserEngine.java:176) at org.netbeans.modules.java.gj.JavaParserEngine.process(JavaParserEngine.java:72) at org.netbeans.modules.java.parser.ParsingSupport$Processor.process(ParsingSupport.java:704) at org.netbeans.modules.java.parser.ParsingSupport$Processor.parseLockModel(ParsingSupport.java:659) at org.netbeans.modules.java.parser.ParsingSupport$Processor.run(ParsingSupport.java:590) at org.openide.util.Task.run(Task.java:136) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:599) ==>
Mounting either the source directory or the jar for ANTLR 2.7.1 causes endless string index exceptions from the java parser, rendering the use of the ANTLR package impossible (for me). I guess this is some kind of problem with parser related code, because the ANTLR 2.7.1 source compiles fine.
Please verify that all lines in the package are < 2048 characters long; javac' parser we use has this limitation (it packs line:column pair into a long value).
I too get a very similar parsing error (my index is -32 though) - If I disable "annotate errors" by setting the limit to 0, the problem goes away (of course, then the error annotation is disabled) It only happens with certain files, but with them it happens all the time. When it does, I have to close the editor window as it appears to be in an infinite loop. There does not appear to be anything wrong with the source file - a rather simple ejb - I can send the source along if that would help debug/fix this problem. Excerpt from ide.log: System Info: Product Version = NetBeans IDE 3.4.1 IDE Versioning = IDE/1 spec=2.23.2 impl=200301202341 Operating System = Windows XP version 5.1 running on x86 Java; VM; Vendor = 1.3.1_06; Java HotSpot(TM) Client VM 1.3.1_06-b01; Sun Microsystems Inc. Java Home = C:\_System\jdk1.3.1\jre System Locale; Encod. = en_US; Cp1252 Home Dir; Current Dir = C:\Documents and Settings\Ken; .... *********** Exception occurred ************ at Fri Feb 14 10:14:17 EST 2003 Annotation: Parser error java.lang.StringIndexOutOfBoundsException: String index out of range: -32 at java.lang.String.<init>(String.java:241) at java.lang.String.copyValueOf(String.java:1999) at org.netbeans.modules.java.parser.DocumentModelBuilder.setB odyBounds(DocumentModelBuilder.java:105) at org.netbeans.modules.java.gj.V8TreeTranslator._case (V8TreeTranslator.java:437) at org.netbeans.lib.javac.v8.tree.Tree$MethodDef.visit (Tree.java:460) at org.netbeans.modules.java.gj.V8TreeTranslator._case (V8TreeTranslator.java:303) at org.netbeans.lib.javac.v8.tree.Tree$ClassDef.visit (Tree.java:407) at org.netbeans.modules.java.gj.V8TreeTranslator._case (V8TreeTranslator.java:188) at org.netbeans.lib.javac.v8.tree.Tree$TopLevel.visit (Tree.java:344) at org.netbeans.modules.java.gj.V8TreeTranslator.process (V8TreeTranslator.java:94) at org.netbeans.modules.java.gj.ParserEngine.completeRequest (ParserEngine.java:353) at org.netbeans.modules.java.gj.ParserEngine.parseObject (ParserEngine.java:176) at org.netbeans.modules.java.gj.JavaParserEngine.process (JavaParserEngine.java:72) at org.netbeans.modules.java.parser.ParsingSupport$Processor. process(ParsingSupport.java:704) at org.netbeans.modules.java.parser.ParsingSupport$Processor. parseLockModel(ParsingSupport.java:659) [catch] at org.netbeans.modules.java.parser.ParsingSupport$Processor. run(ParsingSupport.java:590) at org.openide.util.Task.run(Task.java:136) at org.openide.util.RequestProcessor$Processor.run (RequestProcessor.java:599) ==> WARNING - ErrorManager detected cyclic exception nesting: java.lang.StringIndexOutOfBoundsException: String index out of range: -32 Be sure not to annotate an exception with itself, directly or indirectly.
Ah, I found a line in the source that WAS larger then 2048 - wrapped that one, and the problem is now gone ...
Ok, so this issue is duplicate of issue #18582 *** This issue has been marked as a duplicate of 18582 ***