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 258271

Summary: javax.swing.text.BadLocationException: Invalid offset=-1 < 0; docLen=20091
Product: editor Reporter: legitalk
Component: CSL (API & infrastructure)Assignee: Milutin Kristofic <mkristofic>
Status: RESOLVED FIXED    
Severity: normal CC: legitalk, marfous
Priority: P1    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 220654
Attachments: stacktrace
stacktrace

Description legitalk 2016-03-07 12:23:40 UTC
Build: NetBeans IDE Dev (Build 201602290002)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.60-b23, Java(TM) SE Runtime Environment, 1.8.0_60-b27
OS: Windows 7

User Comments:
GUEST: PHP Format Code

legitalk: Just editing code.

legitalk: Writing PHP.

GUEST: Same old shit - scanning forever

GUEST: Nothing to add

GUEST: editando arquivos

GUEST: This error showed up while I was reporting an error

GUEST: i have no idea




Stacktrace: 
javax.swing.text.BadLocationException: Invalid offset=-1 < 0; docLen=20091
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.checkOffsetNonNegative(EditorDocumentContent.java:271)
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.checkBoundsInContent(EditorDocumentContent.java:307)
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.getChars(EditorDocumentContent.java:231)
   at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:810)
   at org.netbeans.editor.DocumentUtilities.copyText(DocumentUtilities.java:97)
   at org.netbeans.editor.BaseDocument.getChars(BaseDocument.java:1169)
Comment 1 legitalk 2016-03-07 12:23:42 UTC
Created attachment 158765 [details]
stacktrace
Comment 2 Exceptions Reporter 2016-04-06 15:35:39 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=220654
Comment 3 Martin Fousek 2016-08-03 14:37:21 UTC
Created attachment 161550 [details]
stacktrace

Closed all documents in the IDE
Comment 4 Miloslav Metelka 2016-08-15 14:59:01 UTC
IMHO GsfCompletionProvider.java:722 can be reached with caretOffset == -1 since JavaCompletionQuery(int queryType, int caretOffset) constructor is has usages that pass -1.
Comment 5 Milutin Kristofic 2016-08-22 11:52:34 UTC
Thank you Mila, I added one more condition. http://hg.netbeans.org/jet-main/rev/d7dc808bbf21
Comment 6 Quality Engineering 2016-08-27 02:19:04 UTC
Integrated into 'main-silver', will be available in build *201608270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d7dc808bbf21
User: Milutin Kristofic <mkristofic@netbeans.org>
Log: #258271 - javax.swing.text.BadLocationException: Invalid offset=-1 < 0; docLen=20091