mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Removed unused exceptions. Also disabled output for ant tests.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user