cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r781841 - /cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Date Thu, 04 Jun 2009 19:44:22 GMT
Author: dkulp
Date: Thu Jun  4 19:44:21 2009
New Revision: 781841

URL: http://svn.apache.org/viewvc?rev=781841&view=rev
Log:
[CXF-2241] Don't set default values for abstract classes.

Modified:
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=781841&r1=781840&r2=781841&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Thu Jun  4 19:44:21 2009
@@ -663,7 +663,14 @@
                 typeAnno = mapping.getType();
             }
         }
-        if (typeAnno != null) { 
+        if (typeAnno != null && typeAnno.getTypeClass() instanceof JDefinedClass)
{
+            JDefinedClass dc = (JDefinedClass)typeAnno.getTypeClass();
+            if (dc.isAbstract()) {
+                //no default values for abstract classes
+                typeAnno = null;
+            }
+        }
+        if (typeAnno != null) {
             final JType type = typeAnno.getTypeClass();
             return new JAXBDefaultValueWriter(type);
         } 
@@ -678,6 +685,13 @@
                 for (Property pro : propList) {
                     if (pro.elementName().getNamespaceURI().equals(item.getNamespaceURI())
                         && pro.elementName().getLocalPart().equals(item.getLocalPart()))
{
+                        
+                        JType type = pro.type();
+                        if (type instanceof JDefinedClass
+                            && ((JDefinedClass)type).isAbstract()) {
+                            //no default values for abstract classes
+                            return null;
+                        }
                         return new JAXBDefaultValueWriter(pro.type());
                     }
                 }
@@ -732,6 +746,8 @@
                         ex.initCause(e);
                         throw ex;
                     }
+                } else if (jdc.isAbstract()) {
+                    writer.write("null;");
                 } else {
                     writer.write("new ");
                     writer.write(tp.fullName());



Mime
View raw message