You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jackie Noi (JIRA)" <ji...@codehaus.org> on 2013/01/26 23:54:13 UTC

[jira] (WAGON-354) Site deployment always fails with StringIndexOutOfBoundsException in SftpWagon

    [ https://jira.codehaus.org/browse/WAGON-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=318074#comment-318074 ] 

Jackie Noi commented on WAGON-354:
----------------------------------

This problem starts as of version 2.3 of maven-site-plugin - also in Maven 2. A temporary workaround is to downgrade to 2.2.
                
> Site deployment always fails with StringIndexOutOfBoundsException in SftpWagon
> ------------------------------------------------------------------------------
>
>                 Key: WAGON-354
>                 URL: https://jira.codehaus.org/browse/WAGON-354
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-ssh
>    Affects Versions: 1.0, 2.0
>         Environment: Maven 3.0.3, Site-Plugin 3.0, Wagon 2.0
>            Reporter: Juergen Kellerer
>            Priority: Critical
>             Fix For: backlog
>
>
> I always get StringIndexOutOfBoundsException on the attempt to deploy a site with SFTP using Maven 3 + Site Plugin 3.
> Calling *"mvn site-deploy"* causes:
> {noformat}
> ...
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error uploading site
>         at org.apache.maven.plugins.site.AbstractDeployMojo.push(AbstractDeployMojo.java:464)
>         at org.apache.maven.plugins.site.AbstractDeployMojo.deploy(AbstractDeployMojo.java:296)
>         at org.apache.maven.plugins.site.AbstractDeployMojo.deployTo(AbstractDeployMojo.java:257)
>         at org.apache.maven.plugins.site.AbstractDeployMojo.execute(AbstractDeployMojo.java:165)
>         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>         ... 19 more
> Caused by: org.apache.maven.wagon.TransferFailedException: Error occurred while deploying 'c:\Projects\OS\doxia-include\target\site' to remo
> te repository: sftp://web.sourceforge.net/home/groups/d/do/doxia-include/htdocs/:
>         at org.apache.maven.wagon.providers.ssh.jsch.SftpWagon.putDirectory(SftpWagon.java:286)
>         at org.apache.maven.plugins.site.AbstractDeployMojo.push(AbstractDeployMojo.java:447)
>         ... 24 more
> Caused by: 4:
>         at com.jcraft.jsch.ChannelSftp.mkdir(ChannelSftp.java:1713)
>         at org.apache.maven.wagon.providers.ssh.jsch.SftpWagon.mkdir(SftpWagon.java:204)
>         at org.apache.maven.wagon.providers.ssh.jsch.SftpWagon.ftpRecursivePut(SftpWagon.java:300)
>         at org.apache.maven.wagon.providers.ssh.jsch.SftpWagon.putDirectory(SftpWagon.java:277)
>         ... 25 more
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>         at java.lang.String.charAt(String.java:686)
>         at com.jcraft.jsch.ChannelSftp.remoteAbsolutePath(ChannelSftp.java:2367)
>         at com.jcraft.jsch.ChannelSftp.mkdir(ChannelSftp.java:1691)
>         ... 28 more
> {noformat}
> *The configuration is*:
> {code:xml} 
> <properties>
>   <application.id>doxia-include</application.id>
> </properties>
> <distributionManagement>
>   <site>
>     <id>${application.id}.shell.sourceforge.net</id>
>     <name>${application.id}.shell.sourceforge.net</name>
>     <url>sftp://web.sourceforge.net/home/groups/d/do/${application.id}/htdocs</url>
>   </site>
> {code} 
> (Btw. I tried variuous urls, "../htdocs", "../htdocs/" and "../htdocs/." but the site plugin always normalizes them to "../htdocs/", which is actually the right thing to do.)
> *My assumption why it happens:*
> I looked at the sources of wagon (particularly to the methods mentioned in the stack trace), and I think the issue seems to be that:
> - Site Plugin 3 always normalizes the remote directory to end with a trailing slash.
> - WagonSftp.putDirectory:277 calls ScpHelper.getResourceFilename( destinationDirectory ) on this directory which returns an empty string.
> - WagonSfto.ftpRecursivePut:300 calls mkdir with an empty string which causes the exception.
> Actually it looks as if older site plugins added a trailing "/." to the path instead of just "/" as otherwise it would have been broken before (I did not verify this). Nevertheless I think the bug is in the Wagon implementation as it should not fail if the destination is given like this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira