cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [4/4] cxf git commit: [CXF-6161] Make sure wsdl import uses valid file name This closes #43
Date Fri, 24 Mar 2017 17:37:05 GMT
[CXF-6161] Make sure wsdl import uses valid file name
This closes #43


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

Branch: refs/heads/master
Commit: 02c11bb9191ce5712cb32e33bb5519362a9975d2
Parents: e70c78e
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Mar 24 11:05:04 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Mar 24 13:36:49 2017 -0400

----------------------------------------------------------------------
 core/src/main/java/org/apache/cxf/helpers/FileUtils.java        | 2 +-
 .../java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java   | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/02c11bb9/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/helpers/FileUtils.java b/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
index ded0785..5ebb23d 100644
--- a/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
@@ -48,7 +48,7 @@ public final class FileUtils {
 
     }
 
-    public boolean isValidFileName(String name) {
+    public static boolean isValidFileName(String name) {
         for (int i = name.length(); i > 0; i--) {
             char c = name.charAt(i - 1);
             for (char c2 : ILLEGAL_CHARACTERS) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/02c11bb9/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
index 29c623c..0b18dad 100644
--- a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
+++ b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
@@ -790,6 +790,7 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
             }
 
             //get imported wsdls
+            int wsdlImportCount = 0;
             List<Definition> defs = (List<Definition>)context.get(ToolConstants.IMPORTED_DEFINITION);
             Map<String, String> importWSDLMap = new HashMap<>();
             for (Definition importDef : defs) {
@@ -799,10 +800,12 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
                 } else {
                     importedWsdlFile = new File(importDef.getQName().getLocalPart() + ".wsdl");
                 }
+                if (!FileUtils.isValidFileName(importedWsdlFile.getName())) {
+                    importedWsdlFile = new File("import" + (++wsdlImportCount) + ".wsdl");
+                }
                 importWSDLMap.put(importDef.getTargetNamespace(), importedWsdlFile.getName());
             }
 
-
             OutputStreamCreator outputStreamCreator = null;
             if (context.get(OutputStreamCreator.class) != null) {
                 outputStreamCreator = context.get(OutputStreamCreator.class);


Mime
View raw message