You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2020/10/09 11:35:45 UTC

[cxf] branch 3.3.x-fixes updated: CXF-8337: wsdl2java generates exceptions fields which do not follow naming convention (#699)

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

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.3.x-fixes by this push:
     new b5694d3  CXF-8337: wsdl2java generates exceptions fields which do not follow naming convention (#699)
b5694d3 is described below

commit b5694d3ed26a9b9f5fd2572b5f51b7612f757f5c
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Thu Oct 8 20:55:41 2020 -0400

    CXF-8337: wsdl2java generates exceptions fields which do not follow naming convention (#699)
    
    (cherry picked from commit d7d4e487c2902865659b227cb4778eaecd935968)
---
 .../apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm |  8 ++++----
 .../org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java    | 12 ++++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
index d61944f..ebf2b20 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
@@ -56,7 +56,7 @@ public class $expClass.Name extends $exceptionSuperclass {
 #if ($markGenerated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
-    $field.Modifier $field.ClassName $paraName;
+    $field.Modifier $field.ClassName faultInfo;
 
 #if ($markGenerated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
@@ -84,7 +84,7 @@ public class $expClass.Name extends $exceptionSuperclass {
 #end
     public ${expClass.Name}(String message, $field.ClassName $paraName) {
         super(message);
-        this.$paraName = $paraName;
+        this.faultInfo = $paraName;
     }
 
 #if ($markGenerated == "true")
@@ -92,14 +92,14 @@ public class $expClass.Name extends $exceptionSuperclass {
 #end
     public ${expClass.Name}(String message, $field.ClassName $paraName, java.lang.Throwable cause) {
         super(message, cause);
-        this.$paraName = $paraName;
+        this.faultInfo = $paraName;
     }
 
 #if ($markGenerated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
     public $field.ClassName getFaultInfo() {
-        return this.$paraName;
+        return this.faultInfo;
     }
 #end
 }
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 d7b654f..05ff010 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
@@ -56,10 +56,13 @@ import org.eclipse.jetty.server.handler.ResourceHandler;
 
 import org.junit.Test;
 
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -1059,6 +1062,15 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         WebFault webFault = AnnotationUtil.getPrivClassAnnotation(clz, WebFault.class);
         assertEquals("int", webFault.name());
     }
+    
+    @Test
+    public void testCXF8337() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+        Class<?> clz = classLoader.loadClass("org.apache.intfault.BadRecordLitFault");
+        assertThat(clz.getDeclaredField("faultInfo"), not(nullValue()));
+    }
 
     @Test
     public void testCXF1620() throws Exception {