Skip to content
Snippets Groups Projects
Commit a3a5ebc1 authored by akwizgran's avatar akwizgran
Browse files

Removed unused exceptions. Also disabled output for ant tests.

parent 4b1ffbe8
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 58 deletions
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;
}
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;
}
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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());
}
......
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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) {
......
<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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment