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

Summary: javax.swing.text.BadLocationException: Wrong insert position 30586
Product: java Reporter: misterm <misterm>
Component: SourceAssignee: Svata Dedic <sdedic>
Status: REOPENED ---    
Severity: normal CC: co3njoy, jlahoda, Nanocom
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 195366
Bug Depends on:    
Bug Blocks: 183970, 213179    
Attachments: stacktrace

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




Stacktrace: 
javax.swing.text.BadLocationException: Wrong insert position 30586
   at org.netbeans.editor.BaseDocument.handleInsertString(BaseDocument.java:763)
   at org.netbeans.editor.BaseDocument$FilterBypassImpl.insertString(BaseDocument.java:2480)
   at javax.swing.text.DocumentFilter.insertString(DocumentFilter.java:100)
   at org.openide.text.CloneableEditorSupport$DocFilter.insertString(CloneableEditorSupport.java:3093)
   at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:747)
   at org.netbeans.api.java.source.ModificationResult.processDocumentLocked(ModificationResult.java:423)
Comment 1 misterm 2013-03-19 20:06:56 UTC
Created attachment 132802 [details]
stacktrace
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 org.netbeans.api.java.source.gen.ParallelModificationTest 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 http://hg.netbeans.org/jet-main/rev/7dfc0dabea7c
Comment 4 Quality Engineering 2013-07-29 01:58:43 UTC
Integrated into 'main-silver', will be available in build *201307282300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7dfc0dabea7c
User: Svata Dedic <sdedic@netbeans.org>
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: http://statistics.netbeans.org/exceptions/exception.do?id=839856
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
> https://whatstatus.co/whatsapp-status (upload may still be in progress)
> 
> Changeset: http://hg.netbeans.org/main-silver/rev/7dfc0dabea7c
> User: Svata Dedic <sdedic@netbeans.org>
> 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/...)