Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 87719 - Undo/Redo in OnEvent, OnAlarm and ForEach can create broken diagram
Undo/Redo in OnEvent, OnAlarm and ForEach can create broken diagram
Status: VERIFIED FIXED
Product: soa
Classification: Unclassified
Component: BPEL
5.x
All All
: P1 (vote)
: 5.x
Assigned To: Denis Anisimov
issues@soa
55EP_RR_DOCS 55EP_RR_WAIVED
:
: 94873 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-21 18:21 UTC by Michael Frisino
Modified: 2007-02-12 15:19 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Frisino 2006-10-21 18:21:56 UTC
It is possible to create situation where the Diagram is non-renderable. And the
only workaround for that diagram is to restart the IDE.

Please note this is not a regression due to recent undo/redo changes. This is
reproducible with build as far back as Oct. 1, and perhaps much further back. It
appears this scenario was just not tested before now.


Here is how to reproduce this problem.

steps for OnEvent / OnAlarm / ForEach - all the elements that require a  Scope
child. 

create SynchrhonousSample
select process element in diagram
add EventHandler
select EventHandlers element
add OnEvent element
DnD Scope from palette onto OnEvent element
Note that source code shows addition of both scope as expected.

   <eventHandlers>
        <onEvent>
            <scope name="Scope1">
            </scope>
        </onEvent>
    </eventHandlers>
    
   
   DnD a Sequence onto diagram and drop it in the Scope1.
   
   Now source code looks like this
     
       <eventHandlers>
        <onEvent>
            <scope name="Scope1">
                <sequence name="Sequence1">
                </sequence>
            </scope>
        </onEvent>
    </eventHandlers>
    
    
Ctrl-Z to undo last action
The Sequence1 dissappear as expected from both diagram and source

    <eventHandlers>
        <onEvent>
            <scope name="Scope1">
            </scope>
        </onEvent>
    </eventHandlers>
    
Ctlr-Z again
The Empty1 and Scope1 dissappear as expected from both diagram and source

   <eventHandlers>
        <onEvent/>
    </eventHandlers>
  
  
Now Ctrl-Y to redo last action 
(Expectation is that both the Scope1  will re-appear. However, nothing seems to
happen on diagram)
(Observation - in source editor the Scope1 has been re-added, but it does not
appar on diagram. This is indicator of problem

   <eventHandlers>
        <onEvent>
            <scope name="Scope1">
            </scope>
        </onEvent>
    </eventHandlers>

Observation - diagram still visible and seemingly healthy. You can add things
and remove to rest of diagram.
Observation - still no exception in messages.log file. . At this point the model
is slightly broken. The Scope1 child element seems disconnected from the rest of
the diagram. If you close Diagram and re-open, you can continue working but the
Scope1 remains only in source. No exceptions will be thrown, but the fragment is
zombied. However, to see the worst case problem, do not close source at this
point. Continue to next step).


Now Ctrl-Y (Redo AGAIN)  Again,nothing seems to happen BUT this exception
appears in messages.log file. User does not see this exception.

*********** Exception occurred ************ at 8:05 PM on Oct 21, 2006
java.lang.IllegalArgumentException: Could not find parent component
	at
org.netbeans.modules.xml.xam.dom.AbstractDocumentModel.prepareSyncUnit(AbstractDocumentModel.java:263)
	at org.netbeans.modules.xml.xdm.xam.XDMListener.processChange(XDMListener.java:110)
	at org.netbeans.modules.xml.xdm.xam.XDMListener.processEvent(XDMListener.java:176)
	at
org.netbeans.modules.xml.xdm.xam.XDMListener.propertyChange(XDMListener.java:190)
	at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
	at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
	at org.netbeans.modules.xml.xdm.XDMModel.fireDiffEvents(XDMModel.java:248)
	at org.netbeans.modules.xml.xdm.XDMModel.resetDocument(XDMModel.java:801)
	at
org.netbeans.modules.xml.xdm.XDMModelUndoableEdit.redo(XDMModelUndoableEdit.java:50)
	at javax.swing.undo.CompoundEdit.redo(CompoundEdit.java:59)
	at
org.netbeans.modules.xml.xam.AbstractModel$ModelUndoableEdit.redo(AbstractModel.java:458)
	at
org.netbeans.modules.bpel.model.impl.BpelModelImpl$BpelModelUndoableEdit.redo(BpelModelImpl.java:734)
	at javax.swing.undo.UndoManager.redoTo(UndoManager.java:222)
	at javax.swing.undo.UndoManager.redo(UndoManager.java:311)
	at
org.openide.text.CloneableEditorSupport$CESUndoRedoManager.access$2301(CloneableEditorSupport.java:2639)
	at
org.openide.text.CloneableEditorSupport$CESUndoRedoManager$RenderUndo.run(CloneableEditorSupport.java:2774)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:226)
	at
org.openide.text.CloneableEditorSupport$CESUndoRedoManager$RenderUndo.<init>(CloneableEditorSupport.java:2759)
	at
org.openide.text.CloneableEditorSupport$CESUndoRedoManager$RenderUndo.<init>(CloneableEditorSupport.java:2751)
	at
org.openide.text.CloneableEditorSupport$CESUndoRedoManager.redo(CloneableEditorSupport.java:2655)
	at
org.netbeans.modules.xml.xam.ui.undo.FilterUndoManager.redo(FilterUndoManager.java:116)
	at
org.netbeans.modules.xml.xam.ui.undo.CompoundUndoManager.redo(CompoundUndoManager.java:189)
	at
org.netbeans.modules.xml.xam.ui.undo.QuietUndoManager.redo(QuietUndoManager.java:159)
	at org.openide.actions.RedoAction.performAction(RedoAction.java:71)
	at
org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:100)
	at
org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:53)
	at
org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:96)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
	at java.awt.Component.processMouseEvent(Component.java:5488)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
	at org.openide.awt.ToolbarButton.processMouseEvent(ToolbarButton.java:39)
	at java.awt.Component.processEvent(Component.java:5253)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3955)
	
	
If you Close the BPEL file and Reopen the BPEL file. User will see "Unable to
Show Diagram" message. Even though at a source level the BPEL is valid. 
If we look in the messages.log file we find this exception was triggered on the
Reopen.
    
    *********** Exception occurred ************ at 8:03 PM on Oct 21, 2006
java.lang.NullPointerException
	at
org.netbeans.modules.bpel.design.model.patterns.ProcessPattern.createElementsImpl(ProcessPattern.java:303)
	at
org.netbeans.modules.bpel.design.model.patterns.Pattern.initPattern(Pattern.java:111)
	at
org.netbeans.modules.bpel.design.model.DiagramModel.createPattern(DiagramModel.java:211)
[catch] at
org.netbeans.modules.bpel.design.DesignView.reloadModel(DesignView.java:232)
	at org.netbeans.modules.bpel.design.DesignView.<init>(DesignView.java:214)
	at
org.netbeans.modules.bpel.editors.multiview.DesignerMultiViewElement.createDesignView(DesignerMultiViewElement.java:382)
	at
org.netbeans.modules.bpel.editors.multiview.DesignerMultiViewElement.initializeUI(DesignerMultiViewElement.java:392)
	at
org.netbeans.modules.bpel.editors.multiview.DesignerMultiViewElement.<init>(DesignerMultiViewElement.java:156)
	at
org.netbeans.modules.bpel.editors.multiview.DesignerMultiViewElementDesc.createElement(DesignerMultiViewElementDesc.java:56)
	at
org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:191)
	at
org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:111)
	at
org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:107)
	at
org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:243)
	at
org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:235)
	at
org.netbeans.core.multiview.MultiViewPeer$SelectionListener.selectionChanged(MultiViewPeer.java:626)
	at
org.netbeans.core.multiview.MultiViewModel.fireSelectionChanged(MultiViewModel.java:230)
	at
org.netbeans.core.multiview.MultiViewModel.setActiveDescription(MultiViewModel.java:99)
	at
org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:280)
	at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:215)
	at javax.swing.ButtonGroup.setSelected(ButtonGroup.java:139)
	at
org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:276)
	at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:215)
	at javax.swing.AbstractButton.setSelected(AbstractButton.java:274)
	at
org.netbeans.core.multiview.TabsComponent.changeActiveManually(TabsComponent.java:153)
	at
org.netbeans.core.multiview.MultiViewPeer$MVTCHandler.requestActive(MultiViewPeer.java:652)
	at
org.netbeans.core.api.multiview.MultiViewHandler.requestActive(MultiViewHandler.java:73)
	at
org.netbeans.modules.bpel.core.multiview.BpelMultiViewSupport.requestViewOpen(BpelMultiViewSupport.java:114)
	at
org.netbeans.modules.bpel.core.BPELDataObject$BPELNode$1.actionPerformed(BPELDataObject.java:345)
	at org.openide.explorer.view.TreeView$PopupSupport.mouseClicked(TreeView.java:1389)
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
	at java.awt.Component.processMouseEvent(Component.java:5491)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
	at java.awt.Component.processEvent(Component.java:5253)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3955)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
	at java.awt.Container.dispatchEventImpl(Container.java:2010)
	at java.awt.Window.dispatchEventImpl(Window.java:1774)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Engineering note:
The steps described above  are the most basic steps to reproduce the problem.
However, other steps will trigger the problem. For instance adding two Empty
elements to OnEvent, OnAlarm, and ForEach and then doing the undo, undo, redo,
redo, redo would also trigger the problem because when you add ANY element to
OnEvent , OnAlarm, ForEach, the IDE automatically adds the Scope / Sequence
ALSO. And it is really the Scope / Sequence that is the problem. So I used the
steps above in order to prevent enginneering from being distracted by the
implicit Scope, implicit sequence feature. 

 
 Extent of brokeness.
 The BPEL source is actually valid. However, the in memory object model is
disconnected from the source at this point and it will not rebuild itself. 
Reoponing the BPEL process file will not help. Modifying the BPEL source and
saving will not help. Validating the source will not help. The object model has
become disconnected from the source and will not recover itself.  Even closing
and reopening the project does not help. 

Workaround. 
The only workaround for this problem is closing the IDE and re-opening the IDE.
At that point diagram will be ok. Because in reality, the BPEL source is fine. 

Good news.
Note that this problem only effects the broken diagram. Other diagrams and
editors are fine. The rest of the IDE is fine.

Summary.
There seems to be a problem with these Scope children being added to the model
and then becoming zombied by a Redo action. 
It seems to only happen in those cases where Scopes are added to parents that
require a scope child in order to be compliant with the BPEL schema (in
EventHandler>OnEvent, EventHandlers>OnAlarm, and ForEach. 
It does not seem to happen in cases where scopes are placed as children of
elements that do not requre a scope child. For instance problem does not seem to
occur if you add a scope as a child of a Sequence, or as a child of a Catch.

Evaluation. 
This is a bad problem. However, the steps to reproduce it do not seem to warrant
it being a showstopper at this last minute in cycle. Furthermore, it does not
seem related to the recent fix for Undo/Redo. We are able to reproduce this
problem in a build from Oct. 1, which was before  ALL of the late undo/redo
changes. So this problem was present even before issue 85928 was addressed on
Oct. 2. Therefore, this is not a regression introduced by recent Undo/Redo work.
At this point it is unclear how far back this bug has been present and how long
it has been undetected.
Comment 1 Michael Frisino 2006-10-21 18:40:22 UTC
Also note this is only for these parent elements:
EventHandlder>OnEvent 
EventHandlers>OnAlarm 
ForEach.

The bug does not surface in 
Pick>OnMessage and Pick>OnAlarm. 

This leads me to conclude it is limited to those elements where the BPEL
specification requires a Scope child. 
Comment 2 Michael Frisino 2006-10-21 18:45:04 UTC
On steps above. There was a typo. I wrote:

Ctlr-Z again
The Empty1 and Scope1 dissappear as expected from both diagram and source

   <eventHandlers>
        <onEvent/>
    </eventHandlers>
  
Please ignore the "Empty1" word. It was mistake in my typing. I meant to write:

Ctlr-Z again
The Scope1 dissappears as expected from both diagram and source

   <eventHandlers>
        <onEvent/>
    </eventHandlers>

Comment 3 astashkova 2006-10-23 10:17:57 UTC
Added to RNs.
Use the following link to review the wording and location of the issue in the
staged  Release Notes
http://nbstaging.czech/community/releases/55/entpack_relnotes.html#87719
Comment 4 Michael Frisino 2006-10-31 13:18:40 UTC
Denis, can you determine if this is OM or OM client problem?
Comment 5 Denis Anisimov 2006-11-01 16:01:59 UTC
Bug is in sync mechanism of OM.
Bug doesn't relate to undo/redo.

Problem is inside synchronization source code and OM. ( So it 
can be reproduced with other scenario - introducing changes in source code ).

The problem is the same for three BPEL elements :
For Each
On Alarm Event
On Event

Those elements was modified in recent BPEL spec with replacing activity as
child element to scope element child.
As consequence in current BPEL OM was introduced interface ScopeHolder.
The problem here appears due presence ScopeHolder interface that doesn't
extends neither ActivityHolder interface nor CompositeActivity.
This leads to lost information that got while source is synced with OM
because class SyncUpdateVisitor didn't perform any changes in OM.
( It was implemented with old schema where scope could be child only in
ActivityHolder interface or CompositeActivity interface ).
So OM is desynced as result and we have this issue.

The fix is - place additional logic in SyncUpdateVisitor when we have 
notifcation about Scope was added as child in some container. Containers
ForEach, OnEvent, OnAlarmEvent should be handled with other logic.
This logic will be introduced in impl.

QA: 
- please check how this issue will be fixed with all three elements: forEach, etc.
- please check that source modification for described element ( adding Scope
as child into described container via source editor ) works well also.
- introduced fix will be new functionality actually. So you also need to check
correctness of appearing "scope" as child in container ( I mean here that 
scope should have correct position in his parent). For performing this check
you need more children in container ( if any possible ) and perform undo/redo
manipulation with scope. Scope should have correct position ( I beleive in all 
cases Scope is last element in children list ).

Fix will be introduced into release55gavotte branch when I got it locally.

Comment 6 Denis Anisimov 2006-11-01 16:10:38 UTC
And one more:

I described the situation with fix with details because it can be discovered
in future once again with other elements. The problem here is in 
appearing changes in BPEL spec. It is not obvious that new code 
should be added and old impl of Sync updater should be changed with new code
respectively changes in BPEL schema.

So as I said such situation could appear again with other elements after new
changes in BPEL spec. This should be known.
Currently I have added some assertion code that will help determine
new situation with Scope. Actually this practice need to be used anywhere
in methods of SyncUpdateVisitor. Any change of BPEL OM API interfaces that
will lead to changes in Composite pattern will be caught immediately in this 
case.
Comment 7 Denis Anisimov 2006-11-03 10:42:23 UTC
Fixed in gavotte branch.
Comment 8 Victoria Zhukovskaya 2007-02-07 12:45:37 UTC
WinXP, NB5.5.1+ gavotte 070206

It can be reproduced with help the same steps:

1. create SynchrhonousSample
2.select process element in diagram
3. add EventHandler
4. select EventHandlers element add OnEvent element
5. DnD Scope from palette onto OnEvent element
6. DnD a Sequence onto diagram and drop it in the Scope1.
7. Ctrl-Z to undo last action -Ok
8. Ctrl-Z to undo last action -Ok
9. Now Ctrl-Y to redo last action -  in source editor the Scope1 has been
re-added, but it does not appar on diagram. 
10.Now Ctrl-Y to redo last action  - Exception

java.lang.IllegalArgumentException: Could not find parent component
	at
org.netbeans.modules.xml.xam.dom.AbstractDocumentModel.prepareSyncUnit(AbstractDocumentModel.java:273)
	at
org.netbeans.modules.xml.xdm.xam.XDMListener.processChange(XDMListener.java:110)
 ....

------------------------------

After switching between Source View and Design view -
java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedConstructorAccessor84.newInstance(Unknown Source)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at
org.netbeans.modules.soa.ui.nodes.ReflectionNodeFactory.createNode(ReflectionNodeFactory.java:107)




Comment 9 Sergey Lunegov 2007-02-07 12:49:25 UTC
Denis, need your advise on this. Probably will postpone to FCS.
Comment 10 Denis Anisimov 2007-02-07 17:38:07 UTC
Thank you very much Victoria, for catching this.
This is exactly the original issue.
We have lost code from release551 branch for fix.

Need reintroduce it back and possibly all other lost code missed in realease551 
branch....
Comment 11 Denis Anisimov 2007-02-08 09:53:51 UTC
*** Issue 94873 has been marked as a duplicate of this issue. ***
Comment 12 Denis Anisimov 2007-02-08 09:54:48 UTC
Fixed via reintroducing integrations from release55gavotte branch into release551.
Comment 13 Victoria Zhukovskaya 2007-02-12 15:18:46 UTC
NB 5.5.1 + gavotte-070211_4-windows
There are no exceptions
Thank You Denis
Comment 14 Victoria Zhukovskaya 2007-02-12 15:19:59 UTC
and Scope  appar on diagram after step 9


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo