You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/03/31 19:29:54 UTC

[2/3] cxf git commit: [CXF-6731/CXF-6580] Fix bug introduced by CXF-6580

[CXF-6731/CXF-6580] Fix bug introduced by CXF-6580


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7228709b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7228709b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7228709b

Branch: refs/heads/master
Commit: 7228709bff3fe66626830b0018547d001588da00
Parents: b12d8a0
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 31 14:22:50 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 31 14:22:50 2017 -0400

----------------------------------------------------------------------
 .../wsdlto/databinding/jaxb/JAXBDataBinding.java     | 15 ++++++++++++---
 .../cxf/tools/wsdlto/jaxws/CodeGenBugTest.java       |  8 ++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/7228709b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
index 6860b01..50045ce 100644
--- a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
+++ b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
@@ -604,12 +604,12 @@ public class JAXBDataBinding implements DataBindingProfile {
         return result;
     }
 
-    @SuppressWarnings("unchecked")
     private void addSchemas(Options opts,
                             SchemaCompiler schemaCompiler,
                             SchemaCollection schemaCollection) {
 
         Set<String> ids = new HashSet<>();
+        @SuppressWarnings("unchecked")
         List<ServiceInfo> serviceList = (List<ServiceInfo>)context.get(ToolConstants.SERVICE_LIST);
         for (ServiceInfo si : serviceList) {
             for (SchemaInfo sci : si.getSchemas()) {
@@ -672,8 +672,10 @@ public class JAXBDataBinding implements DataBindingProfile {
                 continue;
             }
             String key = schema.getSourceURI();
+            String tns = schema.getTargetNamespace();
+            String ltns = schema.getLogicalTargetNamespace();
             // accepting also a null tns (e.g., reported by apache.ws.xmlschema for no-namespace)
-            if (ids.contains(key)) {
+            if (ids.contains(key) || (tns == null && !StringUtils.isEmpty(ltns))) {
                 continue;
             }
             if (key.startsWith("file:") || key.startsWith("jar:")) {
@@ -706,7 +708,14 @@ public class JAXBDataBinding implements DataBindingProfile {
                 }
             }
         }
-        ids.clear();
+        addSchemasForServiceInfos(catalog, serviceList, opts, schemaCompiler, schemaCollection);
+    }
+    private void addSchemasForServiceInfos(OASISCatalogManager catalog,
+                                           List<ServiceInfo> serviceList,
+                                          Options opts,
+                                          SchemaCompiler schemaCompiler,
+                                          SchemaCollection schemaCollection) {
+        Set<String> ids = new HashSet<>();
         for (ServiceInfo si : serviceList) {
             for (SchemaInfo sci : si.getSchemas()) {
                 String key = sci.getSystemId();

http://git-wip-us.apache.org/repos/asf/cxf/blob/7228709b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
index f1e28d6..4d67f65 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
@@ -1195,6 +1195,14 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
             fail("shouldn't get exception");
         }
     }
+    
+
+    @Test
+    public void testsdfasdf() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, "/Users/dkulp/Downloads/test/WSDL.wsdl");
+        processor.setContext(env);
+        processor.execute();
+    }
 
     @Test
     public void testCXF5280() throws Exception {