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

Mike Summers commented on WAGON-461:
------------------------------------

Right, I tried that originally however pre-encoding the URI in the pom doesn't 
help as the URI is finally encoded farther down the code chain which then 
encodes the encoding.

pom.xml
{code:xml}
                     
<url>dav:https://snafu.sharefile-webdav.com/Shared%20Folders/Fit%20-%20Expert%20Services/IBM</url>
{code}

Stack trace:
{code:java}
[ERROR] Failed to execute goal 
org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (upload-assembly) on 
project synthetics-monitor-plugin: Error handling resource: Failed to transfer 
file: 
https://snafu.sharefile-webdav.com/Shared%2520Folders/Fit%2520-%2520Expert%2520Services/IBM/synthetics-monitor-plugin-1.0.0.jar.
 Return code is: 409 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (upload-assembly) on 
project synthetics-monitor-plugin: Error handling resource
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error handling 
resource
        at 
org.codehaus.mojo.wagon.AbstractSingleWagonMojo.execute(AbstractSingleWagonMojo.java:68)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
{code}
{color:red}
Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer 
file: 
https://snafu.sharefile-webdav.com/Shared%2520Folders/Fit%2520-%2520Expert%2520Services/IBM/synthetics-monitor-plugin-1.0.0.jar.
 Return code is: 409
{color}
{code:java}
        at 
org.apache.maven.wagon.providers.webdav.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:417)
        at 
org.apache.maven.wagon.providers.webdav.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:324)
        at 
org.apache.maven.wagon.providers.webdav.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:301)
        at 
org.apache.maven.wagon.providers.webdav.WebDavWagon.put(WebDavWagon.java:326)
        at 
org.codehaus.mojo.wagon.UploadSingleMojo.execute(UploadSingleMojo.java:70)
        at 
org.codehaus.mojo.wagon.AbstractSingleWagonMojo.execute(AbstractSingleWagonMojo.java:64)
        ... 22 more
{code}

wagon-ftp working on the unencoded pom URI is also an indication that 
pre-encoding the URI in the pom is probably not the right direction. I would 
think that both wagon-ftp and wagon-webdav would have the same interface 
contract with the plugin, but perhaps not.

Also, pre-encoding the URI doesn't make a lot of sense given that adding the 
encoding call to WebDavWagon does work.

If you have an alternate URI encoding you're thinking of please forward it and 
I'll give it a try.

Thanks.


> URL string not properly encoded by webdav
> -----------------------------------------
>
>                 Key: WAGON-461
>                 URL: https://issues.apache.org/jira/browse/WAGON-461
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-webdav
>    Affects Versions: 2.10
>         Environment: All
>            Reporter: Mike Summers
>
> wagon-webdav is not calling EncodingUtil prior to instantiating MkColMethod 
> which results in
> {code:java}
> Caused by: java.lang.IllegalArgumentException: Invalid uri 
> 'https://snafu.sharefile-webdav.com/Shared Folders/Fit - Expert 
> Services/IBM/': escaped absolute path not valid
> {code}
> when there are special characters in the URI string.
> Changing line 153 of org.apache.maven.wagon.providers.webdav.WebDavWagon from
> {code:java}
>             method = new MkColMethod( url );
> {code}
> to
> {code:java}
>             method = new MkColMethod( EncodingUtil.encodeURLToString( url ) );
> {code}
> solves the issue although you may want to fix it elsewhere in the flow.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to