CXF XCJ DV Plugin removes XmlElement Annotation from Fields
-----------------------------------------------------------

                 Key: CXF-3131
                 URL: https://issues.apache.org/jira/browse/CXF-3131
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.3.0
            Reporter: Andreas Gudian
            Priority: Critical


Using the XJC default value plugin (org.apache.cxf.xjcplugins:cxf-xjc-dv) 
removes the @XmlElement(name=...) annotation from fields where it adds a 
default value.

For example, see the following XSD fragment:
{code:xml}
<xs:complexType name="TypeA">
   <xs:sequence>
      <xs:element name="Customer" 
type="tns:customerTypeWithDefaultValuesInside" />
   </xs:sequence>
</xs:complexType>
{code}

*Without* dv, the following code is generated:
{code:title=TypeA.java}
...
    @XmlElement(name = "Customer", required = true)
    protected CustomerTypeWithDefaultValuesInside customer;
...
{code}

Now, *With* -X-dv, the following code is generated:
{code:title=TypeA.java}
...
    /*
    *
    */
    protected CustomerTypeWithDefaultValuesInside customer = new 
CustomerTypeWithDefaultValuesInside();
...
{code}

With the XmlElement annotation missing, the XML instance generated during 
marshalling contains an element {{<customer>}}, instead of {{<Customer>}} - 
which does not correspond to the definition in the XSD and is therefor invalid.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to