[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
This commit is contained in:
parent
e2798413f9
commit
cbb9188cda
|
@ -16,7 +16,6 @@
|
||||||
import java.io.StreamCorruptedException;
|
import java.io.StreamCorruptedException;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.GeneralSecurityException;
|
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -46,10 +45,10 @@
|
||||||
import org.apache.sshd.common.kex.KexProposalOption;
|
import org.apache.sshd.common.kex.KexProposalOption;
|
||||||
import org.apache.sshd.common.kex.KeyExchangeFactory;
|
import org.apache.sshd.common.kex.KeyExchangeFactory;
|
||||||
import org.apache.sshd.common.kex.extension.KexExtensionHandler;
|
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.kex.extension.KexExtensions;
|
||||||
import org.apache.sshd.common.keyprovider.KeyPairProvider;
|
import org.apache.sshd.common.keyprovider.KeyPairProvider;
|
||||||
import org.apache.sshd.common.signature.BuiltinSignatures;
|
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.Readable;
|
||||||
import org.apache.sshd.common.util.buffer.Buffer;
|
import org.apache.sshd.common.util.buffer.Buffer;
|
||||||
import org.eclipse.jgit.errors.InvalidPatternException;
|
import org.eclipse.jgit.errors.InvalidPatternException;
|
||||||
|
@ -152,23 +151,16 @@ protected IoWriteFuture sendIdentification(String ident,
|
||||||
List<String> extraLines) throws Exception {
|
List<String> extraLines) throws Exception {
|
||||||
StatefulProxyConnector proxy = proxyHandler;
|
StatefulProxyConnector proxy = proxyHandler;
|
||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
try {
|
// We must not block here; the framework starts reading messages
|
||||||
// We must not block here; the framework starts reading messages
|
// from the peer only once the initial sendKexInit() following
|
||||||
// from the peer only once the initial sendKexInit() following
|
// this call to sendIdentification() has returned!
|
||||||
// this call to sendIdentification() has returned!
|
proxy.runWhenDone(() -> {
|
||||||
proxy.runWhenDone(() -> {
|
JGitClientSession.super.sendIdentification(ident, extraLines);
|
||||||
JGitClientSession.super.sendIdentification(ident,
|
|
||||||
extraLines);
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
// Called only from the ClientSessionImpl constructor, where the
|
|
||||||
// return value is ignored.
|
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
});
|
||||||
throw e;
|
// Called only from the ClientSessionImpl constructor, where the
|
||||||
} catch (Exception other) {
|
// return value is ignored.
|
||||||
throw new IOException(other.getLocalizedMessage(), other);
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return super.sendIdentification(ident, extraLines);
|
return super.sendIdentification(ident, extraLines);
|
||||||
}
|
}
|
||||||
|
@ -177,22 +169,16 @@ protected IoWriteFuture sendIdentification(String ident,
|
||||||
protected byte[] sendKexInit() throws Exception {
|
protected byte[] sendKexInit() throws Exception {
|
||||||
StatefulProxyConnector proxy = proxyHandler;
|
StatefulProxyConnector proxy = proxyHandler;
|
||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
try {
|
// We must not block here; the framework starts reading messages
|
||||||
// We must not block here; the framework starts reading messages
|
// from the peer only once the initial sendKexInit() has
|
||||||
// from the peer only once the initial sendKexInit() has
|
// returned!
|
||||||
// returned!
|
proxy.runWhenDone(() -> {
|
||||||
proxy.runWhenDone(() -> {
|
JGitClientSession.super.sendKexInit();
|
||||||
JGitClientSession.super.sendKexInit();
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
// This is called only from the ClientSessionImpl
|
|
||||||
// constructor, where the return value is ignored.
|
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException | GeneralSecurityException e) {
|
});
|
||||||
throw e;
|
// This is called only from the ClientSessionImpl
|
||||||
} catch (Exception other) {
|
// constructor, where the return value is ignored.
|
||||||
throw new IOException(other.getLocalizedMessage(), other);
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return super.sendKexInit();
|
return super.sendKexInit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue