You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Andrew Gaul (JIRA)" <ji...@apache.org> on 2014/03/27 00:10:14 UTC

[jira] [Commented] (JCLOUDS-508) Add length argument to SshClient.put() method

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

Andrew Gaul commented on JCLOUDS-508:
-------------------------------------

[~nwilton] ByteSource provides a size() method which you can populate ContentMetadata with.  We have debated whether to implicitly populate this for ByteSourcePayload, similar to how ByteArrayPayload worked.  It does seem like using an InputStreamPayload is dangerous here and we should provide a more eager error message in PutConnection.

> Add length argument to SshClient.put() method
> ---------------------------------------------
>
>                 Key: JCLOUDS-508
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-508
>             Project: jclouds
>          Issue Type: Improvement
>          Components: jclouds-core
>    Affects Versions: 1.7.1
>            Reporter: Nick Wilton
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Due to JCLOUDS-410 the only remaining Payload types are stream based.
> However, unfortunately the SshClient.put will not work unless a length is explicitly set using Payload.getContentMetadata().setContentLength(...), as the stream based payloads do not set this attribute (as there is no way of knowing how long a stream will be).
> Failure to set the content length, will cause a NullPointerException to occur in the net.schmizz.sshj library.
> I recommend that a length argument is added to the SshClient.put() argument, so that the user must specify the length when using this method. This is a much more friendly solution to modifying the payload meta data. 
> Cheers.



--
This message was sent by Atlassian JIRA
(v6.2#6252)