Commit 29381725 authored by Nicolas Gilmard's avatar Nicolas Gilmard

Fix issue #15

Inconsistent precondition
parent 2081aba3
......@@ -95,7 +95,8 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
*/
@Override
public void connect() {
Preconditions.checkState(objectManager != null, "All managers need to be instantiated!"); //$NON-NLS-1$
Preconditions.checkState(objectManager != null, "ObjectManager need to be instantiated!"); //$NON-NLS-1$
Preconditions.checkState(interfaceManager != null, "InterfaceManager need to be instantiated!"); //$NON-NLS-1$
client.addTuioListener(this);
client.connect();
......
......@@ -15,6 +15,8 @@ package lu.list.itis.dkd.tui.network.adapter;
import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
......@@ -53,6 +55,8 @@ public class TcpClient extends ClientAdapter {
* port > 0 && port <= 65535
*/
public TcpClient(String serverAddress, int port) {
Preconditions.checkState(port > 0 && port <= 65535, "Port must be greater than 0 and smaller or equal to 65535"); //$NON-NLS-1$
this.serverAddress = serverAddress;
this.port = port;
}
......
......@@ -15,6 +15,8 @@ package lu.list.itis.dkd.tui.network.adapter;
import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
......@@ -52,6 +54,7 @@ public class TcpServer extends ServerAdapter {
* @throws IOException
*/
public TcpServer(int port) throws IOException {
Preconditions.checkState(port > 0 && port <= 65535, "Port must be greater than 0 and smaller or equal to 65535"); //$NON-NLS-1$
this.port = port;
server = new ServerSocket(port);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment