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 145319 - javax.swing.text.BadLocationException: end=16439 > length()=928
Summary: javax.swing.text.BadLocationException: end=16439 > length()=928
Status: RESOLVED WORKSFORME
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Milutin Kristofic
URL: http://statistics.netbeans.org/except...
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2008-08-27 15:56 UTC by Petr Dvorak
Modified: 2011-09-01 14:11 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 8429


Attachments
stacktrace (1.79 KB, text/plain)
2009-03-26 23:45 UTC, esmithbss
Details
stacktrace (1.79 KB, text/plain)
2009-03-26 23:46 UTC, esmithbss
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2008-08-27 15:56:47 UTC
Build: NetBeans IDE Dev (Build 200710181200)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Linux, 2.6.22-14-386, i386

User comments: I tried to search for a string using F3 key, just after I edited post-init code for a JPanel.

STACKTRACE: (first 10 lines)
avax.swing.text.BadLocationException: end=35624 > length()=4741
        at org.netbeans.lib.editor.util.swing.DocumentUtilities.getText(DocumentUtilities.java:328)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceImpl(DocumentFinder.java:232)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceResult(DocumentFinder.java:312)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findReplaceInBlock(EditorFindSupport.java:589)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findReplaceImpl(EditorFindSupport.java:518)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.find(EditorFindSupport.java:563)
        at org.netbeans.editor.ActionFactory$FindNextAction.actionPerformed(ActionFactory.java:1061)
        at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:291)
        at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1571)
        at javax.swing.JComponent.processKeyBinding(JComponent.java:2772)
        at javax.swing.JComponent.processKeyBindings(JComponent.java:2807)
Comment 1 Vitezslav Stejskal 2008-08-28 14:37:58 UTC
Is this reproducible? I tried in my dev build and it seemed to work. Actually where exactly did you do the search - in
the file editor or in the post-init code editor?
Comment 2 Petr Dvorak 2008-08-28 15:01:51 UTC
I searched in the file editor, I should have said that. Unfortunately, I did not manage to reproduce the issue.

I know it wont probably help too much, but what I basically did: Property editor for border generates an incorrect code
for "Matte" border (it is known form issue 145316). So I created a new form, searched for the incorrect code (I used the
"Matte" for the search), I copied that incorrect line of code, corrected it (fix was simple, just semicolon placed
behind "//NOI18N" comment, not behind the method call) and I placed the code in the post-init code (I did it in the
customizer you see when you click "..." in the Code tab). Resulting codes were the same except for the semicolons
position... Then I pressed F3 (I assume there was "Matte" from the previous search that I performed in the incorrectly
generated code in previous form) and this exception was thrown.
Comment 3 Vitezslav Stejskal 2008-08-29 14:32:12 UTC
Ok, thanks.
Comment 4 _ gtzabari 2008-12-09 18:27:35 UTC
I just got this exception when I did the following:

1) Searched in one file
2) Opened another file
3) Hit F3, exception was thrown

I suspect the code is retaining state from the old file.
Comment 5 esmithbss 2009-03-26 23:45:13 UTC
Build: NetBeans IDE Dev (Build 200903250219)
VM: Java HotSpot(TM) Client VM, 11.2-b01, Java(TM) SE Runtime Environment, 1.6.0_12-b04
OS: Linux, 2.6.27-14-generic, i386

User Comments: 
Changing field values within a Find/Replace dialog.  I accidentally pressed a | and a }  when I we to press the backspace key	

Stacktrace: 
javax.swing.text.BadLocationException: end=2685 > length()=2684
        at org.netbeans.lib.editor.util.swing.DocumentUtilities.getText(DocumentUtilities.java:333)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceImpl(DocumentFinder.java:232)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceResult(DocumentFinder.java:312)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findReplaceInBlock(EditorFindSupport.java:596)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findInBlock(EditorFindSupport.java:660)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.incSearch(EditorFindSupport.java:375)
Comment 6 esmithbss 2009-03-26 23:45:17 UTC
Created attachment 78948 [details]
stacktrace
Comment 7 esmithbss 2009-03-26 23:46:12 UTC
Build: NetBeans IDE Dev (Build 200903250219)
VM: Java HotSpot(TM) Client VM, 11.2-b01, Java(TM) SE Runtime Environment, 1.6.0_12-b04
OS: Linux, 2.6.27-14-generic, i386

User Comments: 
Caused by pressing | and backspace while find/replace dialog is active.

Stacktrace: 
javax.swing.text.BadLocationException: end=2684 > length()=2663
        at org.netbeans.lib.editor.util.swing.DocumentUtilities.getText(DocumentUtilities.java:333)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceImpl(DocumentFinder.java:232)
        at org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceResult(DocumentFinder.java:312)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findReplaceInBlock(EditorFindSupport.java:596)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.findInBlock(EditorFindSupport.java:660)
        at org.netbeans.modules.editor.lib2.search.EditorFindSupport.incSearch(EditorFindSupport.java:375)
Comment 8 esmithbss 2009-03-26 23:46:15 UTC
Created attachment 78949 [details]
stacktrace
Comment 9 Vitezslav Stejskal 2009-03-30 15:36:13 UTC
I improved the exceptions logging - b83475176631
Comment 10 Jiri Prox 2011-09-01 14:11:13 UTC
From the log of exception reporter it looks like this issue does not happen any more. Last report is from 2009