Community
Participate
Working Groups
Reported by Ling Hao: ===================== Case 1: 1. sapphire-gallery.xml -> List property editor 2. add a reference 3. edit the reference and clear the content and get the exception. Case 2: 1. sapphire-gallery.xml -> Actions 2. add a name 3. edit the name and clear the content and get the exception. java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.eclipse.sapphire.modeling.xml.XmlPath.getSegment(XmlPath.java:97) at org.eclipse.sapphire.modeling.xml.XmlElement.removeChildNode(XmlElement.java:797) at org.eclipse.sapphire.modeling.xml.XmlElement.removeChildNode(XmlElement.java:788) at org.eclipse.sapphire.modeling.xml.XmlElement.setChildNodeText(XmlElement.java:771) at org.eclipse.sapphire.modeling.xml.StandardXmlValueBindingImpl.write(StandardXmlValueBindingImpl.java:161)
The initial fix is to adjust xml binding specification: The following change is necessary to the Name property in IValuePropertyActionsGalleryReference and IValuePropertyActionsGalleryEntity. Original: @XmlBinding( path = "" ) Fix: @XmlValueBinding( path = "", removeNodeOnSetIfNull = false ) Explanation of the problem: What’s going on is that default xml value binding will remove bound XML node when the property is set to null. This is generally appropriate, but in this case the property is bound to the same XML element as its parent model element (path="" specification). Removing the xml element causes havoc for the parent model element. Leaving this bug open to track making xml binding smarter to avoid this situation in the first place.
Fixed the underlying issue and reverted the workarounds in samples. The real fix was to ignore removeNodeOnSetIfNull setting if path is empty (self reference).
Verified.