Skip to content

Commit

Permalink
Catch more SSH exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Dec 30, 2023
1 parent 43f771e commit 62c5e7d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/jasper/component/TunnelClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
import org.springframework.stereotype.Component;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
import java.util.concurrent.TimeUnit;

import static jasper.domain.proj.HasTags.authors;
Expand Down Expand Up @@ -84,18 +82,17 @@ public void banner(String banner) {
try (var tracker = session.createLocalPortForwardingTracker(LOCAL_HTTP_PORT, new SshdSocketAddress("localhost", httpPort[0]))) {
logger.debug("Opened reverse proxy in SSH tunnel.");
request.go(new URI("http://localhost:" + LOCAL_HTTP_PORT));
} catch (URISyntaxException e) {
} catch (Exception e) {
logger.debug("Error creating tunnel tracker", e);
throw new InvalidTunnelException("Error creating tunnel tracker", e);
}
} catch (IOException | GeneralSecurityException e) {
} catch (Exception e) {
logger.debug("Error creating tunnel SSH session", e);
logger.debug(e.getMessage());
throw new InvalidTunnelException("Error creating tunnel SSH session", e);
} finally {
client.stop();
}
} catch (IOException e) {
} catch (Exception e) {
logger.debug("Error creating tunnel SSH client", e);
throw new InvalidTunnelException("Error creating tunnel SSH client", e);
}
Expand Down

0 comments on commit 62c5e7d

Please sign in to comment.