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.
When using CC to supply an element which is not yet imported, following SIOOBE is thrown: java.lang.StringIndexOutOfBoundsException: String index out of range: 7229 at java.lang.String.substring(String.java:1935) at org.netbeans.modules.java.source.save.CasualDiff.copyTo(CasualDiff.java:2680) at org.netbeans.modules.java.source.save.CasualDiff.diffList(CasualDiff.java:1873) at org.netbeans.modules.java.source.save.CasualDiff.diffTopLevel(CasualDiff.java:178) at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:2252) ... (whole stack trace attached) Stesp to reproduce: ------------------- 1) Open a java class, which already has some import statements, ie. >5 2) Inside of a method, type new IOE| //pipe stands for carret, IOE should not be imported yet 3) Press Ctrl-Space twice in order to bring up all-CC 4) Choose IOExcetion and press enter => SIOOBE This issue seems to be RANDOM, but I can reproduce it fairly often. --- NetBeans IDE Dev (Build 070314) 1.6.0_01; Java HotSpot(TM) Server VM 1.6.0_01-b04 Linux version 2.6.12-1.1390_FC4smp running on i386 en_US (nb); UTF-8
Created attachment 39461 [details] SIOOBE stack trace
I have tried to reproduce it but was unsuccessful. Not sure what causes it, was the source somehow broken or not? -- In provided information, I see your source where it occurred is pretty long. Did you have one or more top level classes?
I can reproduce it too. My steps to reproduce: 1) have a class ( | shows cursor position): package javaapplication4; public class NewClass { public void aaaa() { try { throw new java.net.ConnectException("Error"); } catch (| } } 2) call CC 3) select 1st item - ConnectException -> import is added -> sometimes (about 25%) mentioned exception is thrown
Even worse than we expected. It looks like modification task does not see last state of source, but token sequence has been already updated. Cc'ing others helping with the cause.
*** Issue 99333 has been marked as a duplicate of this issue. ***
The issue has two parts. Both has to be fixed. The first: race condition in the JavaSource The second: TokenSequuence is built from document without snap shot, mybe it should be built always from char buffer, but it slows down the IDE. Or the priority of snap shots should be reevaluated.
*** Issue 93022 has been marked as a duplicate of this issue. ***
I think the problem is bigger than observed exception. P3 -> P2 Cc'ing other reporters.
I have fix of the race condition. I will test it and integrate.
*** Issue 99613 has been marked as a duplicate of this issue. ***
Checking in JavaSource.java; /cvs/java/source/src/org/netbeans/api/java/source/JavaSource.java,v <-- JavaSource.java new revision: 1.34; previous revision: 1.33 done
I cannot reproduce this anymore. Marking as VERIFIED. --- NetBeans IDE Dev (Build 070403) 1.6.0_01; Java HotSpot(TM) Server VM 1.6.0_01-b04 Linux version 2.6.12-1.1390_FC4smp running on i386 en_US (nb); UTF-8
I have tried it in old build (where it was mostly reproducible) and after the fix in current build and cannot reproduce too.