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 157706 - javax.swing.text.BadLocationException: Invalid offset=2823 not within <0, 2814>
Summary: javax.swing.text.BadLocationException: Invalid offset=2823 not within <0, 2814>
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Marek Fukala
URL: http://statistics.netbeans.org/except...
Keywords: RANDOM
: 169499 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-01-31 17:47 UTC by baffyofdaffy
Modified: 2009-09-18 22:28 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 11352


Attachments
stacktrace (714 bytes, text/plain)
2009-01-31 17:48 UTC, baffyofdaffy
Details
stacktrace (714 bytes, text/plain)
2009-05-04 18:41 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description baffyofdaffy 2009-01-31 17:47:54 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 1.5.0_06-b05, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_06-b05
OS: SunOS, 5.10, x86

User Comments:
pinheiro: Cutting and pasting some JSF code.

uncle_bosk: I was replacing text in a jsp file using the editor when this occured. I double clicked on a word to select it then did a paste ([Ctrl]+c) to paste in the replacement text. I had done this 7 times when on the 8th replacement this error occured.

uncle_bosk: I was using [Alt}+[Shift]+[Up] to move some text up one line.



Stacktrace: 
javax.swing.text.BadLocationException: Invalid offset=2823 not within <0, 2814>
        at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1348)
        at org.netbeans.editor.Utilities.getLineOffset(Utilities.java:614)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.isOneLineElement(JspFoldManager.java:524)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.updateFolds(JspFoldManager.java:307)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.access$100(JspFoldManager.java:48)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager$1$1.run(JspFoldManager.java:111)
Comment 1 baffyofdaffy 2009-01-31 17:48:00 UTC
Created attachment 76409 [details]
stacktrace
Comment 2 Marek Fukala 2009-03-13 16:05:20 UTC
Random issue. 

The cause is JspFoldManager.updateFolds() doesn't run under document readlock, just its part so such inconsistencies may
happen.

I do not want to fix this issue by locking the whole method since it will have a performance impact and moreover I plan
to migrate the whole jsp folding to CSL since we can get rid of 3/4 of the code and solve the locking problem this way.
Comment 3 Marek Fukala 2009-04-17 10:50:36 UTC
see my previous comment
Comment 4 Exceptions Reporter 2009-05-04 18:41:13 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Windows Vista, 6.0, x86

User Comments: 


Stacktrace: 
javax.swing.text.BadLocationException: Invalid offset=3842 not within <0, 3822>
        at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1348)
        at org.netbeans.editor.Utilities.getLineOffset(Utilities.java:614)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.isOneLineElement(JspFoldManager.java:524)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.updateFolds(JspFoldManager.java:307)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.access$100(JspFoldManager.java:48)
        at org.netbeans.modules.web.core.syntax.folding.JspFoldManager$1$1.run(JspFoldManager.java:111)
Comment 5 Exceptions Reporter 2009-05-04 18:41:17 UTC
Created attachment 81488 [details]
stacktrace
Comment 6 Marek Fukala 2009-09-08 16:19:28 UTC
*** Issue 169499 has been marked as a duplicate of this issue. ***
Comment 7 Marek Fukala 2009-09-08 16:34:22 UTC
I'll fix it by locking the document when updating the folds, the issue is not that rare as I thought... JSP editor to
CSL migration is not much closer than when I evaluated the issue for the first time ;-)
Comment 8 Exceptions Reporter 2009-09-15 10:09:31 UTC
This issue already has 21 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=11352
Comment 9 Marek Fukala 2009-09-16 10:07:33 UTC
fixed in web-main#f655a61f80ff
Comment 10 Quality Engineering 2009-09-18 22:28:59 UTC
Integrated into 'main-golden', will be available in build *200909181401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f655a61f80ff
User: Marek Fukala <mfukala@netbeans.org>
Log: #157706 - javax.swing.text.BadLocationException: Invalid offset=2823 not within <0, 2814>