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:43:27 UTC
[cxf] 01/02: 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.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 6f9255fd70aa2b858ecdefb297093056539d8610
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)
(cherry picked from commit b5694d3ed26a9b9f5fd2572b5f51b7612f757f5c)
# Conflicts:
# tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
---
.../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 1e78b75..b93b880 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
@@ -54,6 +54,9 @@ import org.eclipse.jetty.server.handler.ResourceHandler;
import org.junit.Test;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
public class CodeGenBugTest extends AbstractCodeGenTest {
@Test
@@ -1010,6 +1013,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 {