[ 
https://issues.apache.org/jira/browse/CXF-8749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jim Ma updated CXF-8749:
------------------------
    Description: 
Use wsdl2java to generate code for two wsdls , and passing the same "-d" and 
"-classdir" flags to put the source files and compiled classes to one 
directory. The first wsdl file generated handler files always fails compiler 
the source files by the second wsdl. 
{code:java}
org.apache.cxf.tools.common.ToolException: FAIL_TO_COPY_GENERATED_RESOURCE_FILE
      at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:104)
      at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:295)
      at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
      at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402)
      at 
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
      at 
org.jboss.wsf.stack.cxf.tools.CXFConsumerImpl.consume(CXFConsumerImpl.java:303)
      at org.jboss.ws.tools.cmd.WSConsume.importServices(WSConsume.java:298)
      at org.jboss.ws.tools.cmd.WSConsume.mainInternal(WSConsume.java:108)
      at org.jboss.ws.tools.cmd.WSConsume.main(WSConsume.java:96)
  Caused by: java.nio.file.FileAlreadyExistsException: 
/Users/jimma/classes/generated-classes/Endpoint_handler.xml
      at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:551)
      at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
      at java.nio.file.Files.copy(Files.java:1274)
      at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:99)
      ... 9 more{code}
 

This issue is introduced by:
{code:java}
commit f5f08c838e1d52f17bcc8422fac38831a63e6e30
Author: Alexey Markevich <buhhu...@gmail.com>
Date:   Mon Nov 16 10:44:36 2020 +0300
    cxf-tools-common: use Files.copy

{code}
[https://github.com/apache/cxf/commit/f5f08c838e1d52f17bcc8422fac38831a63e6e30]

 

It's better to add a warning message instead of throwing exception which fails 
the compiling generated files.

  was:
Use wsdl2java to generate code for two wsdls , and passing the same "-d" and 
"-classdir" flags to put the source files and compiled classes to one 
directory. The first wsdl file generated handler files always fails compiler 
the source files by the second wsdl. 
{code:java}
org.apache.cxf.tools.common.ToolException: FAIL_TO_COPY_GENERATED_RESOURCE_FILE
      at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:104)
      at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:295)
      at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
      at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402)
      at 
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
      at 
org.jboss.wsf.stack.cxf.tools.CXFConsumerImpl.consume(CXFConsumerImpl.java:303)
      at org.jboss.ws.tools.cmd.WSConsume.importServices(WSConsume.java:298)
      at org.jboss.ws.tools.cmd.WSConsume.mainInternal(WSConsume.java:108)
      at org.jboss.ws.tools.cmd.WSConsume.main(WSConsume.java:96)
  Caused by: java.nio.file.FileAlreadyExistsException: 
/Users/jimma/classes/generated-classes/Endpoint_handler.xml
      at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:551)
      at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
      at java.nio.file.Files.copy(Files.java:1274)
      at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:99)
      ... 9 more{code}
 

This issue is introduced by:
{code:java}
commit f5f08c838e1d52f17bcc8422fac38831a63e6e30
Author: Alexey Markevich <buhhu...@gmail.com>
Date:   Mon Nov 16 10:44:36 2020 +0300
    cxf-tools-common: use Files.copy

{code}
[https://github.com/apache/cxf/commit/f5f08c838e1d52f17bcc8422fac38831a63e6e30]

 

Adding the option StandardCopyOption.REPLACE_EXISTING to Files.copy() will fix 
this issue and make it the same behavior with cxf-3.3.x. 


> Existing handler file fails the compile generated java source files
> -------------------------------------------------------------------
>
>                 Key: CXF-8749
>                 URL: https://issues.apache.org/jira/browse/CXF-8749
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 3.5.3
>            Reporter: Jim Ma
>            Assignee: Jim Ma
>            Priority: Major
>             Fix For: 4.0.0, 3.5.4
>
>
> Use wsdl2java to generate code for two wsdls , and passing the same "-d" and 
> "-classdir" flags to put the source files and compiled classes to one 
> directory. The first wsdl file generated handler files always fails compiler 
> the source files by the second wsdl. 
> {code:java}
> org.apache.cxf.tools.common.ToolException: 
> FAIL_TO_COPY_GENERATED_RESOURCE_FILE
>       at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:104)
>       at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:295)
>       at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
>       at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402)
>       at 
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
>       at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
>       at 
> org.jboss.wsf.stack.cxf.tools.CXFConsumerImpl.consume(CXFConsumerImpl.java:303)
>       at org.jboss.ws.tools.cmd.WSConsume.importServices(WSConsume.java:298)
>       at org.jboss.ws.tools.cmd.WSConsume.mainInternal(WSConsume.java:108)
>       at org.jboss.ws.tools.cmd.WSConsume.main(WSConsume.java:96)
>   Caused by: java.nio.file.FileAlreadyExistsException: 
> /Users/jimma/classes/generated-classes/Endpoint_handler.xml
>       at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:551)
>       at 
> sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
>       at java.nio.file.Files.copy(Files.java:1274)
>       at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:99)
>       ... 9 more{code}
>  
> This issue is introduced by:
> {code:java}
> commit f5f08c838e1d52f17bcc8422fac38831a63e6e30
> Author: Alexey Markevich <buhhu...@gmail.com>
> Date:   Mon Nov 16 10:44:36 2020 +0300
>     cxf-tools-common: use Files.copy
> {code}
> [https://github.com/apache/cxf/commit/f5f08c838e1d52f17bcc8422fac38831a63e6e30]
>  
> It's better to add a warning message instead of throwing exception which 
> fails the compiling generated files.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to