diff --git a/api/net/sf/briar/api/transport/InvalidConfigException.java b/api/net/sf/briar/api/transport/InvalidConfigException.java deleted file mode 100644 index d2a03da63089f3cdb064d850f24eb41a62d3f2cc..0000000000000000000000000000000000000000 --- a/api/net/sf/briar/api/transport/InvalidConfigException.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.sf.briar.api.transport; - -/** - * Thrown by a transport plugin if the specified configuration properties are - * invalid. - */ -public class InvalidConfigException extends Exception { - - private static final long serialVersionUID = 9123332784670286454L; -} diff --git a/api/net/sf/briar/api/transport/InvalidPropertiesException.java b/api/net/sf/briar/api/transport/InvalidPropertiesException.java deleted file mode 100644 index 20edd733ab5937591f5f87e92d2845cef86585e2..0000000000000000000000000000000000000000 --- a/api/net/sf/briar/api/transport/InvalidPropertiesException.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.sf.briar.api.transport; - -/** - * Thrown by a transport plugin if the specified transport properties are - * invalid. - */ -public class InvalidPropertiesException extends Exception { - - private static final long serialVersionUID = -6516979794153838108L; -} diff --git a/api/net/sf/briar/api/transport/TransportPlugin.java b/api/net/sf/briar/api/transport/TransportPlugin.java index d4e8948856460a0fd45c5da3d60899e83cf2f3c5..9a268656217797e6837d1023b633faeec1b8546c 100644 --- a/api/net/sf/briar/api/transport/TransportPlugin.java +++ b/api/net/sf/briar/api/transport/TransportPlugin.java @@ -18,15 +18,13 @@ public interface TransportPlugin { void stop() throws IOException; /** Updates the plugin's local transport properties. */ - void setLocalProperties(Map<String, String> properties) - throws InvalidPropertiesException; + void setLocalProperties(Map<String, String> properties); /** Updates the plugin's transport properties for the given contact. */ - void setRemoteProperties(ContactId c, Map<String, String> properties) - throws InvalidPropertiesException; + void setRemoteProperties(ContactId c, Map<String, String> properties); /** Updates the plugin's configuration properties. */ - void setConfig(Map<String, String> config) throws InvalidConfigException; + void setConfig(Map<String, String> config); /** * Returns true if the plugin's poll() method should be called diff --git a/api/net/sf/briar/api/transport/batch/BatchTransportPlugin.java b/api/net/sf/briar/api/transport/batch/BatchTransportPlugin.java index b0457b30a1024858e20464ec80bda523be2f061a..0cb542603cc541e55c26dee26dd1e327c4fe18a0 100644 --- a/api/net/sf/briar/api/transport/batch/BatchTransportPlugin.java +++ b/api/net/sf/briar/api/transport/batch/BatchTransportPlugin.java @@ -4,8 +4,6 @@ import java.io.IOException; import java.util.Map; import net.sf.briar.api.ContactId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.TransportPlugin; /** @@ -21,7 +19,7 @@ public interface BatchTransportPlugin extends TransportPlugin { void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, Map<String, String> config, BatchTransportCallback c) - throws InvalidPropertiesException, InvalidConfigException, IOException; + throws IOException; /** * Attempts to create and return a BatchTransportReader for the given diff --git a/api/net/sf/briar/api/transport/stream/StreamTransportPlugin.java b/api/net/sf/briar/api/transport/stream/StreamTransportPlugin.java index 001cfe8d10bd617de8d0851d7e8d9c777411e111..812d924c2608c7d4d89be540c437969d6f5e3a3c 100644 --- a/api/net/sf/briar/api/transport/stream/StreamTransportPlugin.java +++ b/api/net/sf/briar/api/transport/stream/StreamTransportPlugin.java @@ -4,8 +4,6 @@ import java.io.IOException; import java.util.Map; import net.sf.briar.api.ContactId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.TransportPlugin; /** @@ -21,7 +19,7 @@ public interface StreamTransportPlugin extends TransportPlugin { void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, Map<String, String> config, StreamTransportCallback c) - throws InvalidPropertiesException, InvalidConfigException, IOException; + throws IOException; /** * Attempts to create and return a StreamTransportConnection to the given diff --git a/components/net/sf/briar/plugins/AbstractPlugin.java b/components/net/sf/briar/plugins/AbstractPlugin.java index c0259d8b0ea8f7bf3f3ed80102648eca940403c8..3a64216aaa543317f602a20e83c21bfc84992312 100644 --- a/components/net/sf/briar/plugins/AbstractPlugin.java +++ b/components/net/sf/briar/plugins/AbstractPlugin.java @@ -8,8 +8,6 @@ import java.util.Map.Entry; import java.util.concurrent.Executor; import net.sf.briar.api.ContactId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.TransportPlugin; import net.sf.briar.api.transport.batch.BatchTransportCallback; @@ -30,8 +28,7 @@ public abstract class AbstractPlugin implements TransportPlugin { protected synchronized void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, - Map<String, String> config) throws InvalidPropertiesException, - InvalidConfigException { + Map<String, String> config) { if(started) throw new IllegalStateException(); started = true; this.localProperties = Collections.unmodifiableMap(localProperties); @@ -53,21 +50,19 @@ public abstract class AbstractPlugin implements TransportPlugin { started = false; } - public synchronized void setLocalProperties(Map<String, String> properties) - throws InvalidPropertiesException { + public synchronized void setLocalProperties( + Map<String, String> properties) { if(!started) throw new IllegalStateException(); localProperties = Collections.unmodifiableMap(properties); } public synchronized void setRemoteProperties(ContactId c, - Map<String, String> properties) - throws InvalidPropertiesException { + Map<String, String> properties) { if(!started) throw new IllegalStateException(); remoteProperties.put(c, Collections.unmodifiableMap(properties)); } - public synchronized void setConfig(Map<String, String> config) - throws InvalidConfigException { + public synchronized void setConfig(Map<String, String> config) { if(!started) throw new IllegalStateException(); this.config = Collections.unmodifiableMap(config); } diff --git a/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java b/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java index ab5d18474a39546099c7434a30d98c42f2e0576b..0cd1f08218e48247b2381c0f440b32a907d16a94 100644 --- a/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java +++ b/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java @@ -21,8 +21,6 @@ import javax.microedition.io.StreamConnectionNotifier; import net.sf.briar.api.ContactId; import net.sf.briar.api.TransportId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.stream.StreamTransportCallback; import net.sf.briar.api.transport.stream.StreamTransportConnection; import net.sf.briar.api.transport.stream.StreamTransportPlugin; @@ -56,7 +54,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamTransportPlugin { public synchronized void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, Map<String, String> config, StreamTransportCallback callback) - throws InvalidPropertiesException, InvalidConfigException, IOException { + throws IOException { super.start(localProperties, remoteProperties, config); this.callback = callback; // Initialise the Bluetooth stack @@ -66,7 +64,7 @@ class BluetoothPlugin extends AbstractPlugin implements StreamTransportPlugin { // On Linux the user may need to install libbluetooth-dev if(OsUtils.isLinux()) callback.showMessage("BLUETOOTH_INSTALL LIBS"); - throw e; + throw new IOException(e.getMessage()); } executor.execute(createBinder()); } diff --git a/components/net/sf/briar/plugins/file/FilePlugin.java b/components/net/sf/briar/plugins/file/FilePlugin.java index e6210ba48cd75bfd112c96b12e9249d37c19b69a..f9eea0fa9eb7765095b4c2279086aedf24e0cc44 100644 --- a/components/net/sf/briar/plugins/file/FilePlugin.java +++ b/components/net/sf/briar/plugins/file/FilePlugin.java @@ -11,8 +11,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.sf.briar.api.ContactId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.TransportConstants; import net.sf.briar.api.transport.batch.BatchTransportCallback; import net.sf.briar.api.transport.batch.BatchTransportPlugin; @@ -39,7 +37,7 @@ implements BatchTransportPlugin { public synchronized void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, Map<String, String> config, BatchTransportCallback callback) - throws InvalidPropertiesException, InvalidConfigException, IOException { + throws IOException { super.start(localProperties, remoteProperties, config); this.callback = callback; } diff --git a/components/net/sf/briar/plugins/file/RemovableDrivePlugin.java b/components/net/sf/briar/plugins/file/RemovableDrivePlugin.java index d24c084187d7aa91e1a11c58d3ea93f502bd1d46..fb66dfd5e3a881a18373c2967508204b8d1454d3 100644 --- a/components/net/sf/briar/plugins/file/RemovableDrivePlugin.java +++ b/components/net/sf/briar/plugins/file/RemovableDrivePlugin.java @@ -10,8 +10,6 @@ import java.util.logging.Logger; import net.sf.briar.api.ContactId; import net.sf.briar.api.TransportId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.batch.BatchTransportCallback; class RemovableDrivePlugin extends FilePlugin @@ -41,7 +39,7 @@ implements RemovableDriveMonitor.Callback { public void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, Map<String, String> config, BatchTransportCallback callback) - throws InvalidPropertiesException, InvalidConfigException, IOException { + throws IOException { super.start(localProperties, remoteProperties, config, callback); monitor.start(this); } diff --git a/components/net/sf/briar/plugins/socket/SocketPlugin.java b/components/net/sf/briar/plugins/socket/SocketPlugin.java index 2571c4eb61f0d30386ab9fda3688fc428d0201a9..9f8e85b4f66957d6a60a5975d4c460083e895ed1 100644 --- a/components/net/sf/briar/plugins/socket/SocketPlugin.java +++ b/components/net/sf/briar/plugins/socket/SocketPlugin.java @@ -10,8 +10,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.sf.briar.api.ContactId; -import net.sf.briar.api.transport.InvalidConfigException; -import net.sf.briar.api.transport.InvalidPropertiesException; import net.sf.briar.api.transport.stream.StreamTransportCallback; import net.sf.briar.api.transport.stream.StreamTransportConnection; import net.sf.briar.api.transport.stream.StreamTransportPlugin; @@ -40,8 +38,7 @@ implements StreamTransportPlugin { public synchronized void start(Map<String, String> localProperties, Map<ContactId, Map<String, String>> remoteProperties, - Map<String, String> config, StreamTransportCallback callback) - throws InvalidPropertiesException, InvalidConfigException { + Map<String, String> config, StreamTransportCallback callback) { super.start(localProperties, remoteProperties, config); this.callback = callback; executor.execute(createBinder()); @@ -66,6 +63,10 @@ implements StreamTransportPlugin { } if(addr == null || ss == null) return; ss.bind(addr); + if(LOG.isLoggable(Level.INFO)) { + LOG.info("Bound to " + ss.getInetAddress().getHostAddress() + + ":" + ss.getLocalPort()); + } } catch(IOException e) { if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage()); return; @@ -135,8 +136,8 @@ implements StreamTransportPlugin { } } - public synchronized void setLocalProperties(Map<String, String> properties) - throws InvalidPropertiesException { + public synchronized void setLocalProperties( + Map<String, String> properties) { super.setLocalProperties(properties); // Close and reopen the socket if its address has changed if(socket != null) { diff --git a/test/build.xml b/test/build.xml index 3731461591563dadf2385ab24897ea9c24fc452c..b5e2813b042cb825f3cf48284dca031958e359dd 100644 --- a/test/build.xml +++ b/test/build.xml @@ -1,7 +1,7 @@ <project name='test' default='test'> <import file='../build-common.xml'/> <target name='test' depends='depend'> - <junit printsummary='on' showoutput='true' fork='yes' forkmode='once'> + <junit printsummary='on' fork='yes' forkmode='once'> <assertions> <enable/> </assertions>