1
0
mirror of synced 2025-12-25 02:09:19 -05:00

Follow-up fix for SSHExceptions (#18383)

* Follow-up fix for SSHExceptions

* Catch RuntimeException instead of augmenting connection error messaging for now

* Update tests

* Bump versions + docs

* auto-bump connector version

* auto-bump connector version

* auto-bump connector version

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
This commit is contained in:
Akash Kulkarni
2022-10-25 15:06:03 -07:00
committed by GitHub
parent 30a8d1767e
commit b0a8e5473f
15 changed files with 254 additions and 247 deletions

View File

@@ -303,7 +303,7 @@ public class SshTunnel implements AutoCloseable {
* @see <a href=
* "https://javadoc.io/static/org.apache.sshd/sshd-common/2.8.0/org/apache/sshd/common/config/keys/loader/KeyPairResourceLoader.html#loadKeyPairs-org.apache.sshd.common.session.SessionContext-org.apache.sshd.common.util.io.resource.IoResource-org.apache.sshd.common.config.keys.FilePasswordProvider-">loadKeyPairs()</a>
*/
KeyPair getPrivateKeyPair() throws IOException, GeneralSecurityException, ConnectionErrorException {
KeyPair getPrivateKeyPair() throws IOException, GeneralSecurityException {
final String validatedKey = validateKey();
final var keyPairs = SecurityUtils
.getKeyPairResourceParser()
@@ -312,7 +312,7 @@ public class SshTunnel implements AutoCloseable {
if (keyPairs != null && keyPairs.iterator().hasNext()) {
return keyPairs.iterator().next();
}
throw new ConnectionErrorException("Unable to load private key pairs, verify key pairs are properly inputted");
throw new RuntimeException("Unable to load private key pairs, verify key pairs are properly inputted");
}
private String validateKey() {

View File

@@ -67,7 +67,7 @@ public class SshWrappedDestination implements Destination {
try {
return (endPointKey != null) ? SshTunnel.sshWrap(config, endPointKey, delegate::check)
: SshTunnel.sshWrap(config, hostKey, portKey, delegate::check);
} catch (final SshException | ConnectionErrorException e) {
} catch (final RuntimeException e) {
final String sshErrorMessage = "Could not connect with provided SSH configuration. Error: " + e.getMessage();
AirbyteTraceMessageUtility.emitConfigErrorTrace(e, sshErrorMessage);
return new AirbyteConnectionStatus()

View File

@@ -43,7 +43,7 @@ public class SshWrappedSource implements Source {
public AirbyteConnectionStatus check(final JsonNode config) throws Exception {
try {
return SshTunnel.sshWrap(config, hostKey, portKey, delegate::check);
} catch (final SshException | ConnectionErrorException e) {
} catch (final RuntimeException e) {
final String sshErrorMessage = "Could not connect with provided SSH configuration. Error: " + e.getMessage();
AirbyteTraceMessageUtility.emitConfigErrorTrace(e, sshErrorMessage);
return new AirbyteConnectionStatus()