forked from I2P_Developers/i2p.i2p
Cleanups: Close resources via try-finally
We can't use try-with-resources until we bump the minimum-supported Android version for the client library to API 19.
This commit is contained in:
@ -136,13 +136,15 @@ public class UrlLauncher implements ClientApp {
|
||||
long done = System.currentTimeMillis() + MAX_WAIT_TIME;
|
||||
for (int i = 0; i < MAX_TRIES; i++) {
|
||||
try {
|
||||
Socket test = new Socket();
|
||||
// this will usually fail right away if it's going to fail since it's local
|
||||
test.connect(sa, WAIT_TIME);
|
||||
// it worked
|
||||
Socket test = null;
|
||||
try {
|
||||
test.close();
|
||||
} catch (IOException ioe) {}
|
||||
test = new Socket();
|
||||
// this will usually fail right away if it's going to fail since it's local
|
||||
test.connect(sa, WAIT_TIME);
|
||||
// it worked
|
||||
} finally {
|
||||
if (test != null) try { test.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
// Jetty 6 seems to start the Connector before the
|
||||
// webapp is completely ready
|
||||
try {
|
||||
|
Reference in New Issue
Block a user