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 203591 - [71cat] javax.swing.text.BadLocationException: Invalid offset=-536864573 < 0; docLen=3352
Summary: [71cat] javax.swing.text.BadLocationException: Invalid offset=-536864573 < 0;...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-12 11:17 UTC by schkovich
Modified: 2012-09-20 02:24 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 180848


Attachments
stacktrace (1.68 KB, text/plain)
2011-10-12 11:18 UTC, schkovich
Details
stacktrace (1.67 KB, text/plain)
2012-08-14 08:27 UTC, ehsavoie
Details
stacktrace (1.67 KB, text/plain)
2012-08-14 08:30 UTC, ehsavoie
Details
stacktrace (1.67 KB, text/plain)
2012-08-14 08:48 UTC, ehsavoie
Details
stacktrace (1.66 KB, text/plain)
2012-09-14 13:59 UTC, Jiri Prox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description schkovich 2011-10-12 11:17:54 UTC
Build: NetBeans IDE Dev (Build 201110100600)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.1-b02, Java(TM) SE Runtime Environment, 1.6.0_26-b03
OS: Linux

User Comments:
gilbertoca: After previews crash I can't save the html file anymore.

schkovich: alt+shift+f on php file

GUEST: Editing a maven POM.XML




Stacktrace: 
javax.swing.text.BadLocationException: Invalid offset=-536864573 < 0; docLen=3352
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.checkOffsetNonNegative(EditorDocumentContent.java:245)
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.checkOffsetInContent(EditorDocumentContent.java:259)
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.createPosition(EditorDocumentContent.java:172)
   at org.netbeans.editor.BaseDocument.createPosition(BaseDocument.java:1377)
   at org.openide.text.NbDocument.createPosition(NbDocument.java:211)
   at org.netbeans.modules.editor.hints.AnnotationHolder.getPosition(AnnotationHolder.java:1052)
Comment 1 schkovich 2011-10-12 11:18:09 UTC
Created attachment 111930 [details]
stacktrace
Comment 2 Exceptions Reporter 2012-04-11 07:26:25 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=180848
Comment 3 ehsavoie 2012-08-14 08:27:48 UTC
Created attachment 123081 [details]
stacktrace
Comment 4 Exceptions Reporter 2012-08-14 08:27:52 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=180848
Comment 5 ehsavoie 2012-08-14 08:30:48 UTC
Created attachment 123082 [details]
stacktrace
Comment 6 ehsavoie 2012-08-14 08:48:47 UTC
Created attachment 123085 [details]
stacktrace
Comment 7 Jiri Prox 2012-09-14 13:59:14 UTC
Created attachment 124376 [details]
stacktrace

BLE when selecting method in editor
Comment 8 Jiri Prox 2012-09-14 14:02:04 UTC
This is very annoying issue, please fix it ASAP!

Steps to reproduce:

1) have a class:

public class ExampleClassRen {
    
    public static void main(String[] args) {
        
    }
    public void neco() {
        
    }
}

2) use shift-arrow to select two lines

-> exception is thrown
Comment 9 Jiri Prox 2012-09-14 14:12:34 UTC
Unfortunately after closing file and reopening the exception is not thrown any more
Comment 10 Miloslav Metelka 2012-09-19 13:05:22 UTC
Looks like the lineStart variable in AnnotationHolder.getPosition() may become -1 which should only be caused by having an invalid lineNumber variable out of bounds. But that should come from existing PositionBounds and the whole code should be properly read-locked so the only option would be that the PositionBounds would come from another document which is unlikely. I have added a logging and the fix attempts to choose either first or last line based on the given lineNumber.
http://hg.netbeans.org/jet-main/rev/6b800a476fc7
Comment 11 Quality Engineering 2012-09-20 02:24:26 UTC
Integrated into 'main-golden', will be available in build *201209200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6b800a476fc7
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #203591 - [71cat] javax.swing.text.BadLocationException: Invalid offset=-536864573 < 0; docLen=3352.