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.

Bug 29389 - StringIndexOutOfBoundsException in org.netbeans.modules.java.gj.V8TreeTranslator.getString()
Summary: StringIndexOutOfBoundsException in org.netbeans.modules.java.gj.V8TreeTransla...
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC OS/2
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-08 17:49 UTC by _ gtzabari
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2002-12-08 17:49:32 UTC
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)
==>
Comment 1 Tomas Hurka 2002-12-09 10:11:57 UTC
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.
Comment 2 _ gtzabari 2002-12-09 14:37:27 UTC
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?
Comment 3 Svata Dedic 2003-01-08 12:18:10 UTC
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.
Comment 4 _ gtzabari 2003-01-08 14:41:17 UTC
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.
Comment 5 Svata Dedic 2003-01-14 14:17:25 UTC
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.
Comment 6 _ gtzabari 2003-01-14 16:21:42 UTC
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.
Comment 7 Svata Dedic 2003-01-14 16:30:11 UTC
That part is sadly closed-source, it is a bridge between javac library
(which has a special license) and SPLed NetBeans code.
Comment 8 _ gtzabari 2003-01-14 20:02:50 UTC
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?