cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r548435 - /incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Date Mon, 18 Jun 2007 18:28:25 GMT
Author: dkulp
Date: Mon Jun 18 11:28:25 2007
New Revision: 548435

URL: http://svn.apache.org/viewvc?view=rev&rev=548435
Log:
[CXF-597] Only add the addressing types to the JAXB context if something uses our WS-Addressing
types.

Modified:
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?view=diff&rev=548435&r1=548434&r2=548435
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Mon Jun 18 11:28:25 2007
@@ -71,6 +71,8 @@
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.ObjectFactory;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
@@ -374,32 +376,32 @@
                 classes.remove(remoteExceptionObject);
             }
         }
-
+        // add user extra class into jaxb context
+        if (extraClass != null && extraClass.length > 0) {
+            for (Class clz : extraClass) {
+                classes.add(clz);
+            }
+        }
+        
         for (Class<?> clz : classes) {
             if (clz.getName().endsWith("ObjectFactory")) {
                 //kind of a hack, but ObjectFactories may be created with empty namespaces
                 defaultNs = null;
             }
         }
-        
-        try {
-            classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.AttributedQNameType"));
-            classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ObjectFactory"));
-            classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ServiceNameType"));
-        } catch (ClassNotFoundException e) {
-            // REVISIT - ignorable if WS-ADDRESSING not available?
-            // maybe add a way to allow interceptors to add stuff to the
-            // context?
-        }
-        try {
-            // add user extra class into jaxb context
-            if (extraClass != null && extraClass.length > 0) {
-                for (Class clz : extraClass) {
-                    classes.add(clz);
-                }
+
+        if (classes.contains(EndpointReferenceType.class)
+            || classes.contains(ObjectFactory.class)) {
+            //ws-addressing is used, lets add the specific types
+            try {
+                classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.AttributedQNameType"));
+                classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ObjectFactory"));
+                classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ServiceNameType"));
+            } catch (ClassNotFoundException e) {
+                // REVISIT - ignorable if WS-ADDRESSING not available?
+                // maybe add a way to allow interceptors to add stuff to the
+                // context?
             }
-        } catch (Exception e) {
-           //
         }
         
         Map<String, Object> map = new HashMap<String, Object>();



Mime
View raw message