Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341557

Summary: @XmlElementBinding.Mapping(element="", type=ISomething.class) should trigger exception
Product: z_Archived Reporter: Shenxue Zhou <shenxue.zhou>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: konstantin
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Shenxue Zhou CLA 2011-03-31 17:54:50 EDT
element="" is illegal for the mapping annotation. But instead of pointing out this problem with a clear error message, Sapphire would throw the following exception:

Invalid Characer Error !STACK 0
org.w3c.dom.DOMException: Invalid Characer Error
	at org.eclipse.wst.xml.core.internal.document.DocumentImpl.createElementNS(DocumentImpl.java:400)
	at org.eclipse.sapphire.modeling.xml.XmlElement.addChildElement(XmlElement.java:531)
	at org.eclipse.sapphire.modeling.xml.XmlElement.addChildElement(XmlElement.java:559)
......
Comment 1 Konstantin Komissarchik CLA 2011-03-31 23:09:55 EDT
The illegal usage looks like the following examples:

@XmlElementBinding( mappings = @XmlElementBinding.Mapping( element = "", type = IMyElement.class ) )

@XmlListBinding( mappings = @XmlListBinding.Mapping( element = "", type = IMyElement.class ) )
Comment 2 Konstantin Komissarchik CLA 2011-03-31 23:12:06 EDT
Added a check and a better worded exception. Wrote two unit tests. The error messages look like this:

ITestXmlBinding0001ModelElement.TestProperty : Element name must be specified in @XmlElementBinding.Mapping annotation.

Should be pretty self-explanatory at this point.
Comment 3 Konstantin Komissarchik CLA 2011-03-31 23:12:18 EDT
Fixed.
Comment 4 Shenxue Zhou CLA 2011-04-01 18:36:32 EDT
Verified that there is a clear message for this case.