jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Wagon
  • WAGON-354

Site deployment always fails with StringIndexOutOfBoundsException in SftpWagon

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: 1.0, 2.0
  • Fix Version/s: 2.3
  • Component/s: wagon-ssh
  • Labels:
    None
  • Environment:
    Maven 3.0.3, Site-Plugin 3.0, Wagon 2.0

Description

I always get StringIndexOutOfBoundsException on the attempt to deploy a site with SFTP using Maven 3 + Site Plugin 3.

Calling "mvn site-deploy" causes:

...
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

The configuration is:

<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>

(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.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Nicolas Richeton added a comment - 22/Nov/11 11:49 AM

I face the same issue. This totally prevents site deployment

Show
Nicolas Richeton added a comment - 22/Nov/11 11:49 AM I face the same issue. This totally prevents site deployment

People

  • Assignee:
    Unassigned
    Reporter:
    Juergen Kellerer
Vote (5)
Watch (6)

Dates

  • Created:
    22/Oct/11 5:01 AM
    Updated:
    13/Dec/11 3:28 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.