[jira] [Commented] (AXIS2-5899) wsdl2java/xmlbeans issue on *nix

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (AXIS2-5899) wsdl2java/xmlbeans issue on *nix

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/AXIS2-5899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255305#comment-16255305 ]

robert lazarski commented on AXIS2-5899:
----------------------------------------

I'm a Linux user and I'll look into it. Can you provide a link to the sample.wsdl or attach it to this issue? Does the error happen on any wsdl file?

Does this error occur only for xmlbeans? Note that project was moved into the Apache attic years ago. That said, I know these commands worked on Linux at one point as I used xmlbeans as examples to write the Ant docs for Axis2.

> wsdl2java/xmlbeans issue on *nix
> --------------------------------
>
>                 Key: AXIS2-5899
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5899
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.4.1, 1.7.6
>         Environment: linux (debian/redhat)
> all axis2 versions impacted
>            Reporter: Mickael Pouliquen
>
> The wsdl2java command with xmlbeans code generation applied to a complex wsdl with schemas redefinitions FAILS on LINUX os but NOT on WINDOWS os:
> wsdl2java.sh -o out -d xmlbeans -or -noBuildXML -uri sample.wsdl
> ... error on *nix platforms only
> The issue was initially produced on axis2-1.4.1, reproduced on latest version axis2-1.7.6
> This platform specific issue comes from the method 'getFileFromURI' in "./modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java": the method remove the prefix of the url/uri-like path param. It works on windows, but on unix it removes the root slash.
>         private File getFileFromURI(String path) {
>             if(path.startsWith("file:///")){
>                             path = path.substring(8);
>             } else if(path.startsWith("file://")){
>                 path = path.substring(7);
>             } else if(path.startsWith("file:/")){
>                 path = path.substring(6);
>             }
>             return new File(path);
>         }
> Exemple,
> 'file:/drive:/dir1/dir2/file1' becomes 'drive:/dir1/dir2/file1' => OK
> 'file:/dir1/dir2/file1' becomes 'dir1/dir2/file1' => KO
> A fix could be:
> private File getFileFromURI(String path) {
>             //on windows, will remove the 'file:' prefix and ALL slashes
>             //on unix, will remove the 'file:' prefix and keep the ROOT slash
>             int offset = "/".equals(File.separator) ? 1 : 0;
>             if(path.startsWith("file:///")){
>                             path = path.substring(8-offset);
>             } else if(path.startsWith("file://")){
>                 path = path.substring(7-offset);
>             } else if(path.startsWith("file:/")){
>                 path = path.substring(6-offset);
>             }
>             return new File(path);
>         }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]