CXF-XJC-DV doesn not respect Abstract schema types
--------------------------------------------------

                 Key: CXF-2707
                 URL: https://issues.apache.org/jira/browse/CXF-2707
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.2.1
            Reporter: Jan Arend Jansen
            Priority: Minor


The cxf-xjc-dv plugin creates default values for complex types that have 
default simpl typed elements as fixed in CXF-1206.
{code:xml}
<xs:complexType name="pageColor">
  <xs:sequence>
     <xs:element name="background" type="xs:string" default="red"/>
     <xs:element name="foreground" type="xs:string" default="blue"/>
   </xs:sequence>
</xs:complexType>

<xs:element name="pageColor" type="tns:pageColor" minOccurs="0"></xs:element>
{code}

results in 

{code}
protected PageColor pageColor = new PageColor();
{code}

This fails if PageColor is defined as abstract="true" in the schema (used as 
polymorphic type in element pageColor). In that case the line above will create 
a compilation error. 

It can be fixed by simply skipping the generation of the default 'new 
PageColor();' in those cases.  
Line 81 in DefaultValuePlugin.java would become
{code}
            if (classOutline.implClass == field.getRawType() && 
!classOutline.implClass.isAbstract()) {
{code}

-- 
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