cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1233006 - in /cxf/trunk: api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Date Wed, 18 Jan 2012 19:19:29 GMT
Author: dkulp
Date: Wed Jan 18 19:19:29 2012
New Revision: 1233006

URL: http://svn.apache.org/viewvc?rev=1233006&view=rev
Log:
[CXF-4042] Only remove the schemaLocations for the schemas that JAXB
actually generates

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

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=1233006&r1=1233005&r2=1233006&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java Wed Jan
18 19:19:29 2012
@@ -90,6 +90,13 @@ public abstract class AbstractDataBindin
 
     public XmlSchema addSchemaDocument(ServiceInfo serviceInfo, SchemaCollection col, Document
d,
                                        String systemId) {
+        return addSchemaDocument(serviceInfo, col, d, systemId, null);
+    }
+    public XmlSchema addSchemaDocument(ServiceInfo serviceInfo, 
+                                       SchemaCollection col, 
+                                       Document d,
+                                       String systemId,
+                                       Collection<String> ids) {
 
 
         /*
@@ -161,7 +168,10 @@ public abstract class AbstractDataBindin
                     Element e = (Element)n;
                     if (e.getLocalName().equals("import")) {
                         e = (Element)n;
-                        e.removeAttribute("schemaLocation");
+                        String loc = e.getAttribute("schemaLocation");
+                        if (ids == null || ids.contains(loc)) {
+                            e.removeAttribute("schemaLocation");
+                        }
                         updateSchemaLocation(e);
                         if (StringUtils.isEmpty(e.getAttribute("namespace"))) {
                             e.setAttribute("namespace", serviceInfo.getInterface().getName()

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=1233006&r1=1233005&r2=1233006&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Wed
Jan 18 19:19:29 2012
@@ -31,6 +31,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -351,6 +352,10 @@ public class JAXBDataBinding extends Abs
                     throw new ServiceConstructionException("SCHEMA_GEN_EXC", LOG, e);
                 }
             }
+            Set<String> ids = new HashSet<String>();
+            for (DOMSource r : schemas) {
+                ids.add(r.getSystemId());
+            }
             for (DOMSource r : schemas) {
                 if (bi.contains(r)) {
                     String ns = ((Document)r.getNode()).getDocumentElement().getAttribute("targetNamespace");



Mime
View raw message