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.
Often got the following exception: javax.swing.text.BadLocationException: reqPos=2634, reqLen=-2379, doc.getLength()=2643 at org.netbeans.editor.LineRootElement.prepareSyntax(LineRootElement.java:203) at org.netbeans.editor.BaseDocument.prepareSyntax(BaseDocument.java:1251) at org.netbeans.editor.SyntaxSupport.tokenizeText(SyntaxSupport.java:363) at org.netbeans.modules.editor.java.NbJavaFoldMaintainer.updateFoldsForClass(NbJavaFoldMaintainer.java:391) at org.netbeans.modules.editor.java.NbJavaFoldMaintainer.updateFolds(NbJavaFoldMaintainer.java:623) at org.netbeans.modules.editor.java.NbJavaFoldMaintainer.initFolds(NbJavaFoldMaintainer.java:153) at org.netbeans.editor.fold.spi.FoldHierarchySpi.rebuildMaintainers(FoldHierarchySpi.java:673) at org.netbeans.editor.fold.spi.FoldHierarchySpi.rebuild(FoldHierarchySpi.java:606) at org.netbeans.editor.fold.spi.FoldHierarchySpi$1.propertyChange(FoldHierarchySpi.java:719) ... In NbJavaFoldMaintainer.java, Ln#383: int startOffset = elem.getStartOffset(); Ln#384: int endOffset = elem.getEndOffset(); startOffset = reqPos = 2634 endOffset = 255 that caused reqLen = -2379. I guess "2634" is for the full doc, and "255" is for the collapsed doc. Is it some kind of sync. problem (race condition) And sometimes we also got the following exceptions, maybe from the same reason: java.lang.IndexOutOfBoundsException: Invalid line index=92 >= lineCount=92 at org.netbeans.editor.LineRootElement.getElement(LineRootElement.java:54) at org.openide.text.NbDocument$DocumentRenderer.run(NbDocument.java:631) at org.netbeans.editor.BaseDocument.render(BaseDocument.java:883) at org.openide.text.NbDocument$DocumentRenderer.renderToInt(NbDocument.java:609) at org.openide.text.NbDocument.findLineOffset(NbDocument.java:142) at org.openide.text.DocumentLine$Set.getCurrent(DocumentLine.java:904) ... Po-Ting
The first part of the problem should be fixed by the fix of issue 42504 (already backported into custom_folds). Could you please provide a full stacktrace of the second problem? I would like to know from where the org.openide.text.DocumentLine$Set.getCurrent(DocumentLine.java:904) gets called because the DocumentLine.Set.getCurrent() is declared to throw the exception in case the given line is invalid so the caller should be aware of that. Thanks.
No info provided thus closing. Please reopen if the problem persists.