mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 05:51:08 +01:00
Introduce CloseableUtil
This commit is contained in:
parent
1136e8a2e9
commit
a00aa726fe
19 changed files with 109 additions and 256 deletions
|
|
@ -29,11 +29,11 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.util.CloseableUtil;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||
|
||||
|
|
@ -97,11 +97,7 @@ public class Socks5Client {
|
|||
}
|
||||
catch (SmackException e) {
|
||||
if (!socket.isClosed()) {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e2) {
|
||||
LOGGER.log(Level.WARNING, "Could not close SOCKS5 socket", e2);
|
||||
}
|
||||
CloseableUtil.maybeClose(socket, LOGGER);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.util.CloseableUtil;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -409,14 +410,7 @@ public final class Socks5Proxy {
|
|||
*/
|
||||
}
|
||||
catch (Exception e) {
|
||||
try {
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e1) {
|
||||
/* do nothing */
|
||||
}
|
||||
CloseableUtil.maybeClose(socket, LOGGER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue