fioan89 opened a new issue, #401:
URL: https://github.com/apache/mina-sshd/issues/401

   ### Version
   
   2.10.0
   
   ### Bug description
   
   When using the SCP client to upload a file to a remote location that does 
not exist a `WindowClosedException` is raised instead of a more user friendly 
SCP exception detailing the reason of why the upload/download failed. 
   
   The snippet of code below raises a `WindowClosedException` exception when 
`/remote/path/that/does/not/exist`  doesn't exist.
   ```
   val session = sshClient.connect(
       username,
       hostname,
       port
   ).verify(5000).session
   session.auth().await(5000)
   
   scpClient = ScpClientCreator.instance().createScpClient(session)
   scpClient.upload("/local/path/file_name",  
"/remote/path/that/does/not/exist/file_name", options)
   ```
   
   
   ### Actual behavior
   
   ```
   e = {WindowClosedException@37364} 
"org.apache.sshd.common.channel.WindowClosedException: Already closed: 
RemoteWindow[client](ChannelExec[id=0, 
recipient=0]-ClientSessionImpl[ifaur@localhost/127.0.0.1:2222])"
    disconnectCode = 0
    backtrace = {Object[6]@37368} 
    detailMessage = "Already closed: RemoteWindow[client](ChannelExec[id=0, 
recipient=0]-ClientSessionImpl[ifaur@localhost/127.0.0.1:2222])"
    cause = {WindowClosedException@37364} 
"org.apache.sshd.common.channel.WindowClosedException: Already closed: 
RemoteWindow[client](ChannelExec[id=0, 
recipient=0]-ClientSessionImpl[ifaur@localhost/127.0.0.1:2222])"
    stackTrace = {StackTraceElement[39]@37373} 
     0 = {StackTraceElement@41979} 
"org.apache.sshd.common.channel.RemoteWindow.waitForCondition(RemoteWindow.java:230)"
     1 = {StackTraceElement@41980} 
"org.apache.sshd.common.channel.RemoteWindow.waitForSpace(RemoteWindow.java:187)"
     2 = {StackTraceElement@41981} 
"org.apache.sshd.common.channel.ChannelOutputStream.flush(ChannelOutputStream.java:278)"
     3 = {StackTraceElement@41982} 
"org.apache.sshd.scp.common.helpers.ScpIoUtils.writeLine(ScpIoUtils.java:82)"
     4 = {StackTraceElement@41983} 
"org.apache.sshd.scp.common.helpers.ScpIoUtils.sendAcknowledgedCommand(ScpIoUtils.java:94)"
     5 = {StackTraceElement@41984} 
"org.apache.sshd.scp.common.ScpHelper.sendAcknowledgedCommand(ScpHelper.java:724)"
     6 = {StackTraceElement@41985} 
"org.apache.sshd.scp.common.ScpHelper.sendDir(ScpHelper.java:686)"
     7 = {StackTraceElement@41986} 
"org.apache.sshd.scp.common.ScpHelper.send(ScpHelper.java:484)"
     8 = {StackTraceElement@41987} 
"org.apache.sshd.scp.common.ScpHelper.send(ScpHelper.java:454)"
     9 = {StackTraceElement@41988} 
"org.apache.sshd.scp.client.AbstractScpClient.lambda$upload$0(AbstractScpClient.java:143)"
     10 = {StackTraceElement@41989} 
"org.apache.sshd.scp.client.DefaultScpClient.runUpload(DefaultScpClient.java:149)"
     11 = {StackTraceElement@41990} 
"org.apache.sshd.scp.client.AbstractScpClient.upload(AbstractScpClient.java:143)"
     12 = {StackTraceElement@41991} 
"org.apache.sshd.scp.client.ScpClient.upload(ScpClient.java:106)"
   ```
   
   ### Expected behavior
   
   a `SCPException` or even a basic `IOException` with a more relevant message: 
   - destination "/remote/path/that/does/not/exist/file_name" does not exist or 
could not be created
   -  "/remote/path/that/does/not/exist/file_name"  no such file or directory
   
   ### Relevant log output
   
   _No response_
   
   ### Other information
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to