mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
All tryToClose() methods should check for null arguments.
This commit is contained in:
@@ -209,6 +209,10 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
tryToClose(socket);
|
||||
return;
|
||||
}
|
||||
if(LOG.isLoggable(INFO)) {
|
||||
String address = s.getRemoteDevice().getAddress();
|
||||
LOG.info("Connection from " + address);
|
||||
}
|
||||
callback.incomingConnectionCreated(wrapSocket(s));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,16 +404,16 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
}
|
||||
|
||||
private void tryToClose(ResultSet rs) {
|
||||
if(rs != null) try {
|
||||
rs.close();
|
||||
try {
|
||||
if(rs != null) rs.close();
|
||||
} catch(SQLException e) {
|
||||
if(LOG.isLoggable(WARNING))LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void tryToClose(Statement s) {
|
||||
if(s != null) try {
|
||||
s.close();
|
||||
try {
|
||||
if(s != null) s.close();
|
||||
} catch(SQLException e) {
|
||||
if(LOG.isLoggable(WARNING))LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
|
||||
private void tryToClose(StreamConnection s) {
|
||||
try {
|
||||
s.close();
|
||||
if(s != null) s.close();
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
|
||||
private void tryToClose(SerialPort port) {
|
||||
try {
|
||||
port.closePort();
|
||||
if(port != null) port.closePort();
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user