sshtools / maverick-synergy

Next Generation Java SSH API
https://jadaptive.com
GNU Lesser General Public License v3.0
96 stars 26 forks source link

SSH Client Put File Throws No connection or client supplied. #84

Closed cpmoore closed 1 month ago

cpmoore commented 8 months ago

Hi ya, The ssh client command throws an IllegalArgumentException due to the following line

https://github.com/sshtools/maverick-synergy/blob/d6afd03d11d338f42cc3054803a9e61fd558e3c8/maverick-synergy-client/src/main/java/com/sshtools/client/tasks/AbstractConnectionTask.java#L84

The orElse is evaluated before returning the connection, which in turn gets evaluated to the orElseThrow since clientSupplier is empty It needs to be converted to an orElseGet like

super(builder.connection.orElseGet(() -> builder.clientSupplier.orElseThrow(() -> new IllegalArgumentException("No connection or client supplied.")).apply(0).getConnection()));
ludup commented 7 months ago

Thanks for the information. We have confirmed this and applied the change to the 3.1.2-SNAPSHOT, which should be published to maven shortly and committed to the develop_3.1.x branch.

amcarthur commented 6 months ago

Any idea when 3.1.2 will be released? Either I'm too dumb to properly add the sonatype snapshot repo to my gradle config, or my company disabled snapshots somehow

Edit: never mind, our maven repo mirror is just slow. Should sync your snapshots eventually

laurentiustroia commented 3 months ago

Hi guys, this issue is for any usage of putFile call ? I follow this example https://jadaptive.com/java-ssh-library/ssh-client-quick-start/ but I got java.lang.IllegalArgumentException: No connection or client supplied. on ssh.putFile request

ludup commented 1 month ago

3.1.2 uploaded to github releases, it is also in Maven Central. Closing.