Log the exception class when logging exceptions.

This commit is contained in:
akwizgran
2011-12-08 17:28:05 +00:00
parent 9f0b865ba8
commit 6962814eec
30 changed files with 108 additions and 112 deletions

View File

@@ -17,7 +17,7 @@ public class SigningConsumer implements Consumer {
try {
signature.update(b);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
throw new IOException(e.toString());
}
}
@@ -25,7 +25,7 @@ public class SigningConsumer implements Consumer {
try {
signature.update(b, off, len);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
throw new IOException(e.toString());
}
}
}

View File

@@ -45,10 +45,10 @@ class DatabaseCleanerImpl implements DatabaseCleaner, Runnable {
}
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
} catch(RuntimeException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
}
}

View File

@@ -138,10 +138,10 @@ DatabaseCleaner.Callback {
}
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
}
});

View File

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

View File

@@ -57,11 +57,9 @@ public class FontManagerImpl implements FontManager {
font = font.deriveFont(bf.size);
for(String language : bf.languages) fonts.put(language, font);
} catch(FontFormatException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning("Could not load font: " + e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning("Could not load font: " + e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
defaultFont = getFont("Sans", 12f);

View File

@@ -105,7 +105,7 @@ public class I18nImpl implements I18n {
UIManager.put(key, bundle.getString(key));
} catch(MissingResourceException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
}
}

View File

@@ -57,7 +57,7 @@ class InvitationWorker implements Runnable {
if(callback.isCancelled()) return;
if(parameters.shouldCreateJar()) files.add(createBriarJar(dir));
} catch(IOException e) {
callback.error(e.getMessage());
callback.error(e.toString());
return;
}
if(callback.isCancelled()) return;
@@ -75,7 +75,7 @@ class InvitationWorker implements Runnable {
try {
transports = db.getLocalTransports();
} catch(DbException e) {
throw new IOException(e.getMessage());
throw new IOException(e.toString());
}
FileOutputStream out = new FileOutputStream(invitationDat);
Writer w = writerFactory.createWriter(out);

View File

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

View File

@@ -111,10 +111,10 @@ class PluginManagerImpl implements PluginManager {
plugin.start();
batchPlugins.add(plugin);
} catch(ClassCastException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
continue;
} catch(Exception e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
continue;
}
}
@@ -151,10 +151,10 @@ class PluginManagerImpl implements PluginManager {
plugin.start();
streamPlugins.add(plugin);
} catch(ClassCastException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
continue;
} catch(Exception e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
continue;
}
}
@@ -175,7 +175,7 @@ class PluginManagerImpl implements PluginManager {
plugin.stop();
stopped++;
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
batchPlugins.clear();
@@ -185,7 +185,7 @@ class PluginManagerImpl implements PluginManager {
plugin.stop();
stopped++;
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
streamPlugins.clear();
@@ -209,7 +209,7 @@ class PluginManagerImpl implements PluginManager {
try {
return db.getConfig(id);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return new TransportConfig();
}
}
@@ -220,7 +220,7 @@ class PluginManagerImpl implements PluginManager {
TransportProperties p = db.getLocalProperties(id);
return p == null ? new TransportProperties() : p;
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return new TransportProperties();
}
}
@@ -230,7 +230,7 @@ class PluginManagerImpl implements PluginManager {
try {
return db.getRemoteProperties(id);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return Collections.emptyMap();
}
}
@@ -240,7 +240,7 @@ class PluginManagerImpl implements PluginManager {
try {
db.setConfig(id, c);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
@@ -268,7 +268,7 @@ class PluginManagerImpl implements PluginManager {
try {
db.setLocalProperties(id, p);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}

View File

@@ -76,7 +76,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
}
});
}
throw new IOException(e.getMessage());
throw new IOException(e.toString());
}
pluginExecutor.execute(createContactSocketBinder());
}
@@ -111,7 +111,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
try {
scn = (StreamConnectionNotifier) Connector.open(url);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return;
}
synchronized(this) {
@@ -120,7 +120,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
scn.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
return;
}
@@ -154,7 +154,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
try {
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
} catch(BluetoothStateException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
// Advertise the address to contacts if the device is discoverable
if(localDevice.getDiscoverable() != DiscoveryAgent.NOT_DISCOVERABLE) {
@@ -176,7 +176,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
s = scn.acceptAndOpen();
} catch(IOException e) {
// This is expected when the socket is closed
if(LOG.isLoggable(Level.INFO)) LOG.info(e.getMessage());
if(LOG.isLoggable(Level.INFO)) LOG.info(e.toString());
return;
}
BluetoothTransportConnection conn =
@@ -243,7 +243,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
try {
discoveryAgent.startInquiry(DiscoveryAgent.GIAC, listener);
} catch(BluetoothStateException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return Collections.emptyMap();
}
try {
@@ -267,7 +267,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
if(LOG.isLoggable(Level.INFO)) LOG.info("Connected");
return new BluetoothTransportConnection(s);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return null;
}
}
@@ -340,7 +340,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
url = listener.waitForUrl();
} catch(BluetoothStateException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
return;
} catch(InterruptedException e) {
if(LOG.isLoggable(Level.INFO))
@@ -359,7 +359,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
StreamConnection s = (StreamConnection) Connector.open(url);
c.addConnection(s);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
@@ -374,7 +374,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
try {
scn = (StreamConnectionNotifier) Connector.open(url);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return;
}
pluginExecutor.execute(new Runnable() {
@@ -393,7 +393,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
try {
scn.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
@@ -407,7 +407,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
c.addConnection(s);
} catch(IOException e) {
// This is expected when the socket is closed
if(LOG.isLoggable(Level.INFO)) LOG.info(e.getMessage());
if(LOG.isLoggable(Level.INFO)) LOG.info(e.toString());
}
}
}

View File

@@ -33,7 +33,7 @@ class BluetoothTransportConnection implements StreamTransportConnection {
try {
stream.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}

View File

@@ -50,7 +50,7 @@ class ConnectionCallback {
try {
s.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}

View File

@@ -51,7 +51,7 @@ class ContactListener extends AbstractListener {
try {
discoveryAgent.searchServices(null, uuids, device, this);
} catch(BluetoothStateException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
searches.incrementAndGet();
}

View File

@@ -38,7 +38,7 @@ class InvitationListener extends AbstractListener {
discoveryAgent.searchServices(null, uuids, device, this);
searches.incrementAndGet();
} catch(BluetoothStateException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}

View File

@@ -75,7 +75,7 @@ abstract class FilePlugin extends AbstractPlugin implements BatchPlugin {
OutputStream out = new FileOutputStream(f);
return new FileTransportWriter(f, out, capacity, this);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
f.delete();
return null;
}
@@ -136,7 +136,7 @@ abstract class FilePlugin extends AbstractPlugin implements BatchPlugin {
FileInputStream in = new FileInputStream(f);
return new FileTransportReader(f, in, FilePlugin.this);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
return null;
@@ -175,7 +175,7 @@ abstract class FilePlugin extends AbstractPlugin implements BatchPlugin {
FilePlugin.this));
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
}
}

View File

@@ -31,7 +31,7 @@ class FileTransportReader implements BatchTransportReader {
try {
in.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
if(success) {
file.delete();

View File

@@ -38,7 +38,7 @@ class FileTransportWriter implements BatchTransportWriter {
try {
out.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
if(success) plugin.writerFinished(file);
else file.delete();

View File

@@ -83,7 +83,7 @@ implements RemovableDriveMonitor.Callback {
if(i == -1) return null;
return drives.get(i);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return null;
}
}
@@ -112,7 +112,7 @@ implements RemovableDriveMonitor.Callback {
}
}
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
return Collections.unmodifiableList(matches);
}

View File

@@ -23,7 +23,7 @@ class WindowsRemovableDriveFinder implements RemovableDriveFinder {
int type = Kernel32.INSTANCE.GetDriveType(root.getPath());
if(type == DRIVE_REMOVABLE) drives.add(root);
} catch(RuntimeException e) {
throw new IOException(e.getMessage());
throw new IOException(e.toString());
}
}
return Collections.unmodifiableList(drives);

View File

@@ -47,13 +47,13 @@ class LanSocketPlugin extends SimpleSocketPlugin {
ms.setInterface(iface);
ms.joinGroup(mcast.getAddress());
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(ms != null) {
try {
ms.leaveGroup(mcast.getAddress());
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e1.getMessage());
LOG.warning(e1.toString());
}
ms.close();
}
@@ -82,7 +82,7 @@ class LanSocketPlugin extends SimpleSocketPlugin {
return new SocketTransportConnection(s);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
}
} catch(SocketTimeoutException e) {
@@ -93,11 +93,11 @@ class LanSocketPlugin extends SimpleSocketPlugin {
if(LOG.isLoggable(Level.INFO))
LOG.info("Timeout while sending invitation");
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
try {
ms.leaveGroup(mcast.getAddress());
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e1.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e1.toString());
}
ms.close();
}
@@ -148,13 +148,13 @@ class LanSocketPlugin extends SimpleSocketPlugin {
ss = new ServerSocket();
ss.bind(new InetSocketAddress(iface, 0));
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(ss != null) {
try {
ss.close();
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e1.getMessage());
LOG.warning(e1.toString());
}
}
return null;
@@ -166,13 +166,13 @@ class LanSocketPlugin extends SimpleSocketPlugin {
ms = new MulticastSocket();
ms.setInterface(iface);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(ms != null) ms.close();
try {
ss.close();
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e1.getMessage());
LOG.warning(e1.toString());
}
return null;
}
@@ -205,14 +205,14 @@ class LanSocketPlugin extends SimpleSocketPlugin {
if(LOG.isLoggable(Level.INFO))
LOG.info("Timeout while accepting invitation");
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
} finally {
ms.close();
try {
ss.close();
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e1.getMessage());
LOG.warning(e1.toString());
}
}
return null;

View File

@@ -71,7 +71,7 @@ class SimpleSocketPlugin extends SocketPlugin {
try {
return new InetSocketAddress(chooseInterface(false), 0);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
return addr;

View File

@@ -65,13 +65,13 @@ abstract class SocketPlugin extends AbstractPlugin implements StreamPlugin {
+ ":" + ss.getLocalPort());
}
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(ss != null) {
try {
ss.close();
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e1.getMessage());
LOG.warning(e1.toString());
}
}
return;
@@ -82,7 +82,7 @@ abstract class SocketPlugin extends AbstractPlugin implements StreamPlugin {
ss.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e.getMessage());
LOG.warning(e.toString());
}
return;
}
@@ -99,12 +99,12 @@ abstract class SocketPlugin extends AbstractPlugin implements StreamPlugin {
s = ss.accept();
} catch(IOException e) {
// This is expected when the socket is closed
if(LOG.isLoggable(Level.INFO)) LOG.info(e.getMessage());
if(LOG.isLoggable(Level.INFO)) LOG.info(e.toString());
try {
ss.close();
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING))
LOG.warning(e1.getMessage());
LOG.warning(e1.toString());
}
return;
}
@@ -153,7 +153,7 @@ abstract class SocketPlugin extends AbstractPlugin implements StreamPlugin {
}
s.connect(addr);
} catch(IOException e) {
if(LOG.isLoggable(Level.INFO)) LOG.info(e.getMessage());
if(LOG.isLoggable(Level.INFO)) LOG.info(e.toString());
return null;
}
return new SocketTransportConnection(s);

View File

@@ -32,7 +32,7 @@ class SocketTransportConnection implements StreamTransportConnection {
try {
socket.close();
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}

View File

@@ -81,7 +81,7 @@ class IncomingBatchConnection {
}
transport.dispose(true);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}
@@ -98,7 +98,7 @@ class IncomingBatchConnection {
try {
db.receiveAck(contactId, ack);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -116,7 +116,7 @@ class IncomingBatchConnection {
Batch b = batch.verify();
dbExecutor.execute(new ReceiveBatch(b));
} catch(GeneralSecurityException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -133,7 +133,7 @@ class IncomingBatchConnection {
try {
db.receiveBatch(contactId, batch);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -150,7 +150,7 @@ class IncomingBatchConnection {
try {
db.receiveSubscriptionUpdate(contactId, update);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -167,7 +167,7 @@ class IncomingBatchConnection {
try {
db.receiveTransportUpdate(contactId, update);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}

View File

@@ -92,10 +92,10 @@ class OutgoingBatchConnection {
out.flush();
transport.dispose(true);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}

View File

@@ -168,10 +168,10 @@ abstract class StreamConnection implements DatabaseListener {
writerTasks.add(CLOSE);
if(!disposed.getAndSet(true)) transport.dispose(true);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(!disposed.getAndSet(true)) transport.dispose(false);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(!disposed.getAndSet(true)) transport.dispose(false);
}
}
@@ -205,14 +205,14 @@ abstract class StreamConnection implements DatabaseListener {
}
if(!disposed.getAndSet(true)) transport.dispose(true);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(!disposed.getAndSet(true)) transport.dispose(false);
} catch(InterruptedException e) {
if(LOG.isLoggable(Level.INFO))
LOG.info("Interrupted while waiting for task");
if(!disposed.getAndSet(true)) transport.dispose(false);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
if(!disposed.getAndSet(true)) transport.dispose(false);
} finally {
db.removeListener(this);
@@ -232,7 +232,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
db.receiveAck(contactId, ack);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -251,7 +251,7 @@ abstract class StreamConnection implements DatabaseListener {
Batch b = batch.verify();
dbExecutor.execute(new ReceiveBatch(b));
} catch(GeneralSecurityException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -269,7 +269,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
db.receiveBatch(contactId, batch);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -288,7 +288,7 @@ abstract class StreamConnection implements DatabaseListener {
Request r = db.receiveOffer(contactId, offer);
writerTasks.add(new WriteRequest(r));
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -307,7 +307,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
writer.writeRequest(request);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}
@@ -326,7 +326,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
db.setSeen(contactId, seen);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -344,7 +344,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
db.receiveSubscriptionUpdate(contactId, update);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -362,7 +362,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
db.receiveTransportUpdate(contactId, update);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -377,7 +377,7 @@ abstract class StreamConnection implements DatabaseListener {
Ack a = db.generateAck(contactId, maxBatches);
if(a != null) writerTasks.add(new WriteAck(a));
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -397,7 +397,7 @@ abstract class StreamConnection implements DatabaseListener {
writer.writeAck(ack);
dbExecutor.execute(new GenerateAcks());
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}
@@ -420,7 +420,7 @@ abstract class StreamConnection implements DatabaseListener {
if(b == null) new GenerateOffer().run();
else writerTasks.add(new WriteBatch(b, requested));
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -443,7 +443,7 @@ abstract class StreamConnection implements DatabaseListener {
if(requested.isEmpty()) dbExecutor.execute(new GenerateOffer());
else dbExecutor.execute(new GenerateBatches(requested));
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}
@@ -467,7 +467,7 @@ abstract class StreamConnection implements DatabaseListener {
writerTasks.add(new WriteOffer(o));
}
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -486,7 +486,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
writer.writeOffer(offer);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}
@@ -500,7 +500,7 @@ abstract class StreamConnection implements DatabaseListener {
SubscriptionUpdate s = db.generateSubscriptionUpdate(contactId);
if(s != null) writerTasks.add(new WriteSubscriptionUpdate(s));
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -519,7 +519,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
writer.writeSubscriptionUpdate(update);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}
@@ -533,7 +533,7 @@ abstract class StreamConnection implements DatabaseListener {
TransportUpdate t = db.generateTransportUpdate(contactId);
if(t != null) writerTasks.add(new WriteTransportUpdate(t));
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
@@ -552,7 +552,7 @@ abstract class StreamConnection implements DatabaseListener {
try {
writer.writeTransportUpdate(update);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(false);
}
}

View File

@@ -87,7 +87,7 @@ class SetupWorker implements Runnable {
// Installation succeeded - delete the installer
jar.deleteOnExit();
} catch(IOException e) {
callback.error(e.getMessage());
callback.error(e.toString());
return;
}
if(callback.isCancelled()) return;

View File

@@ -92,10 +92,10 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
if(ctx == null) r.dispose(true);
else batchConnFactory.createIncomingConnection(ctx, r, tag);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
r.dispose(false);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
r.dispose(false);
}
}
@@ -119,10 +119,10 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
if(ctx == null) s.dispose(true);
else streamConnFactory.createIncomingConnection(ctx, s, tag);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
s.dispose(false);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
s.dispose(false);
}
}

View File

@@ -206,7 +206,7 @@ DatabaseListener {
}
}
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return;
}
localTransportIds.add(t);
@@ -234,7 +234,7 @@ DatabaseListener {
// The contact was removed - clean up in removeContact()
return;
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
return;
}
// Remove the old IVs

View File

@@ -20,7 +20,7 @@ implements BatchTransportWriter {
}
public long getCapacity() {
return capacity - out.size();
return capacity;
}
public OutputStream getOutputStream() {