You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/06/08 10:14:58 UTC

[cxf] 02/02: CXF-8298 - An invalid package name is generated

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 9713d86acedbfa6be6375e7d494c2771cd438f05
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Mon Jun 8 11:14:27 2020 +0100

    CXF-8298 - An invalid package name is generated
---
 core/src/main/java/org/apache/cxf/common/util/PackageUtils.java     | 4 +++-
 core/src/test/java/org/apache/cxf/common/util/PackageUtilsTest.java | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/cxf/common/util/PackageUtils.java b/core/src/main/java/org/apache/cxf/common/util/PackageUtils.java
index 2c422e9..49e19ff 100644
--- a/core/src/main/java/org/apache/cxf/common/util/PackageUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/PackageUtils.java
@@ -132,12 +132,14 @@ public final class PackageUtils {
             String token = tokens.get(i);
             token = removeIllegalIdentifierChars(token);
 
+            token = token.toLowerCase();
+
             // this will check for reserved keywords
             if (JavaUtils.isJavaKeyword(token)) {
                 token = '_' + token;
             }
 
-            tokens.set(i, token.toLowerCase());
+            tokens.set(i, token);
         }
 
         // concat all the pieces and return it
diff --git a/core/src/test/java/org/apache/cxf/common/util/PackageUtilsTest.java b/core/src/test/java/org/apache/cxf/common/util/PackageUtilsTest.java
index 24ff807..6dad735 100644
--- a/core/src/test/java/org/apache/cxf/common/util/PackageUtilsTest.java
+++ b/core/src/test/java/org/apache/cxf/common/util/PackageUtilsTest.java
@@ -134,6 +134,10 @@ public class PackageUtilsTest {
                 PackageUtils.getPackageNameByNameSpaceURI("com.esendex.ems.soapinterface"));
         assertEquals("ddd.cc.bb.aa.eee.fff_v01_00",
                 PackageUtils.getPackageNameByNameSpaceURI("http://aa.bb.cc.ddd/eee/fff_v01.00"));
+        assertEquals("org.apache.cxf._case",
+                PackageUtils.getPackageNameByNameSpaceURI("http://www.case.cxf.apache.org"));
+        assertEquals("org.apache.cxf._case",
+                PackageUtils.getPackageNameByNameSpaceURI("http://www.Case.cxf.apache.org"));
     }
 
     @Test