Skip to content

Commit 67476e0

Browse files
committed
code cleanup
1 parent 0f89805 commit 67476e0

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

src/main/java/com/testingbot/tunnel/Api.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void destroyTunnel() throws Exception {
8484

8585
if (app.getProxy() != null) {
8686
String[] splitted = app.getProxy().split(":");
87-
int port = splitted.length > 1 ? Integer.valueOf(splitted[1]) : 80;
87+
int port = splitted.length > 1 ? Integer.parseInt(splitted[1]) : 80;
8888
if (app.getProxyAuth() != null) {
8989
String[] credentials = app.getProxyAuth().split(":");
9090
CredentialsProvider credsProvider = new BasicCredentialsProvider();
@@ -117,7 +117,7 @@ private JSONObject _post(String url, List<NameValuePair> postData) throws Excep
117117

118118
if (app.getProxy() != null) {
119119
String[] splitted = app.getProxy().split(":");
120-
int port = splitted.length > 1 ? Integer.valueOf(splitted[1]) : 80;
120+
int port = splitted.length > 1 ? Integer.parseInt(splitted[1]) : 80;
121121
if (app.getProxyAuth() != null) {
122122
String[] credentials = app.getProxyAuth().split(":");
123123
CredentialsProvider credsProvider = new BasicCredentialsProvider();
@@ -176,7 +176,7 @@ private JSONObject _get(String url) throws Exception {
176176
HttpClientBuilder builder = HttpClientBuilder.create();
177177
if (app.getProxy() != null) {
178178
String[] splitted = app.getProxy().split(":");
179-
int port = splitted.length > 1 ? Integer.valueOf(splitted[1]) : 80;
179+
int port = splitted.length > 1 ? Integer.parseInt(splitted[1]) : 80;
180180
if (app.getProxyAuth() != null) {
181181
String[] credentials = app.getProxyAuth().split(":");
182182
CredentialsProvider credsProvider = new BasicCredentialsProvider();

src/main/java/com/testingbot/tunnel/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class App {
3838
private SSHTunnel tunnel;
3939
private String tunnelIdentifier;
4040
private String serverIP;
41-
private Map<String, String> customHeaders = new HashMap<>();
41+
private final Map<String, String> customHeaders = new HashMap<>();
4242
private int hubPort = 4444;
4343
private int tunnelID = 0;
4444
private int jettyPort = 0;
@@ -388,7 +388,7 @@ public void boot() throws Exception {
388388
api.setTunnelID(tunnelID);
389389
}
390390

391-
if (Float.parseFloat(tunnelData.getString("version")) > App.VERSION) {
391+
if (Float.valueOf(tunnelData.getString("version")) > App.VERSION) {
392392
System.err.println("A new version (" + tunnelData.getString("version") + ") is available for download at https://testingbot.com\nYou have version " + App.VERSION);
393393
}
394394

src/main/java/ssh/CustomConnectionMonitor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public CustomConnectionMonitor(SSHTunnel tunnel, App app) {
2323
this.app = app;
2424
}
2525

26+
@Override
2627
public void connectionLost(Throwable reason) {
2728
if (tunnel.isShuttingDown() == true) {
2829
return;
@@ -41,6 +42,7 @@ public void connectionLost(Throwable reason) {
4142

4243
class PollTask extends TimerTask {
4344
private int retryAttempts = 0;
45+
@Override
4446
public void run() {
4547
try {
4648
Logger.getLogger(CustomConnectionMonitor.class.getName()).log(Level.INFO, "Trying to re-establish SSH Connection");

src/main/java/ssh/SSHTunnel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public boolean isAuthenticated() {
100100
}
101101

102102
class PollTask extends TimerTask {
103+
@Override
103104
public void run() {
104105
try {
105106
// keep-alive attempt

src/main/java/ssh/TunnelPoller.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class TunnelPoller {
1616
private final App app;
1717
private final Timer timer;
1818
private final String tunnelID;
19-
private int pollerCount = 0;
2019

2120
public TunnelPoller(App app, String tunnelID) {
2221
this.app = app;

0 commit comments

Comments
 (0)