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.
dev build 200212060100 I opened a file and get the following exception (looks like you're not anticipating an indexOf() returning -1). Annotation: Parser error java.lang.StringIndexOutOfBoundsException: String index out of range: -2148 at java.lang.String.<init>(String.java(Compiled Code)) at java.lang.String.copyValueOf(String.java:2523) 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(Compiled Code)) 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:709) at org.netbeans.modules.java.parser.ParsingSupport$Processor.parseLockModel(ParsingSupport.java:664) at org.netbeans.modules.java.parser.ParsingSupport$Processor.run(ParsingSupport.java:595) at org.openide.util.Task.run(Task.java(Compiled Code)) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:629) ==> Annotation: Parser error java.lang.StringIndexOutOfBoundsException: String index out of range: -2148 at java.lang.String.<init>(String.java(Compiled Code)) at java.lang.String.copyValueOf(String.java:2523) 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(Compiled Code)) 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:709) at org.netbeans.modules.java.parser.ParsingSupport$Processor.parseLockModel(ParsingSupport.java:664) at org.netbeans.modules.java.parser.ParsingSupport$Processor.run(ParsingSupport.java:595) at org.openide.util.Task.run(Task.java(Compiled Code)) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:629) ==>
I cannot reproduce this problem. I guess I will need your file to reproduce it. BTW: How did you come to the conclusion that we are not anticipating an indexOf() returning -1? I don't see indexOf() or -1 in stack trace.
Regarding guessing you're getting indexOf() returning -1, I have run into similar StringIndexOutOfBoundsExceptions before and 99% of the time it is the result of me doing: text.substring(beginning, ending) where either beginning or ending is -1 that came from an indexOf(). Do you see anything of the sort (indexOf or subString) around the point of failure?
Gili, could you please attach the source code that was opened in the editor when the bug happened ? If it happened after you expanded some file node in the Explorer tree, please send that source file.
Sorry, it's been too long since I opened this issue. I don't recall which file I was operating on. If you're unable to track down the problem without a source you can close it as unreproducable.
Hmm :-) the index is -2148 actually. I can think of two things: - there's some strange CRLF stuff like escape sequences in strings, or char literals (but I hope we have fixed these all) - very VERY long line, whose column index overflowed into line index. In this case, we cannot fix it - it's deep burried and scattered in javac sources. But it is nearly impossible to catch that error without the source, sorry.
Svatopuk, I will try helping you debug the problem but I need to look at the source code responsible for throwing this exception. I tried checking out the 'java' module but couldn't find the org.netbeans.modules.java.gj package.
That part is sadly closed-source, it is a bridge between javac library (which has a special license) and SPLed NetBeans code.
Ok, if I can't have direct access to the code, can you at least quote the body of the function the exception is being thrown from?