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 63320 - javax.swing.text.BadLocationException while undoing hint Surround with try-catch
Summary: javax.swing.text.BadLocationException while undoing hint Surround with try-catch
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-30 13:50 UTC by Max Sauer
Modified: 2007-11-05 13:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exc. stack trace (1.02 KB, text/plain)
2005-08-30 13:52 UTC, Max Sauer
Details
test file (555 bytes, text/plain)
2005-08-30 13:53 UTC, Max Sauer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max Sauer 2005-08-30 13:50:18 UTC
In some cases, undoing of hint "Surround with try - catch" may lead to following
exception:

javax.swing.text.BadLocationException: Invalid offset=700 not within <0, 555>
        at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1227)
        at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1222)
        at org.netbeans.editor.Utilities.getRowStart(Utilities.java:126)
...
(whole stack trace added)

Steps to reproduce:
-------------------
1) In attached Surround.java file, goto line 28.
2) Invoke the "Surround with try-catch" hint.
3) Invoke Undo (Ctrl-Z)
--> exception is typed inside console.

I'm not sure if it belongs here, please reasign to editor if otherwise.

[200508291800, JDK 1.5.0_05 b03, solaris 10/ sparc]
Comment 1 Max Sauer 2005-08-30 13:52:37 UTC
Created attachment 24353 [details]
exc. stack trace
Comment 2 Max Sauer 2005-08-30 13:53:09 UTC
Created attachment 24354 [details]
test file
Comment 3 janicki 2005-10-06 21:21:43 UTC
I got the same exception (more or less, see below) when starting up the IDE, which preloaded my 
previous working tabs in the source editor.  After closing a few source file tabs (using the little 'x' on 
the tabs), the exception dialog popped up.  I may have clicked within the source editor panel right 
before it occurred... can't remember.

javax.swing.text.BadLocationException: Invalid offset=6507 not within <0, 1>
    at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1227)
    at org.netbeans.editor.Utilities.getLineOffset(Utilities.java:552)
    at org.netbeans.modules.j2ee.ejbcore.hints.EjbHintsProvider.getHints(EjbHintsProvider.java:56)
    at org.netbeans.modules.editor.hints.HintsOperator$HintPopupTaskImpl.run(HintsOperator.java:233)
    at org.openide.util.Task.run(Task.java:207)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:469)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:870)
Comment 4 Martin Roskanin 2005-10-07 11:18:02 UTC
this exc is little bit different:
javax.swing.text.BadLocationException: Invalid offset=700 not within <0, 555>
        at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1227)
        at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1222)
        at org.netbeans.editor.Utilities.getRowStart(Utilities.java:126)
        at org.netbeans.editor.BaseDocument.processText(BaseDocument.java:497)
        at
org.netbeans.editor.ext.java.JavaSyntaxSupport.getLastCommandSeparator(JavaSyntaxSupport.java:146)
        at
org.netbeans.editor.ext.java.JavaCompletionQuery.tipQuery(JavaCompletionQuery.java:166)

Exception you mentioned was already fixed in issue #64283
Comment 5 Dusan Balek 2005-11-08 10:38:16 UTC
Fixing the last exception.

Checking in lib/src/org/netbeans/editor/ext/java/JavaCompletionQuery.java;
/cvs/java/editor/lib/src/org/netbeans/editor/ext/java/JavaCompletionQuery.java,v
 <--  JavaCompletionQuery.java
new revision: 1.10; previous revision: 1.9
done
Comment 6 Max Sauer 2005-12-05 16:55:04 UTC
I haven't seen this for a long time, marking as verified. [200512041900]