Marko Kocic created CXF-8838:
Summary: Regression in cxf-codegen-plugin wsdl2java 4.0.0
Key: CXF-8838
URL: https://issues.apache.org/jira/browse/CXF-8838
Project: CXF
Issue Type: Bug
Components: Tooling
Affects Versions: 4.0.0
Reporter: Marko Kocic
Fix For: 4.0.1
Attachments: test.zip
When trying to generate Java source code using wsdl2java from
cxf-codegen-plugin 4.0.0, the generation fails if there are element names that
differs only in underscore `_` character.
Attached is the minimal [^test.zip] project that demonstrates the issue.
In the attached wsdl file there are two elements that differ only in underscore
in the name:
{code:java}
{code}
When run using the 4.0.0 version of the plugin, building gives the error "Two
declarations cause a collision in the ObjectFactory class.". Exeprpt from the
build log:
{code:java}
[WARNING] Exception in thread "main" org.apache.cxf.tools.common.ToolException:
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[896,16]: Two declarations cause a collision in the ObjectFactory class.
[WARNING]
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[919,16]: (Related to above error) This is the other declaration.
[WARNING]
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[878,16]: Two declarations cause a collision in the ObjectFactory class.
[WARNING]
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[1006,16]: (Related to above error) This is the other declaration.
[WARNING]
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[879,16]: Two declarations cause a collision in the ObjectFactory class.
[WARNING]
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[1007,16]: (Related to above error) This is the other declaration.
[WARNING]
[WARNING] at
org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:158)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402)
[WARNING] at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
[WARNING] at
org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java.main(ForkOnceWSDL2Java.java:51)
[WARNING] Suppressed: org.apache.cxf.tools.common.ToolException:
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
[896,16]: Two declarations cause a collision in the ObjectFactory class.
[WARNING] ... 7 more
[WARNING] Caused by: com.sun.istack.SAXParseException2publicId:
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl;
systemId:
file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl;
lineNumber: 896; columnNumber: 16; Two declarations cause a collision in the
ObjectFactory class.
[WARNING] at
com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at
com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:161)
[WARNING] at
com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:29)
[WARNING] at
com.sun.tools.xjc.generator.bean.BeanGenerator.(BeanGenerator.java:242)
[WARNING] at
com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:141)
[WARNING] at
com.sun.tools.xjc.model.Model.generateCode(Model.java:258)
[WARNING] at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:255)
[WARNING] at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:67)
[WARNING] at
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:445)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:711)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:259)
[WARNING] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
[WARNING] ... 5 more
[WARNING] Suppressed: org.