Log exceptions with stack traces.

This commit is contained in:
akwizgran
2012-12-07 15:22:34 +00:00
parent 90978fa9c6
commit 19106ae044
27 changed files with 135 additions and 130 deletions

View File

@@ -72,9 +72,9 @@ public class HelloWorldService extends RoboService {
if(LOG.isLoggable(INFO)) if(LOG.isLoggable(INFO))
LOG.info(pluginsStarted + " plugins started"); LOG.info(pluginsStarted + " plugins started");
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -89,9 +89,9 @@ public class HelloWorldService extends RoboService {
db.close(); db.close();
if(LOG.isLoggable(INFO)) LOG.info("Database closed"); if(LOG.isLoggable(INFO)) LOG.info("Database closed");
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -44,10 +44,10 @@ class DatabaseCleanerImpl extends TimerTask implements DatabaseCleaner {
} catch(DbClosedException e) { } catch(DbClosedException e) {
if(LOG.isLoggable(INFO)) LOG.info("Database closed, exiting"); if(LOG.isLoggable(INFO)) LOG.info("Database closed, exiting");
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
throw new Error(e); // Kill the application throw new Error(e); // Kill the application
} catch(RuntimeException e) { } catch(RuntimeException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
throw new Error(e); // Kill the application throw new Error(e); // Kill the application
} }
} }

View File

@@ -140,9 +140,11 @@ DatabaseCleaner.Callback {
close(); close();
} }
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} }
} }
}); });

View File

@@ -362,7 +362,7 @@ abstract class JdbcDatabase implements Database<Connection> {
if(s != null) try { if(s != null) try {
s.close(); s.close();
} catch(SQLException e) { } catch(SQLException e) {
if(LOG.isLoggable(WARNING))LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -370,7 +370,7 @@ abstract class JdbcDatabase implements Database<Connection> {
if(rs != null) try { if(rs != null) try {
rs.close(); rs.close();
} catch(SQLException e) { } catch(SQLException e) {
if(LOG.isLoggable(WARNING))LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -406,11 +406,11 @@ abstract class JdbcDatabase implements Database<Connection> {
} }
} catch(SQLException e) { } catch(SQLException e) {
// Try to close the connection // Try to close the connection
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
try { try {
txn.close(); txn.close();
} catch(SQLException e1) { } catch(SQLException e1) {
if(LOG.isLoggable(WARNING)) LOG.warning(e1.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e1.toString(), e1);
} }
// Whatever happens, allow the database to close // Whatever happens, allow the database to close
synchronized(connections) { synchronized(connections) {

View File

@@ -66,11 +66,11 @@ class AliceConnector extends Connector {
byte[] key = receivePublicKey(r); byte[] key = receivePublicKey(r);
secret = deriveSharedSecret(hash, key, true); secret = deriveSharedSecret(hash, key, true);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(conn, true); tryToClose(conn, true);
return; return;
} catch(GeneralSecurityException e) { } catch(GeneralSecurityException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(conn, true); tryToClose(conn, true);
return; return;
} }
@@ -84,7 +84,7 @@ class AliceConnector extends Connector {
if(receiveConfirmation(r)) group.remoteConfirmationSucceeded(); if(receiveConfirmation(r)) group.remoteConfirmationSucceeded();
else group.remoteConfirmationFailed(); else group.remoteConfirmationFailed();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(conn, true); tryToClose(conn, true);
group.remoteConfirmationFailed(); group.remoteConfirmationFailed();
return; return;

View File

@@ -66,11 +66,11 @@ class BobConnector extends Connector {
sendPublicKey(w); sendPublicKey(w);
secret = deriveSharedSecret(hash, key, false); secret = deriveSharedSecret(hash, key, false);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(conn, true); tryToClose(conn, true);
return; return;
} catch(GeneralSecurityException e) { } catch(GeneralSecurityException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(conn, true); tryToClose(conn, true);
return; return;
} }
@@ -84,7 +84,7 @@ class BobConnector extends Connector {
if(receiveConfirmation(r)) group.remoteConfirmationSucceeded(); if(receiveConfirmation(r)) group.remoteConfirmationSucceeded();
else group.remoteConfirmationFailed(); else group.remoteConfirmationFailed();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(conn, true); tryToClose(conn, true);
group.remoteConfirmationFailed(); group.remoteConfirmationFailed();
return; return;

View File

@@ -89,7 +89,7 @@ abstract class Connector extends Thread {
try { try {
conn.dispose(exception, true); conn.dispose(exception, true);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }

View File

@@ -134,7 +134,7 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
user32.DispatchMessage(msg); user32.DispatchMessage(msg);
} }
} catch(UnsatisfiedLinkError e) { } catch(UnsatisfiedLinkError e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -127,10 +127,10 @@ class PluginManagerImpl implements PluginManager {
+ " did not start"); + " did not start");
} }
} catch(ClassCastException e) { } catch(ClassCastException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
continue; continue;
} catch(Exception e) { } catch(Exception e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
continue; continue;
} }
} }
@@ -165,10 +165,10 @@ class PluginManagerImpl implements PluginManager {
+ " did not start"); + " did not start");
} }
} catch(ClassCastException e) { } catch(ClassCastException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
continue; continue;
} catch(Exception e) { } catch(Exception e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
continue; continue;
} }
} }
@@ -204,7 +204,7 @@ class PluginManagerImpl implements PluginManager {
plugin.stop(); plugin.stop();
stopped++; stopped++;
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
simplexPlugins.clear(); simplexPlugins.clear();
@@ -215,7 +215,7 @@ class PluginManagerImpl implements PluginManager {
plugin.stop(); plugin.stop();
stopped++; stopped++;
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
duplexPlugins.clear(); duplexPlugins.clear();
@@ -246,7 +246,7 @@ class PluginManagerImpl implements PluginManager {
try { try {
return db.getConfig(id); return db.getConfig(id);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return new TransportConfig(); return new TransportConfig();
} }
} }
@@ -256,7 +256,7 @@ class PluginManagerImpl implements PluginManager {
TransportProperties p = db.getLocalProperties(id); TransportProperties p = db.getLocalProperties(id);
return p == null ? new TransportProperties() : p; return p == null ? new TransportProperties() : p;
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return new TransportProperties(); return new TransportProperties();
} }
} }
@@ -265,7 +265,7 @@ class PluginManagerImpl implements PluginManager {
try { try {
return db.getRemoteProperties(id); return db.getRemoteProperties(id);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return Collections.emptyMap(); return Collections.emptyMap();
} }
} }
@@ -274,7 +274,7 @@ class PluginManagerImpl implements PluginManager {
try { try {
db.mergeConfig(id, c); db.mergeConfig(id, c);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -282,7 +282,7 @@ class PluginManagerImpl implements PluginManager {
try { try {
db.mergeLocalProperties(id, p); db.mergeLocalProperties(id, p);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }

View File

@@ -109,7 +109,7 @@ class BluetoothPlugin implements DuplexPlugin {
try { try {
scn = (StreamConnectionNotifier) Connector.open(url); scn = (StreamConnectionNotifier) Connector.open(url);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return; return;
} }
if(!running) { if(!running) {
@@ -133,7 +133,7 @@ class BluetoothPlugin implements DuplexPlugin {
try { try {
scn.close(); scn.close();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -144,7 +144,7 @@ class BluetoothPlugin implements DuplexPlugin {
s = scn.acceptAndOpen(); s = scn.acceptAndOpen();
} catch(IOException e) { } catch(IOException e) {
// This is expected when the socket is closed // This is expected when the socket is closed
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
tryToClose(scn); tryToClose(scn);
return; return;
} }
@@ -198,7 +198,7 @@ class BluetoothPlugin implements DuplexPlugin {
StreamConnection s = (StreamConnection) Connector.open(url); StreamConnection s = (StreamConnection) Connector.open(url);
return new BluetoothTransportConnection(s); return new BluetoothTransportConnection(s);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} }
} }
@@ -237,7 +237,7 @@ class BluetoothPlugin implements DuplexPlugin {
url = listener.waitForUrl(); url = listener.waitForUrl();
} catch(BluetoothStateException e) { } catch(BluetoothStateException e) {
if(LOG.isLoggable(WARNING)) if(LOG.isLoggable(WARNING))
LOG.warning(e.toString()); LOG.log(WARNING, e.toString(), e);
return null; return null;
} catch(InterruptedException e) { } catch(InterruptedException e) {
if(LOG.isLoggable(INFO)) if(LOG.isLoggable(INFO))
@@ -270,7 +270,7 @@ class BluetoothPlugin implements DuplexPlugin {
try { try {
scn = (StreamConnectionNotifier) Connector.open(url); scn = (StreamConnectionNotifier) Connector.open(url);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} }
if(!running) { if(!running) {
@@ -290,7 +290,7 @@ class BluetoothPlugin implements DuplexPlugin {
return new BluetoothTransportConnection(s); return new BluetoothTransportConnection(s);
} catch(IOException e) { } catch(IOException e) {
// This is expected when the socket is closed // This is expected when the socket is closed
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
return null; return null;
} finally { } finally {
if(f.cancel(false)) tryToClose(scn); if(f.cancel(false)) tryToClose(scn);
@@ -303,7 +303,7 @@ class BluetoothPlugin implements DuplexPlugin {
try { try {
localDevice.setDiscoverable(GIAC); localDevice.setDiscoverable(GIAC);
} catch(BluetoothStateException e) { } catch(BluetoothStateException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -48,7 +48,7 @@ class InvitationListener implements DiscoveryListener {
discoveryAgent.searchServices(null, uuids, device, this); discoveryAgent.searchServices(null, uuids, device, this);
searches.incrementAndGet(); searches.incrementAndGet();
} catch(BluetoothStateException e) { } catch(BluetoothStateException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }

View File

@@ -128,7 +128,7 @@ class DroidtoothPlugin implements DuplexPlugin {
try { try {
ss = InsecureBluetooth.listen(adapter, "RFCOMM", getUuid()); ss = InsecureBluetooth.listen(adapter, "RFCOMM", getUuid());
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return; return;
} }
if(!running) { if(!running) {
@@ -166,7 +166,7 @@ class DroidtoothPlugin implements DuplexPlugin {
try { try {
ss.close(); ss.close();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -177,7 +177,7 @@ class DroidtoothPlugin implements DuplexPlugin {
s = ss.accept(); s = ss.accept();
} catch(IOException e) { } catch(IOException e) {
// This is expected when the socket is closed // This is expected when the socket is closed
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
tryToClose(ss); tryToClose(ss);
return; return;
} }
@@ -246,7 +246,7 @@ class DroidtoothPlugin implements DuplexPlugin {
s.connect(); s.connect();
return new DroidtoothTransportConnection(s); return new DroidtoothTransportConnection(s);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} }
} }
@@ -298,7 +298,7 @@ class DroidtoothPlugin implements DuplexPlugin {
try { try {
ss = InsecureBluetooth.listen(adapter, "RFCOMM", uuid); ss = InsecureBluetooth.listen(adapter, "RFCOMM", uuid);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} }
// Return the first connection received by the socket, if any // Return the first connection received by the socket, if any
@@ -308,7 +308,7 @@ class DroidtoothPlugin implements DuplexPlugin {
if(LOG.isLoggable(INFO)) LOG.info("Invitation timed out"); if(LOG.isLoggable(INFO)) LOG.info("Invitation timed out");
return null; return null;
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} finally { } finally {
tryToClose(ss); tryToClose(ss);

View File

@@ -74,7 +74,7 @@ public abstract class FilePlugin implements SimplexPlugin {
OutputStream out = new FileOutputStream(f); OutputStream out = new FileOutputStream(f);
return new FileTransportWriter(f, out, capacity, this); return new FileTransportWriter(f, out, capacity, this);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
f.delete(); f.delete();
return null; return null;
} }
@@ -104,7 +104,8 @@ public abstract class FilePlugin implements SimplexPlugin {
callback.readerCreated(new FileTransportReader(file, in, callback.readerCreated(new FileTransportReader(file, in,
FilePlugin.this)); FilePlugin.this));
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -32,7 +32,7 @@ class FileTransportReader implements SimplexTransportReader {
try { try {
in.close(); in.close();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
if(recognised) { if(recognised) {
file.delete(); file.delete();

View File

@@ -43,7 +43,7 @@ class FileTransportWriter implements SimplexTransportWriter {
try { try {
out.close(); out.close();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
if(exception) file.delete(); if(exception) file.delete();
else plugin.writerFinished(file); else plugin.writerFinished(file);

View File

@@ -85,7 +85,7 @@ implements RemovableDriveMonitor.Callback {
if(i == -1) return null; if(i == -1) return null;
return drives.get(i); return drives.get(i);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} }
} }
@@ -114,7 +114,7 @@ implements RemovableDriveMonitor.Callback {
} }
} }
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
return Collections.unmodifiableList(matches); return Collections.unmodifiableList(matches);
} }
@@ -127,6 +127,6 @@ implements RemovableDriveMonitor.Callback {
} }
public void exceptionThrown(IOException e) { public void exceptionThrown(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }

View File

@@ -70,16 +70,16 @@ class LanTcpPlugin extends TcpPlugin {
addrs.add(new InetSocketAddress(addr, port)); addrs.add(new InetSocketAddress(addr, port));
addrs.add(new InetSocketAddress(addr, 0)); addrs.add(new InetSocketAddress(addr, 0));
} catch(NumberFormatException e) { } catch(NumberFormatException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(UnknownHostException e) { } catch(UnknownHostException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
List<NetworkInterface> ifaces; List<NetworkInterface> ifaces;
try { try {
ifaces = Collections.list(NetworkInterface.getNetworkInterfaces()); ifaces = Collections.list(NetworkInterface.getNetworkInterfaces());
} catch(SocketException e) { } catch(SocketException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return addrs; return addrs;
} }
// Prefer interfaces with link-local or site-local addresses // Prefer interfaces with link-local or site-local addresses
@@ -123,7 +123,7 @@ class LanTcpPlugin extends TcpPlugin {
ms.setInterface(iface); ms.setInterface(iface);
ms.joinGroup(mcast.getAddress()); ms.joinGroup(mcast.getAddress());
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
if(ms != null) tryToClose(ms, mcast.getAddress()); if(ms != null) tryToClose(ms, mcast.getAddress());
return null; return null;
} }
@@ -149,7 +149,7 @@ class LanTcpPlugin extends TcpPlugin {
return new TcpTransportConnection(s); return new TcpTransportConnection(s);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) if(LOG.isLoggable(WARNING))
LOG.warning(e.toString()); LOG.log(WARNING, e.toString(), e);
} }
} }
} catch(SocketTimeoutException e) { } catch(SocketTimeoutException e) {
@@ -161,7 +161,7 @@ class LanTcpPlugin extends TcpPlugin {
if(LOG.isLoggable(INFO)) if(LOG.isLoggable(INFO))
LOG.info("Timeout while sending invitation"); LOG.info("Timeout while sending invitation");
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} finally { } finally {
tryToClose(ms, mcast.getAddress()); tryToClose(ms, mcast.getAddress());
} }
@@ -201,7 +201,7 @@ class LanTcpPlugin extends TcpPlugin {
try { try {
ms.leaveGroup(addr); ms.leaveGroup(addr);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
ms.close(); ms.close();
} }
@@ -250,7 +250,7 @@ class LanTcpPlugin extends TcpPlugin {
ss = new ServerSocket(); ss = new ServerSocket();
ss.bind(new InetSocketAddress(iface, 0)); ss.bind(new InetSocketAddress(iface, 0));
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
if(ss != null) tryToClose(ss); if(ss != null) tryToClose(ss);
return null; return null;
} }
@@ -262,7 +262,7 @@ class LanTcpPlugin extends TcpPlugin {
ms = new MulticastSocket(); ms = new MulticastSocket();
ms.setInterface(iface); ms.setInterface(iface);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
if(ms != null) ms.close(); if(ms != null) ms.close();
tryToClose(ss); tryToClose(ss);
return null; return null;
@@ -299,7 +299,7 @@ class LanTcpPlugin extends TcpPlugin {
if(LOG.isLoggable(INFO)) if(LOG.isLoggable(INFO))
LOG.info("Timeout while accepting invitation"); LOG.info("Timeout while accepting invitation");
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} finally { } finally {
ms.close(); ms.close();
tryToClose(ss); tryToClose(ss);

View File

@@ -53,9 +53,9 @@ class PortMapperImpl implements PortMapper {
if(externalString != null) if(externalString != null)
external = InetAddress.getByName(externalString); external = InetAddress.getByName(externalString);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(SAXException e) { } catch(SAXException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
return new MappingResult(internal, external, port, succeeded); return new MappingResult(internal, external, port, succeeded);
} }
@@ -65,11 +65,11 @@ class PortMapperImpl implements PortMapper {
try { try {
d.discover(); d.discover();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(SAXException e) { } catch(SAXException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(ParserConfigurationException e) { } catch(ParserConfigurationException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
gateway = d.getValidGateway(); gateway = d.getValidGateway();
} }
@@ -80,9 +80,9 @@ class PortMapperImpl implements PortMapper {
if(LOG.isLoggable(INFO)) if(LOG.isLoggable(INFO))
LOG.info("Deleted mapping for port " + port); LOG.info("Deleted mapping for port " + port);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(SAXException e) { } catch(SAXException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -63,7 +63,7 @@ abstract class TcpPlugin implements DuplexPlugin {
try { try {
ss = new ServerSocket(); ss = new ServerSocket();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return; return;
} }
boolean found = false; boolean found = false;
@@ -73,7 +73,7 @@ abstract class TcpPlugin implements DuplexPlugin {
found = true; found = true;
break; break;
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(ss); tryToClose(ss);
continue; continue;
} }
@@ -100,7 +100,7 @@ abstract class TcpPlugin implements DuplexPlugin {
try { try {
ss.close(); ss.close();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -120,7 +120,7 @@ abstract class TcpPlugin implements DuplexPlugin {
s.setSoTimeout(0); s.setSoTimeout(0);
} catch(IOException e) { } catch(IOException e) {
// This is expected when the socket is closed // This is expected when the socket is closed
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
tryToClose(ss); tryToClose(ss);
return; return;
} }
@@ -172,7 +172,7 @@ abstract class TcpPlugin implements DuplexPlugin {
s.connect(addr); s.connect(addr);
return new TcpTransportConnection(s); return new TcpTransportConnection(s);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
return null; return null;
} }
} }
@@ -188,9 +188,9 @@ abstract class TcpPlugin implements DuplexPlugin {
int port = Integer.valueOf(portString); int port = Integer.valueOf(portString);
return new InetSocketAddress(addr, port); return new InetSocketAddress(addr, port);
} catch(NumberFormatException e) { } catch(NumberFormatException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(UnknownHostException e) { } catch(UnknownHostException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
return null; return null;

View File

@@ -68,9 +68,9 @@ class WanTcpPlugin extends TcpPlugin {
addrs.add(new InetSocketAddress(addr, port)); addrs.add(new InetSocketAddress(addr, port));
addrs.add(new InetSocketAddress(addr, 0)); addrs.add(new InetSocketAddress(addr, 0));
} catch(NumberFormatException e) { } catch(NumberFormatException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(UnknownHostException e) { } catch(UnknownHostException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
// Get a list of the device's network interfaces // Get a list of the device's network interfaces
@@ -78,7 +78,7 @@ class WanTcpPlugin extends TcpPlugin {
try { try {
ifaces = Collections.list(NetworkInterface.getNetworkInterfaces()); ifaces = Collections.list(NetworkInterface.getNetworkInterfaces());
} catch(SocketException e) { } catch(SocketException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return addrs; return addrs;
} }
// Accept interfaces without link-local or site-local addresses // Accept interfaces without link-local or site-local addresses

View File

@@ -119,7 +119,7 @@ class TorPlugin implements DuplexPlugin {
addr = util.parseTorHiddenServicePrivateNetAddressFromStrings( addr = util.parseTorHiddenServicePrivateNetAddressFromStrings(
privateKey, "", false); privateKey, "", false);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
addr = createHiddenServiceAddress(util); addr = createHiddenServiceAddress(util);
} }
} }
@@ -131,7 +131,7 @@ class TorPlugin implements DuplexPlugin {
try { try {
ss = nl.createNetServerSocket(null, addrPort); ss = nl.createNetServerSocket(null, addrPort);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return; return;
} }
synchronized(this) { synchronized(this) {
@@ -165,7 +165,7 @@ class TorPlugin implements DuplexPlugin {
try { try {
nl.clear(); nl.clear();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -173,7 +173,7 @@ class TorPlugin implements DuplexPlugin {
try { try {
ss.close(); ss.close();
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -184,7 +184,7 @@ class TorPlugin implements DuplexPlugin {
s = ss.accept(); s = ss.accept();
} catch(IOException e) { } catch(IOException e) {
// This is expected when the socket is closed // This is expected when the socket is closed
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
tryToClose(ss); tryToClose(ss);
return; return;
} }
@@ -272,7 +272,7 @@ class TorPlugin implements DuplexPlugin {
if(LOG.isLoggable(INFO)) LOG.info("Connected to hidden service"); if(LOG.isLoggable(INFO)) LOG.info("Connected to hidden service");
return new TorTransportConnection(s); return new TorTransportConnection(s);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(INFO)) LOG.info(e.toString()); if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
return null; return null;
} }
} }

View File

@@ -181,7 +181,7 @@ abstract class DuplexConnection implements DatabaseListener {
// The writer will dispose of the transport if no exceptions occur // The writer will dispose of the transport if no exceptions occur
writerTasks.add(CLOSE); writerTasks.add(CLOSE);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }
@@ -223,7 +223,7 @@ abstract class DuplexConnection implements DatabaseListener {
LOG.info("Interrupted while waiting for task"); LOG.info("Interrupted while waiting for task");
dispose(true, true); dispose(true, true);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} finally { } finally {
connRegistry.unregisterConnection(contactId, transportId); connRegistry.unregisterConnection(contactId, transportId);
@@ -237,7 +237,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
transport.dispose(exception, recognised); transport.dispose(exception, recognised);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -254,7 +254,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
db.receiveAck(contactId, ack); db.receiveAck(contactId, ack);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -273,7 +273,7 @@ abstract class DuplexConnection implements DatabaseListener {
Batch b = batch.verify(); Batch b = batch.verify();
dbExecutor.execute(new ReceiveBatch(b)); dbExecutor.execute(new ReceiveBatch(b));
} catch(GeneralSecurityException e) { } catch(GeneralSecurityException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -291,7 +291,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
db.receiveBatch(contactId, batch); db.receiveBatch(contactId, batch);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -310,7 +310,7 @@ abstract class DuplexConnection implements DatabaseListener {
Request r = db.receiveOffer(contactId, offer); Request r = db.receiveOffer(contactId, offer);
writerTasks.add(new WriteRequest(r)); writerTasks.add(new WriteRequest(r));
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -329,7 +329,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
writer.writeRequest(request); writer.writeRequest(request);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }
@@ -348,7 +348,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
db.setSeen(contactId, seen); db.setSeen(contactId, seen);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -366,7 +366,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
db.receiveSubscriptionUpdate(contactId, update); db.receiveSubscriptionUpdate(contactId, update);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -384,7 +384,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
db.receiveTransportUpdate(contactId, update); db.receiveTransportUpdate(contactId, update);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -399,7 +399,7 @@ abstract class DuplexConnection implements DatabaseListener {
Ack a = db.generateAck(contactId, maxBatches); Ack a = db.generateAck(contactId, maxBatches);
if(a != null) writerTasks.add(new WriteAck(a)); if(a != null) writerTasks.add(new WriteAck(a));
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -419,7 +419,7 @@ abstract class DuplexConnection implements DatabaseListener {
writer.writeAck(ack); writer.writeAck(ack);
dbExecutor.execute(new GenerateAcks()); dbExecutor.execute(new GenerateAcks());
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }
@@ -442,7 +442,7 @@ abstract class DuplexConnection implements DatabaseListener {
if(b == null) new GenerateOffer().run(); if(b == null) new GenerateOffer().run();
else writerTasks.add(new WriteBatch(b, requested)); else writerTasks.add(new WriteBatch(b, requested));
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -465,7 +465,7 @@ abstract class DuplexConnection implements DatabaseListener {
if(requested.isEmpty()) dbExecutor.execute(new GenerateOffer()); if(requested.isEmpty()) dbExecutor.execute(new GenerateOffer());
else dbExecutor.execute(new GenerateBatches(requested)); else dbExecutor.execute(new GenerateBatches(requested));
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }
@@ -489,7 +489,7 @@ abstract class DuplexConnection implements DatabaseListener {
writerTasks.add(new WriteOffer(o)); writerTasks.add(new WriteOffer(o));
} }
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -508,7 +508,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
writer.writeOffer(offer); writer.writeOffer(offer);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }
@@ -522,7 +522,7 @@ abstract class DuplexConnection implements DatabaseListener {
SubscriptionUpdate s = db.generateSubscriptionUpdate(contactId); SubscriptionUpdate s = db.generateSubscriptionUpdate(contactId);
if(s != null) writerTasks.add(new WriteSubscriptionUpdate(s)); if(s != null) writerTasks.add(new WriteSubscriptionUpdate(s));
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -541,7 +541,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
writer.writeSubscriptionUpdate(update); writer.writeSubscriptionUpdate(update);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }
@@ -555,7 +555,7 @@ abstract class DuplexConnection implements DatabaseListener {
TransportUpdate t = db.generateTransportUpdate(contactId); TransportUpdate t = db.generateTransportUpdate(contactId);
if(t != null) writerTasks.add(new WriteTransportUpdate(t)); if(t != null) writerTasks.add(new WriteTransportUpdate(t));
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -574,7 +574,7 @@ abstract class DuplexConnection implements DatabaseListener {
try { try {
writer.writeTransportUpdate(update); writer.writeTransportUpdate(update);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} }
} }

View File

@@ -89,7 +89,7 @@ class IncomingSimplexConnection {
} }
dispose(false, true); dispose(false, true);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, true); dispose(true, true);
} finally { } finally {
connRegistry.unregisterConnection(contactId, transportId); connRegistry.unregisterConnection(contactId, transportId);
@@ -101,7 +101,7 @@ class IncomingSimplexConnection {
try { try {
transport.dispose(exception, recognised); transport.dispose(exception, recognised);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
@@ -117,7 +117,7 @@ class IncomingSimplexConnection {
try { try {
db.receiveAck(contactId, ack); db.receiveAck(contactId, ack);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -135,7 +135,7 @@ class IncomingSimplexConnection {
Batch b = batch.verify(); Batch b = batch.verify();
dbExecutor.execute(new ReceiveBatch(b)); dbExecutor.execute(new ReceiveBatch(b));
} catch(GeneralSecurityException e) { } catch(GeneralSecurityException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -152,7 +152,7 @@ class IncomingSimplexConnection {
try { try {
db.receiveBatch(contactId, batch); db.receiveBatch(contactId, batch);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -169,7 +169,7 @@ class IncomingSimplexConnection {
try { try {
db.receiveSubscriptionUpdate(contactId, update); db.receiveSubscriptionUpdate(contactId, update);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }
@@ -186,7 +186,7 @@ class IncomingSimplexConnection {
try { try {
db.receiveTransportUpdate(contactId, update); db.receiveTransportUpdate(contactId, update);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -99,10 +99,10 @@ class OutgoingSimplexConnection {
writer.close(); writer.close();
dispose(false); dispose(false);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true); dispose(true);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true); dispose(true);
} finally { } finally {
connRegistry.unregisterConnection(contactId, transportId); connRegistry.unregisterConnection(contactId, transportId);
@@ -114,7 +114,7 @@ class OutgoingSimplexConnection {
try { try {
transport.dispose(exception); transport.dispose(exception);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -98,18 +98,20 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
transport); transport);
} }
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
try { try {
transport.dispose(true, false); transport.dispose(true, false);
} catch(IOException e1) { } catch(IOException e1) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e1.toString(), e1);
} }
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
try { try {
transport.dispose(true, false); transport.dispose(true, false);
} catch(IOException e1) { } catch(IOException e1) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e1.toString(), e1);
} }
} }
} }
@@ -131,7 +133,7 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
try { try {
tag = readTag(transport.getInputStream()); tag = readTag(transport.getInputStream());
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, false); dispose(true, false);
return; return;
} }
@@ -139,7 +141,7 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
try { try {
ctx = recogniser.acceptConnection(transportId, tag); ctx = recogniser.acceptConnection(transportId, tag);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
dispose(true, false); dispose(true, false);
return; return;
} }
@@ -151,7 +153,7 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
try { try {
transport.dispose(exception, recognised); transport.dispose(exception, recognised);
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
} }
} }

View File

@@ -64,7 +64,7 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
try { try {
secrets = db.getSecrets(); secrets = db.getSecrets();
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return false; return false;
} }
// Work out what phase of its lifecycle each secret is in // Work out what phase of its lifecycle each secret is in
@@ -77,7 +77,7 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
try { try {
db.addSecrets(created); db.addSecrets(created);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return false; return false;
} }
} }
@@ -224,7 +224,7 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
try { try {
connection = db.incrementConnectionCounter(c, t, s.getPeriod()); connection = db.incrementConnectionCounter(c, t, s.getPeriod());
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return null; return null;
} }
byte[] secret = s.getSecret().clone(); byte[] secret = s.getSecret().clone();
@@ -269,7 +269,7 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
try { try {
db.addSecrets(Arrays.asList(s1, s2)); db.addSecrets(Arrays.asList(s1, s2));
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
// Pass the new secrets to the recogniser // Pass the new secrets to the recogniser
recogniser.addSecret(s1); recogniser.addSecret(s1);
@@ -304,7 +304,7 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
try { try {
db.addSecrets(created); db.addSecrets(created);
} catch(DbException e) { } catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} }
// Pass any secrets that have been created to the recogniser // Pass any secrets that have been created to the recogniser
for(TemporarySecret s : created) recogniser.addSecret(s); for(TemporarySecret s : created) recogniser.addSecret(s);

View File

@@ -50,7 +50,7 @@ public class BoundedExecutor implements Executor {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
throw new RejectedExecutionException(); throw new RejectedExecutionException();
} catch(RejectedExecutionException e) { } catch(RejectedExecutionException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString()); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
semaphore.release(); semaphore.release();
throw e; throw e;
} }