summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache/src/org/eclipse
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-07-21 19:53:47 +0200
committerThomas Wolf <thomas.wolf@paranor.ch>2021-07-21 16:06:57 -0400
commitcbb9188cdab672d5cc6f8632a3c64b837a29ebdd (patch)
treee4cd4852ff8d09da339b4a72c6a8e0e57a069bc4 /org.eclipse.jgit.ssh.apache/src/org/eclipse
parente2798413f9a2a8e7a701d1f7b5e5fac7399ed696 (diff)
downloadjgit-cbb9188cdab672d5cc6f8632a3c64b837a29ebdd.tar.gz
jgit-cbb9188cdab672d5cc6f8632a3c64b837a29ebdd.zip
[sshd] Minor code clean-up
Since upstream changed the method profile to throw Exception it's not necessary anymore to re-throw as IOException. Change-Id: I31afab4f6e1a2f0feef79e6abced20d0ca1c493b
Diffstat (limited to 'org.eclipse.jgit.ssh.apache/src/org/eclipse')
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java52
1 files changed, 19 insertions, 33 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java
index 2133a29ccc..f7b37d7816 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java
@@ -16,7 +16,6 @@ import java.io.IOException;
import java.io.StreamCorruptedException;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
-import java.security.GeneralSecurityException;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.Collection;
@@ -46,10 +45,10 @@ import org.apache.sshd.common.kex.DHFactory;
import org.apache.sshd.common.kex.KexProposalOption;
import org.apache.sshd.common.kex.KeyExchangeFactory;
import org.apache.sshd.common.kex.extension.KexExtensionHandler;
+import org.apache.sshd.common.kex.extension.KexExtensionHandler.AvailabilityPhase;
import org.apache.sshd.common.kex.extension.KexExtensions;
import org.apache.sshd.common.keyprovider.KeyPairProvider;
import org.apache.sshd.common.signature.BuiltinSignatures;
-import org.apache.sshd.common.kex.extension.KexExtensionHandler.AvailabilityPhase;
import org.apache.sshd.common.util.Readable;
import org.apache.sshd.common.util.buffer.Buffer;
import org.eclipse.jgit.errors.InvalidPatternException;
@@ -152,23 +151,16 @@ public class JGitClientSession extends ClientSessionImpl {
List<String> extraLines) throws Exception {
StatefulProxyConnector proxy = proxyHandler;
if (proxy != null) {
- try {
- // We must not block here; the framework starts reading messages
- // from the peer only once the initial sendKexInit() following
- // this call to sendIdentification() has returned!
- proxy.runWhenDone(() -> {
- JGitClientSession.super.sendIdentification(ident,
- extraLines);
- return null;
- });
- // Called only from the ClientSessionImpl constructor, where the
- // return value is ignored.
+ // We must not block here; the framework starts reading messages
+ // from the peer only once the initial sendKexInit() following
+ // this call to sendIdentification() has returned!
+ proxy.runWhenDone(() -> {
+ JGitClientSession.super.sendIdentification(ident, extraLines);
return null;
- } catch (IOException e) {
- throw e;
- } catch (Exception other) {
- throw new IOException(other.getLocalizedMessage(), other);
- }
+ });
+ // Called only from the ClientSessionImpl constructor, where the
+ // return value is ignored.
+ return null;
}
return super.sendIdentification(ident, extraLines);
}
@@ -177,22 +169,16 @@ public class JGitClientSession extends ClientSessionImpl {
protected byte[] sendKexInit() throws Exception {
StatefulProxyConnector proxy = proxyHandler;
if (proxy != null) {
- try {
- // We must not block here; the framework starts reading messages
- // from the peer only once the initial sendKexInit() has
- // returned!
- proxy.runWhenDone(() -> {
- JGitClientSession.super.sendKexInit();
- return null;
- });
- // This is called only from the ClientSessionImpl
- // constructor, where the return value is ignored.
+ // We must not block here; the framework starts reading messages
+ // from the peer only once the initial sendKexInit() has
+ // returned!
+ proxy.runWhenDone(() -> {
+ JGitClientSession.super.sendKexInit();
return null;
- } catch (IOException | GeneralSecurityException e) {
- throw e;
- } catch (Exception other) {
- throw new IOException(other.getLocalizedMessage(), other);
- }
+ });
+ // This is called only from the ClientSessionImpl
+ // constructor, where the return value is ignored.
+ return null;
}
return super.sendKexInit();
}