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.
This bug was originally marked as duplicate of bug 152624, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related. Build: NetBeans IDE Dev (Build 201109090600) VM: Java HotSpot(TM) Client VM, 20.1-b02, Java(TM) SE Runtime Environment, 1.6.0_26-b03 OS: Linux User Comments: paolosca: Editing a sql query in the sql editor, made several changes. To return to the original query I pressed ctrl+z several times when the error popped up. Stacktrace: javax.swing.text.BadLocationException: Length must be positive at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:795) at org.netbeans.editor.FixLineSyntaxState.fixSyntaxStateInfos(FixLineSyntaxState.java:471) at org.netbeans.editor.FixLineSyntaxState.update(FixLineSyntaxState.java:303) at org.netbeans.editor.FixLineSyntaxState$BeforeLineUndo.undo(FixLineSyntaxState.java:611) at org.netbeans.editor.BaseDocumentEvent.undo(BaseDocumentEvent.java:289) at org.netbeans.editor.GuardedDocumentEvent.undo(GuardedDocumentEvent.java:72)
Created attachment 110594 [details] stacktrace
*** Bug 201955 has been marked as a duplicate of this bug. ***
I made a better exception report. If there will be this exception again, we will know better how to repair it. jet-main/rev/fd00f4148696 I was not successful to reproduce it.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/fd00f4148696 User: Milutin Kristofic <mkristofic@netbeans.org> Log: #201922 - [71cat] javax.swing.text.BadLocationException: Length must be positive - better Exception report
Created attachment 118993 [details] Project to use for reproduction. 1) Open up attached project in NetBeans. 2) View Project windows in tree mode and Drag & Drop Model.java into "newpackage". 3) Undo & Redo a few times. This Exception thrown. If not, this exception may be thrown: http://netbeans.org/bugzilla/show_bug.cgi?id=211985 Product Version: NetBeans IDE Dev (Build 201205020400) Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21 System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
MackSix example reproducible at Product Version: NetBeans IDE Dev (Build 201205290002) Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21 System: Linux version 3.0.0-19-generic running on amd64; UTF-8; en_US (nb)
In macksix project, refactoring is trying change guarded part: private com.areaofthoughts.armageddon.Model model1; Product Version: NetBeans IDE Dev (Build 20121115-2d8fe85d302c) Java: 1.6.0_29; Java HotSpot(TM) 64-Bit Server VM 20.4-b02 Runtime: Java(TM) SE Runtime Environment 1.6.0_29-b11 javax.swing.text.BadLocationException: Wrong insert position 11932 at org.netbeans.editor.BaseDocument.handleInsertString(BaseDocument.java:762) at org.netbeans.editor.BaseDocument$FilterBypassImpl.insertString(BaseDocument.java:2421) at javax.swing.text.DocumentFilter.insertString(DocumentFilter.java:72) at org.openide.text.CloneableEditorSupport$DocFilter.insertString(CloneableEditorSupport.java:3090) at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:746) at org.netbeans.api.java.source.ModificationResult.processDocumentLocked(ModificationResult.java:430) at org.netbeans.api.java.source.ModificationResult.access$100(ModificationResult.java:96) at org.netbeans.api.java.source.ModificationResult$3.run(ModificationResult.java:394) at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:347) at org.openide.text.NbDocument.runAtomicAsUser(NbDocument.java:462) at org.netbeans.api.java.source.ModificationResult.processDocument(ModificationResult.java:408) Caused: java.io.IOException at org.netbeans.api.java.source.ModificationResult.processDocument(ModificationResult.java:414) at org.netbeans.api.java.source.ModificationResult.commit2(ModificationResult.java:356) at org.netbeans.api.java.source.ModificationResult.access$000(ModificationResult.java:96) at org.netbeans.api.java.source.ModificationResult$2.run(ModificationResult.java:258) at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:317) at org.openide.text.NbDocument.runAtomic(NbDocument.java:436) [catch] at org.netbeans.api.java.source.ModificationResult.commit(ModificationResult.java:255) at org.netbeans.api.java.source.ModificationResult.commit(ModificationResult.java:214) at org.netbeans.modules.refactoring.java.spi.JavaModificationResult.commit(JavaModificationResult.java:74) at org.netbeans.modules.refactoring.spi.RefactoringCommit.commit(RefactoringCommit.java:149) Caused: java.lang.RuntimeException at org.netbeans.modules.refactoring.spi.RefactoringCommit.commit(RefactoringCommit.java:160) at org.netbeans.modules.refactoring.api.RefactoringSession.doRefactoring(RefactoringSession.java:143) at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$9.run(ParametersPanel.java:480) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1454) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2036) Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to at org.openide.util.RequestProcessor.post(RequestProcessor.java:424) at org.netbeans.modules.refactoring.spi.impl.ParametersPanel.refactor(ParametersPanel.java:442) at org.netbeans.modules.refactoring.spi.impl.ParametersPanel.refactor(ParametersPanel.java:501) at org.netbeans.modules.refactoring.spi.impl.ParametersPanel.access$200(ParametersPanel.java:86) at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$3.actionPerformed(ParametersPanel.java:244) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6288) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6053) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4651) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4481) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4481) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643) at java.awt.EventQueue.access$000(EventQueue.java:84) at java.awt.EventQueue$1.run(EventQueue.java:602) at java.awt.EventQueue$1.run(EventQueue.java:600) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98) at java.awt.EventQueue$2.run(EventQueue.java:616) at java.awt.EventQueue$2.run(EventQueue.java:614) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:613) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178) at java.awt.Dialog$1.run(Dialog.java:1046) at java.awt.Dialog$3.run(Dialog.java:1098) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Dialog.show(Dialog.java:1096) at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1074) at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1114) at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1096) at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:126) at org.openide.util.Mutex.doEventAccess(Mutex.java:1363) at org.openide.util.Mutex.readAccess(Mutex.java:273) at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1081) at java.awt.Component.show(Component.java:1584) at java.awt.Component.setVisible(Component.java:1536) at java.awt.Window.setVisible(Window.java:842) at java.awt.Dialog.setVisible(Dialog.java:986) at org.netbeans.modules.refactoring.spi.impl.ParametersPanel.showDialog(ParametersPanel.java:666) at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.refresh(RefactoringPanel.java:680) at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.<init>(RefactoringPanel.java:168) at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.<init>(RefactoringPanel.java:156) at org.netbeans.modules.refactoring.spi.ui.UI.openRefactoringUI(UI.java:75) at org.netbeans.modules.refactoring.java.ui.ContextAnalyzer$NodeToFileObjectTask.run(ContextAnalyzer.java:615) at org.netbeans.api.java.source.ui.ScanDialog.runWhenScanFinished(ScanDialog.java:153) at org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider.doMove(RefactoringActionsProvider.java:422) at org.netbeans.modules.refactoring.api.impl.ActionsImplementationFactory.doMove(ActionsImplementationFactory.java:156) at org.netbeans.modules.refactoring.spi.impl.MoveAction.performAction(MoveAction.java:76) at org.netbeans.modules.refactoring.spi.impl.RefactoringGlobalAction$ContextAction.actionPerformed(RefactoringGlobalAction.java:197) at org.netbeans.modules.refactoring.impl.ClipboardConvertor$RefactoringPaste$RefactoringPasteType$1.run(ClipboardConvertor.java:149) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641) at java.awt.EventQueue.access$000(EventQueue.java:84) at java.awt.EventQueue$1.run(EventQueue.java:602) at java.awt.EventQueue$1.run(EventQueue.java:600) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:611) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:1
(In reply to comment #7) > In macksix project, refactoring is trying change guarded part: > private com.areaofthoughts.armageddon.Model model1; > > Product Version: NetBeans IDE Dev (Build 20121115-2d8fe85d302c) > Java: 1.6.0_29; Java HotSpot(TM) 64-Bit Server VM 20.4-b02 > Runtime: Java(TM) SE Runtime Environment 1.6.0_29-b11 > <snip> That problem was introduced recently, see #221844, and I think is unrelated to this one.
Mila, lineElem.getStartOffset() 13499 lineElem.getEndOffset() 12843
(In reply to Milutin Kristofic from comment #9) > Mila, > > lineElem.getStartOffset() > 13499 > > lineElem.getEndOffset() > 12843 If that line element is not part of the line root element then this may happen in case of undo (two positions get into a single offset due to removal; when undone they get back to their original offsets). If this happens to positions in elements that are part of line root element then it's a bug and the issue should be reopened. Since #221844 is fixed I mark this as dup of it. *** This bug has been marked as a duplicate of bug 221844 ***