cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/2] git commit: [CXF-6071] Make sure the Impl classnames is properly munged
Date Thu, 30 Oct 2014 16:20:35 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 136f9da77 -> 3a8c85dc0


[CXF-6071] Make sure the Impl classnames is properly munged

Conflicts:
	tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
	tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java


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

Branch: refs/heads/2.7.x-fixes
Commit: fb92352240d1579145571d26977340b60908de50
Parents: 136f9da
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Oct 30 11:02:50 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Oct 30 12:20:17 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/tools/util/NameUtil.java     | 15 ++++++++++-----
 .../frontend/jaxws/generators/ImplGenerator.java     |  3 ++-
 .../frontend/jaxws/generators/ServerGenerator.java   |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/fb923522/tools/common/src/main/java/org/apache/cxf/tools/util/NameUtil.java
----------------------------------------------------------------------
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/util/NameUtil.java b/tools/common/src/main/java/org/apache/cxf/tools/util/NameUtil.java
index 4023d6e..37fdae7 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/util/NameUtil.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/util/NameUtil.java
@@ -70,7 +70,7 @@ public final class NameUtil {
         return sb.toString();
     }
 
-    private static int nextBreak(String s, int start) {
+    private static int nextBreak(String s, int start, boolean allowUnderscore) {
         int n = s.length();
 
         char c1 = s.charAt(start);
@@ -84,7 +84,7 @@ public final class NameUtil {
 
             switch (ACTION_TABLE[t0 * 5 + t1]) {
             case ACTION_CHECK_PUNCT:
-                if (isPunct(c1)) {
+                if (isPunct(c1) && !(allowUnderscore && c1 == '_')) {
                     return i;
                 }
                 break;
@@ -146,13 +146,15 @@ public final class NameUtil {
         }
     }
 
-
     public static List<String> toWordList(String s) {
+        return toWordList(s, false);
+    }
+    public static List<String> toWordList(String s, boolean allowUnderscore) {
         List<String> ss = new ArrayList<String>();
         int n = s.length();
         for (int i = 0; i < n;) {
             while (i < n) {
-                if (!isPunct(s.charAt(i))) {
+                if ((allowUnderscore && s.charAt(i) == '_') || !isPunct(s.charAt(i)))
{
                     break;
                 }
                 i++;
@@ -161,7 +163,7 @@ public final class NameUtil {
                 break;
             }
 
-            int b = nextBreak(s, i);
+            int b = nextBreak(s, i, allowUnderscore);
             String w = (b == -1) ? s.substring(i) : s.substring(i, b);
             ss.add(escape(capitalize(w)));
             if (b == -1) {
@@ -258,6 +260,9 @@ public final class NameUtil {
     public static String mangleNameToClassName(String name) {
         return toMixedCaseName(toWordList(name), true);
     }
+    public static String mangleNameToClassName(String name, boolean allowUnderscores) {
+        return toMixedCaseName(toWordList(name, allowUnderscores), true);
+    }
 
     public static String mangleNameToVariableName(String name) {
         return toMixedCaseName(toWordList(name), false);

http://git-wip-us.apache.org/repos/asf/cxf/blob/fb923522/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
index 2f92416..2f37920 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
@@ -34,6 +34,7 @@ import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.common.model.JavaPort;
 import org.apache.cxf.tools.common.model.JavaServiceClass;
 import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.util.NameUtil;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 
 public class ImplGenerator extends AbstractJAXWSGenerator {
@@ -126,7 +127,7 @@ public class ImplGenerator extends AbstractJAXWSGenerator {
         }
         String name = nm.get(service + "/" + port);
         if (name == null) {
-            name = intf.getName() + "Impl";
+            name = NameUtil.mangleNameToClassName(intf.getName() + "Impl", true);
             name = mapClassName(intf.getPackageName(), name, penv);
             nm.put(service + "/" + port, name);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/fb923522/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
index ed20181..3941625 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServerGenerator.java
@@ -119,7 +119,7 @@ public class ServerGenerator extends AbstractJAXWSGenerator {
         }
         String name = nm.get(service + "/" + port);
         if (name == null) {
-            name = intf.getName() + "Impl";
+            name = NameUtil.mangleNameToClassName(intf.getName() + "Impl", true);
             name = mapClassName(intf.getPackageName(), name, penv);
             nm.put(service + "/" + port, name);
         }


Mime
View raw message