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.
Reproduced in build 060918. To reproduce the bug: - create a new schema; - switch to Source view; - add Complex Type with two sequences with Element: <xsd:complexType name="ct"> <xsd:sequence> <xsd:element name="el"/> </xsd:sequence> <xsd:sequence> <xsd:element name="el"/> </xsd:sequence> </xsd:complexType> - switch to Schema view; - only one Sequence is displayed; - switch to Source view - delete first sequence; - switch to Schema view; - there are no any sequence in Complex type; - switch to Source view; - modify Element name; - switch to Schema view. Exception: java.lang.IllegalArgumentException: Could not find parent component at org.netbeans.modules.xml.xam.dom.AbstractDocumentModel.prepareSyncUnit(AbstractDocumentModel.java:216) at org.netbeans.modules.xml.schema.model.impl.SchemaModelImpl.prepareSyncUnit(SchemaModelImpl.java:252) 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:339) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276) at org.netbeans.modules.xml.xdm.XDMModel.fireDiffEvents(XDMModel.java:230) at org.netbeans.modules.xml.xdm.XDMModel.finishSync(XDMModel.java:190) at org.netbeans.modules.xml.xdm.XDMModel.sync(XDMModel.java:128) at org.netbeans.modules.xml.xdm.xam.XDMAccess.sync(XDMAccess.java:121) at org.netbeans.modules.xml.xam.AbstractModel.sync(AbstractModel.java:230) at org.netbeans.modules.xml.schema.core.SchemaEditorSupport.syncModel(SchemaEditorSupport.java:374) at org.netbeans.modules.xml.schema.core.multiview.SchemaSourceMultiViewElement.componentHidden(SchemaSourceMultiViewElement.java:324) at org.netbeans.core.multiview.MultiViewPeer.hideElement(MultiViewPeer.java:229) at org.netbeans.core.multiview.MultiViewPeer$SelectionListener.selectionChanged(MultiViewPeer.java:625) 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:232) at javax.swing.ButtonGroup.setSelected(ButtonGroup.java:147) at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:276) at org.netbeans.core.multiview.TabsComponent$ButtonMouseListener.mousePressed(TabsComponent.java:420) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221) at java.awt.Component.processMouseEvent(Component.java:5996) at javax.swing.JComponent.processMouseEvent(JComponent.java:3240) at java.awt.Component.processEvent(Component.java:5764) at java.awt.Container.processEvent(Container.java:1984) at java.awt.Component.dispatchEventImpl(Component.java:4407) at java.awt.Container.dispatchEventImpl(Container.java:2042) at java.awt.Component.dispatchEvent(Component.java:4237) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4248) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3909) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3842) at java.awt.Container.dispatchEventImpl(Container.java:2028) at java.awt.Window.dispatchEventImpl(Window.java:2405) at java.awt.Component.dispatchEvent(Component.java:4237) [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:600) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
What I actually see is 2 sequences in the child column of complex type ct. This is not right but probably ok as long as user would get validation errors. The bug acutally is when remove the first sequence, we call setDefinition(null) hence wipe out both sequences.
The reason for this bug is that during sync we use domain component specific setXxx methods. The fix is to use generic methods insertAtIndex and removeChild, by which we allow domain model to be insync with underlying XDM model eventhough the domain model would fail validation. We should not enforce validity during sync from source editing.
Fixes is done for both schema model and wsdl model, which require additional changes in xam and xdm code: http://www.netbeans.org/source/browse/xml/xam/src/org/netbeans/modules/xml/xam/dom/Attic/AbstractDocumentComponent.java?r1=1.1.2.26.2.2&r2=1.1.2.26.2.3&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/xam/src/org/netbeans/modules/xml/xam/dom/Attic/AbstractDocumentModel.java?r1=1.1.2.23.6.1&r2=1.1.2.23.6.2&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/xam/src/org/netbeans/modules/xml/xam/AbstractComponent.java?r1=1.2.2.41&r2=1.2.2.41.2.1&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/xam/Attic/XDMAccess.java?r1=1.1.2.20&r2=1.1.2.20.6.1&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/schema/api/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncUpdateVisitor.java?r1=1.2.2.14&r2=1.2.2.14.6.1&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/schema/api/test/unit/src/org/netbeans/modules/xml/schema/model/impl/xdm/SyncTest.java?r1=1.1.2.31.2.1&r2=1.1.2.31.2.2&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/wsdl/api/src/org/netbeans/modules/xml/wsdl/model/impl/ChildComponentUpdateVisitor.java?r1=1.2.2.4&r2=1.2.2.4.6.1&only_with_tag=release55_dev http://www.netbeans.org/source/browse/xml/wsdl/api/test/unit/src/org/netbeans/modules/xml/wsdl/model/impl/SyncUpdateTest.java?r1=1.1.2.21.2.1&r2=1.1.2.21.2.2&only_with_tag=release55_dev
Fixes also checked into relesae55.
Verified in build060922.