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 227677 - javax.swing.text.BadLocationException: Wrong insert position 30586
Summary: javax.swing.text.BadLocationException: Wrong insert position 30586
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Blocks: 183970 213179
  Show dependency tree
Reported: 2013-03-19 20:06 UTC by misterm
Modified: 2019-01-14 08:17 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 195366

stacktrace (1.96 KB, text/plain)
2013-03-19 20:06 UTC, misterm

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2013-03-19 20:06:53 UTC
Build: NetBeans IDE Dev (Build 20130312-3de7f424e7a8)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.3-b01, Java(TM) SE Runtime Environment, 1.7.0_07-b11
OS: Windows 7

User Comments:
GUEST: refactoring a package name, where the package contains multiple java classes and the project contains multiple packages.

GUEST: refactoring a class name over some 80 classes

GUEST: Clicked on create method hint. Target source code probably had other compile errors as was in the middle of refactoring.

GUEST: Refactoring class name

GUEST: Rename(refractor) class

Nanocom: Refactoring a method name

GUEST: Refactoring Class name

javax.swing.text.BadLocationException: Wrong insert position 30586
   at org.netbeans.editor.BaseDocument.handleInsertString(
   at org.netbeans.editor.BaseDocument$FilterBypassImpl.insertString(
   at javax.swing.text.DocumentFilter.insertString(
   at org.openide.text.CloneableEditorSupport$DocFilter.insertString(
   at org.netbeans.editor.BaseDocument.insertString(
Comment 1 misterm 2013-03-19 20:06:56 UTC
Created attachment 132802 [details]
Comment 2 Svata Dedic 2013-07-25 11:12:48 UTC
Note the blocked issues, their stack traces are similar to this (minus refactoring)
Comment 3 Svata Dedic 2013-07-26 15:54:17 UTC
Sadly I am not able to reproduce the defect live. I don't think that the various diffs or code generator produces invalid offsets. There are LOG messages at various places, which should report invalid offsets, but such reports are not present in the posted log files.

Currently the most probably hypothesis says that the document is modified in between the parse and commit() on the Modification result. I've added test that produces a similar defect. I've also added an additional log, which prints a message when a position is created outside the document content - such an attempt does not fail, but produces an invalid/unusable PositionRef == doc.getEndPosition()

I'm temporarily closing the defect as INCOMPLETE; if reopened, or filed by a newer exception, we can see if the hypothesis was correct.

Logs & test added in rev
Comment 4 Quality Engineering 2013-07-29 01:58:43 UTC
Integrated into 'main-silver', will be available in build *201307282300* on (upload may still be in progress)

User: Svata Dedic <>
Log: #227677: added logging + sanity checks
Comment 5 Maksim Khramov 2017-01-10 11:21:49 UTC
Reopening this bug based on new exception report:
Comment 6 StormFiber 2019-01-14 08:17:48 UTC
(In reply to Quality Engineering from comment #4)
> Integrated into 'main-silver', will be available in build *201307282300* on
> (upload may still be in progress)
> Changeset:
> User: Svata Dedic <>
> Log: #227677: added logging + sanity checks

The possible slowdown decreased multiple times after fixing of issue 248243 (Remote file system goes into directories it should not) and issue 251007 (Remote FS hangs for 5 minites on /ws/emu-patch if /ws/...)