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 106988 - Exception while trying to Undo delete Attribute.
Summary: Exception while trying to Undo delete Attribute.
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P1 blocker (vote)
Assignee: Sonali Kochar
URL:
Keywords:
: 106641 106996 107012 107028 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-18 13:51 UTC by Michael Nazarov
Modified: 2007-06-28 15:05 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot for last note (4.09 KB, image/png)
2007-06-18 13:58 UTC, Michael Nazarov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nazarov 2007-06-18 13:51:06 UTC
Build from June 17, 2007.

See also 106983.

1. Add two attribute into XML schema.
2. Delete first one from schema with Right click -> Delete.
3. Delete other one from source.
4. Make attempt to undo delete with manu Refactor -> Undo.

Followed will appear:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at org.netbeans.editor.DocumentContent.moveGap(DocumentContent.java:215)
	at org.netbeans.editor.DocumentContent.insertText(DocumentContent.java:271)
	at org.netbeans.editor.DocumentContent$Edit.undoOrRedo(DocumentContent.java:423)
	at org.netbeans.editor.DocumentContent$Edit.undo(DocumentContent.java:400)
	at org.netbeans.editor.BaseDocumentEvent.undo(BaseDocumentEvent.java:262)
	at org.netbeans.editor.GuardedDocumentEvent.undo(GuardedDocumentEvent.java:47)
	at javax.swing.undo.CompoundEdit.undo(CompoundEdit.java:46)
	at javax.swing.undo.CompoundEdit.undo(CompoundEdit.java:46)
	at org.netbeans.modules.xml.xam.AbstractModel$ModelUndoableEdit.undo(AbstractModel.java:555)
	at javax.swing.undo.UndoManager.undoTo(UndoManager.java:320)
	at javax.swing.undo.UndoManager.undo(UndoManager.java:398)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringTransaction.rollback(XMLRefactoringTransaction.java:118)
	at org.netbeans.modules.refactoring.api.RefactoringSession.undoRefactoring(RefactoringSession.java:132)
	at org.netbeans.modules.refactoring.spi.impl.UndoManager$SessionUndoItem.undo(UndoManager.java:508)
	at org.netbeans.modules.refactoring.spi.impl.UndoManager.undo(UndoManager.java:174)
	at org.netbeans.modules.refactoring.spi.impl.UndoAction.performAction(UndoAction.java:74)
	at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:96)
	at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.actionPerformed(ActionsBridge.java:89)
	at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:82)
	at org.netbeans.modules.openide.actions.ActionsBridgeImpl.invokeAction(ActionsBridgeImpl.java:30)
	at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.doRun(ActionsBridge.java:80)
	at org.netbeans.modules.openide.util.ActionsBridge$1.run(ActionsBridge.java:49)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Comment 1 Michael Nazarov 2007-06-18 13:52:30 UTC
In addition after exception one is unable to manipulate Attributes, all items in context menu for Attributes are
disabled. Reopening document helps.
Comment 2 Michael Nazarov 2007-06-18 13:56:57 UTC
One more note: if exception appear, one going to close document and choose "Discard" in saving prompt then after
reopening there is one Attribute in source code view and all removed attributes in schema view. In my case I have three
attributes with same name newAttribute1.
Comment 3 Michael Nazarov 2007-06-18 13:58:45 UTC
Created attachment 43880 [details]
Screenshot for last note
Comment 4 Michael Nazarov 2007-06-18 14:00:51 UTC
It's me again...
I'm trying to remove "restored" attributes using Context menu -> Delete. First attribute removed successfully, second
one doesn't want to be removed:

java.lang.AssertionError
	at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:328)
	at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:313)
	at org.netbeans.modules.xml.xdm.XDMModel.remove(XDMModel.java:670)
	at org.netbeans.modules.xml.xdm.xam.XDMAccess.removeChild(XDMAccess.java:273)
	at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.removeChild(AbstractDocumentComponent.java:468)
	at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.removeChildQuietly(AbstractDocumentComponent.java:280)
	at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.removeChildQuietly(AbstractDocumentComponent.java:52)
	at org.netbeans.modules.xml.xam.AbstractComponent._removeChildQuietly(AbstractComponent.java:104)
	at org.netbeans.modules.xml.xam.AbstractComponent.removeChild(AbstractComponent.java:339)
	at org.netbeans.modules.xml.schema.model.impl.SchemaImpl.removeAttribute(SchemaImpl.java:147)
	at org.netbeans.modules.xml.schema.model.impl.xdm.SyncUpdateVisitor.visit(SyncUpdateVisitor.java:99)
	at org.netbeans.modules.xml.schema.model.impl.GlobalAttributeImpl.accept(GlobalAttributeImpl.java:49)
	at org.netbeans.modules.xml.schema.model.impl.xdm.SyncUpdateVisitor.update(SyncUpdateVisitor.java:63)
	at org.netbeans.modules.xml.schema.model.impl.xdm.SyncUpdateVisitor.update(SyncUpdateVisitor.java:51)
	at org.netbeans.modules.xml.schema.model.impl.xdm.SyncUpdateVisitor.update(SyncUpdateVisitor.java:34)
	at org.netbeans.modules.xml.xam.dom.AbstractDocumentModel.removeChildComponent(AbstractDocumentModel.java:391)
	at org.netbeans.modules.xml.refactoring.spi.SharedUtils.deleteTarget(SharedUtils.java:127)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringTransaction.doRefactorTarget(XMLRefactoringTransaction.java:253)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringTransaction.process(XMLRefactoringTransaction.java:169)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringTransaction.commit(XMLRefactoringTransaction.java:93)
	at org.netbeans.modules.refactoring.api.RefactoringSession.doRefactoring(RefactoringSession.java:91)
	at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$8.run(ParametersPanel.java:334)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Comment 5 Sonali Kochar 2007-06-18 17:00:38 UTC
*** Issue 107028 has been marked as a duplicate of this issue. ***
Comment 6 Sonali Kochar 2007-06-18 17:01:09 UTC
*** Issue 107012 has been marked as a duplicate of this issue. ***
Comment 7 Sonali Kochar 2007-06-18 17:01:37 UTC
*** Issue 106996 has been marked as a duplicate of this issue. ***
Comment 8 Sonali Kochar 2007-06-18 17:04:37 UTC
The problem is coming that the schema document is changed after doing a Refactor -> Delete . When the Refactor -> undo
is called, the Refactoring framework has changes that are no longer valid since their positions in the schema document
has changed as the user edited the document. In such cases, the Refactor -> undo and Refactor -> redo should be deleted.
Am looking into how to deactivate these options.
Comment 9 Sonali Kochar 2007-06-19 17:41:51 UTC
*** Issue 106641 has been marked as a duplicate of this issue. ***
Comment 10 Sonali Kochar 2007-06-25 23:34:53 UTC
Implemented getPositionBounds so that the refactoring framework can attach listeners to documents and deactivate the
undo/redo options if document participating in refactoring has changed. Fixed in build #1177
Comment 11 Michael Nazarov 2007-06-28 15:05:06 UTC
Works. There are still issues with deleting different ways (Refactor + Source Code) so I'll file another issue.