GabriRuflex commented on issue #275:
URL: https://github.com/apache/mina-sshd/issues/275#issuecomment-1326138558

   > Sorry for not having been clear enough: I'm interested in the debug log of 
your _Java client that is using Apache MINA SSHD and that is getting the 
exception_. And please show the full log from the initial connection to the 
exception.
   
   This is the code:
   
   ```
       public static void upload() {
           ...
           byte[] localfileBytes;
           try {
               localfileBytes = new 
FileInputStream(localfilepath).readAllBytes();
           } catch (FileNotFoundException ignored) { }
           try (SshClient client = SshClient.setUpDefaultClient()) {
               
client.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE, 
HEARTBEAT);
               client.start();
               try (ClientSession session = client.connect(username, 
remotehost, remoteport).verify(WAIT).getSession()) {
                   session.addPasswordIdentity(password);
                   try {
                       session.auth().verify(WAIT);
                   } catch (IOException ignored) { }
                   try (SftpClient sftp = 
DefaultSftpClientFactory.INSTANCE.createSftpClient(session)) {
                       try (SftpClient.CloseableHandle handle = 
sftp.open(remotefilepath, EnumSet.of(SftpClient.OpenMode.Write, 
SftpClient.OpenMode.Create))) {
                           sftp.write(handle, 0, localfileBytes, 0, 
localfileBytes.length);
                       } catch (IOException ignored) { }
                   } catch (IOException ignored) { }
               } catch (IOException ignored) { }
           } catch (IOException ignored) { }
       }
   ```


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

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