瀏覽代碼

Added parameter check and documentation for ScpClient.Download(string,Stream).

Kenneth_aa_cp 13 年之前
父節點
當前提交
b81427b86b
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Renci.SshClient/Renci.SshNet/ScpClient.cs

+ 9 - 0
Renci.SshClient/Renci.SshNet/ScpClient.cs

@@ -170,8 +170,17 @@ namespace Renci.SshNet
         /// </summary>
         /// <param name="filename">Remote host file name.</param>
         /// <param name="destination">The stream where to download remote file.</param>
+        /// <exception cref="ArgumentException"><paramref name="filename"/> is null or contains whitespace characters.</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="destination"/> is null.</exception>
+        /// <remarks>Method calls made by this method to <paramref name="destination"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
         public void Download(string filename, Stream destination)
         {
+            if (filename.IsNullOrWhiteSpace())
+                throw new ArgumentException("filename");
+
+            if (destination == null)
+                throw new ArgumentNullException("destination");
+
             using (var input = new PipeStream())
             using (var channel = this.Session.CreateChannel<ChannelSession>())
             {