diff --git a/build.xml b/build.xml
index 3ff4f4f..9609cf6 100644
--- a/build.xml
+++ b/build.xml
@@ -34,6 +34,7 @@
deprecation="true"
destdir="${dest}"
nowarn="false"
+ optimize="true"
target="1.5"
source="1.5">
diff --git a/src/org/ice4j/pseudotcp/PseudoTcpSocketFactory.java b/src/org/ice4j/pseudotcp/PseudoTcpSocketFactory.java
index 667be49..544c7f1 100644
--- a/src/org/ice4j/pseudotcp/PseudoTcpSocketFactory.java
+++ b/src/org/ice4j/pseudotcp/PseudoTcpSocketFactory.java
@@ -12,7 +12,7 @@ public class PseudoTcpSocketFactory
* Default conversation ID
*/
public static final long DEFAULT_CONVERSATION_ID=0;
-
+
/**
* Default timeout for connect operation
*/
@@ -22,7 +22,6 @@ public class PseudoTcpSocketFactory
* Creates a socket and connects it to the specified
* port number at the specified address.
*/
- @Override
public Socket createSocket(String host, int port)
throws IOException,
UnknownHostException
@@ -36,20 +35,19 @@ public class PseudoTcpSocketFactory
* Creates a socket and connect it to the specified remote address
* on the specified remote port.
*/
- @Override
public Socket createSocket(InetAddress host, int port) throws IOException
{
Socket socket = createSocket();
connectSocket(socket, new InetSocketAddress(host, port));
return socket;
}
-
+
private void connectSocket(Socket socket, InetSocketAddress remoteSockAddr)
throws IOException
{
socket.connect(remoteSockAddr, DEFAULT_CONNECT_TIMEOUT);
}
-
+
/**
* Creates socket bound to local sockAddr
* @param sockAddr
@@ -67,7 +65,6 @@ public class PseudoTcpSocketFactory
/**
* Creates a socket and connects it to the specified remote host at the specified remote port.
*/
- @Override
public Socket createSocket(String host,
int port,
InetAddress localHost,
@@ -84,7 +81,6 @@ public class PseudoTcpSocketFactory
/**
* Creates a socket and connects it to the specified remote host on the specified remote port.
*/
- @Override
public Socket createSocket(InetAddress address, int port,
InetAddress localAddress, int localPort) throws IOException
{
@@ -107,14 +103,14 @@ public class PseudoTcpSocketFactory
return new PseudoTcpSocket(
new PseudoTcpSocketImpl(DEFAULT_CONVERSATION_ID, datagramSocket));
}
-
+
/**
* Creates the PseudoTcp socket and binds it to any available port
* on the local host machine. The socket will be bound to the
* {@link InetAddress#isAnyLocalAddress wildcard} address,
* an IP address chosen by the kernel.
- *
*/
+ @Override
public PseudoTcpSocket createSocket()
throws SocketException
{
@@ -122,7 +118,6 @@ public class PseudoTcpSocketFactory
new PseudoTcpSocketImpl(DEFAULT_CONVERSATION_ID));
}
- @Override
public SocketImpl createSocketImpl()
{
try
@@ -134,5 +129,4 @@ public class PseudoTcpSocketFactory
throw new RuntimeException(e);
}
}
-
}
diff --git a/src/org/ice4j/stack/Connector.java b/src/org/ice4j/stack/Connector.java
index 1007c5d..6ccd97b 100644
--- a/src/org/ice4j/stack/Connector.java
+++ b/src/org/ice4j/stack/Connector.java
@@ -27,8 +27,8 @@ class Connector
/**
* Our class logger.
*/
- private static final Logger logger =
- Logger.getLogger(Connector.class.getName());
+ private static final Logger logger
+ = Logger.getLogger(Connector.class.getName());
/**
* The message queue is where incoming messages are added.
@@ -204,10 +204,10 @@ class Connector
stop();
//Something wrong has happened
errorHandler.handleFatalError(
- this,
- "A socket exception was thrown while trying to "
- + "receive a message.",
- ex);
+ this,
+ "A socket exception was thrown"
+ + " while trying to receive a message.",
+ ex);
}
else
{
@@ -230,24 +230,26 @@ class Connector
stop();
errorHandler.handleFatalError(
- this,
- "Unknown error occurred while listening for messages!",
- ex);
+ this,
+ "Unknown error occurred while listening for messages!",
+ ex);
}
}
}
/**
* Makes the access point stop listening on its socket.
- *
*/
protected void stop()
{
synchronized(sockLock)
{
this.running = false;
- this.sock.close();
- this.sock = null;
+ if (this.sock != null)
+ {
+ this.sock.close();
+ this.sock = null;
+ }
}
}
diff --git a/src/org/ice4j/stack/NetAccessManager.java b/src/org/ice4j/stack/NetAccessManager.java
index d836078..595a6d1 100644
--- a/src/org/ice4j/stack/NetAccessManager.java
+++ b/src/org/ice4j/stack/NetAccessManager.java
@@ -232,15 +232,19 @@ class NetAccessManager
*/
protected void removeSocket(TransportAddress address)
{
- Connector ap = null;
+ Connector ap;
- if(address.getTransport() == Transport.UDP)
- {
- ap = netUDPAccessPoints.remove(address);
- }
- else if(address.getTransport() == Transport.TCP)
+ switch (address.getTransport())
{
+ case TCP:
ap = netTCPAccessPoints.remove(address);
+ break;
+ case UDP:
+ ap = netUDPAccessPoints.remove(address);
+ break;
+ default:
+ ap = null;
+ break;
}
if(ap != null)