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 166177 - Undo/Redo transactions can lead to losing synchronization because of prefix declarations
Summary: Undo/Redo transactions can lead to losing synchronization because of prefix d...
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: XDM (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@xml
URL:
Keywords:
Depends on: 186266
Blocks:
  Show dependency tree
 
Reported: 2009-05-28 13:57 UTC by Nikita Krjukov
Modified: 2010-07-08 21:28 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Krjukov 2009-05-28 13:57:51 UTC
There is a problem with the order of notifications are generated by Undo transaction. The transaction can contain a set
of changes, which are processed by a XDM model to synchronize a XAM with sources. 

New prefix declaration can be required to be added, when the user creates something new in the model. It usually is
doing automatically and in the same transaction with the main changes. So such a transaction, after its completion,
contains new prefix declaration and some other changes both. 

If the user decides undo such changes, the XAM based model has to remove the prefix declaration and other changes. But
it is important the prefix declaration is removed at the end of transaction because such a prefix declaration is
required to delete other elements/attributes. But XDM generates undo events according to position of the modified object
in sources and particularly from top to bottom. 

Such behavior of the XDM model leads to impossibility to delete some changes and as a result the XAM and XDM models
become unsynchronized. 

The problem has been found quite long time ago. For example, we faced it when working with BPEL extensions (see issue
#130777). But only a workaround was applied so far and it covers only BPEL extensions cases. 

I'm going to prepare a test project and instruction to reproduce the problem a bit later.
Comment 1 Sergey Lunegov 2010-04-22 14:25:54 UTC
This s defect indeed.
Comment 2 Nikita Krjukov 2010-04-29 14:32:56 UTC
Fixed in trunk

It didn't require significant modifications because most of infrastructure already had presented in XDM model.
Comment 3 Nikita Krjukov 2010-05-14 12:53:08 UTC
Fix is reopened because if caused another issue #186068 which looks more serious. 
It's necessary to find another way of fixing.
Comment 4 Nikita Krjukov 2010-05-25 17:01:47 UTC
Changes pushed to trunk http://hg.netbeans.org/main/rev/b5ca60f8018b
A few API modifications was required to do to fix the issue. 
See issue #186266
Comment 5 Quality Engineering 2010-05-26 07:20:19 UTC
Integrated into 'main-golden', will be available in build *201005260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b5ca60f8018b
User: supernikita@netbeans.org
Log: #166177 - Undo/Redo transactions can lead to losing synchronization because of prefix declaration
Comment 6 Nikita Krjukov 2010-06-03 18:15:07 UTC
The issue is fixed in trunk and it definitely worth to be added to patch.
Comment 7 Nikita Krjukov 2010-06-03 18:58:01 UTC
It's necessary to BE CAREFUL with automatic migration of the issue (trunk --> release6.9.1) 

The method XDMListener.prepareChangeInfo(...) was deleted in trunk during fixing the issue. But it exists in release69 branch and it's visible through module's API.

I've just returned the method back in trunk http://hg.netbeans.org/main/rev/b1b92368451b

It's necessary to comply binary compatibility with 6.9. 
So the method has to remain in 6.9.1 as well!
Comment 8 Sergey Lunegov 2010-06-04 09:17:11 UTC
correct status whiteboard term
Comment 9 rbalada 2010-06-16 08:00:33 UTC
Transplanted into release691 repository as f511be5a98a1

Please verify this issue in trunk.
Comment 10 Nikita Krjukov 2010-06-18 15:47:31 UTC
Verified in trunk with JUnit tests and manually.
Comment 11 Nikita Krjukov 2010-06-18 20:18:42 UTC
Migrated all relevant changes from trunk to release691 http://hg.netbeans.org/release691/rev/c3fc05c2e74c
Comment 12 Quality Engineering 2010-06-19 03:39:37 UTC
Integrated into 'main-golden', will be available in build *201006190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/baf81d85fbef
User: supernikita@netbeans.org
Log: Add missing version dependency (issue #166177)
Comment 13 Tomas Danek 2010-07-08 13:29:40 UTC
any chance to get the promised steps to reproduce so that i could verify in 6.9.1 build? Thanks in advance.
Comment 14 Nikita Krjukov 2010-07-08 21:28:54 UTC
Regarding seteps to reproduce:
It's necessary to have a XAM transaction, which creates a new prefix declaration together with an XML expression, which usese the NS declaration. It's the main problem. There are some examples in BPEL, but I can't provide exact one because I'm on vacation right now. 
Then undo should remove the NS declaration and the expression both. Only the ns declaration had removed before the fix.