From a3a5ebc14fd2dfbd375af4050a8de0f7eaf5ed13 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Sat, 8 Oct 2011 12:27:13 +0100
Subject: [PATCH] Removed unused exceptions. Also disabled output for ant
 tests.

---
 .../api/transport/InvalidConfigException.java     | 10 ----------
 .../api/transport/InvalidPropertiesException.java | 10 ----------
 .../sf/briar/api/transport/TransportPlugin.java   |  8 +++-----
 .../api/transport/batch/BatchTransportPlugin.java |  4 +---
 .../transport/stream/StreamTransportPlugin.java   |  4 +---
 .../net/sf/briar/plugins/AbstractPlugin.java      | 15 +++++----------
 .../briar/plugins/bluetooth/BluetoothPlugin.java  |  6 ++----
 .../net/sf/briar/plugins/file/FilePlugin.java     |  4 +---
 .../briar/plugins/file/RemovableDrivePlugin.java  |  4 +---
 .../net/sf/briar/plugins/socket/SocketPlugin.java | 13 +++++++------
 test/build.xml                                    |  2 +-
 11 files changed, 22 insertions(+), 58 deletions(-)
 delete mode 100644 api/net/sf/briar/api/transport/InvalidConfigException.java
 delete mode 100644 api/net/sf/briar/api/transport/InvalidPropertiesException.java

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 d2a03da630..0000000000
--- 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 20edd733ab..0000000000
--- 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 d4e8948856..9a26865621 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 b0457b30a1..0cb542603c 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 001cfe8d10..812d924c26 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 c0259d8b0e..3a64216aaa 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 ab5d18474a..0cd1f08218 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 e6210ba48c..f9eea0fa9e 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 d24c084187..fb66dfd5e3 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 2571c4eb61..9f8e85b4f6 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 3731461591..b5e2813b04 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>
-- 
GitLab