diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java
index 9058680..1d79b67 100644
--- a/src/org/ice4j/ice/Agent.java
+++ b/src/org/ice4j/ice/Agent.java
@@ -85,6 +85,13 @@ public class Agent
private static final Logger logger
= Logger.getLogger(Agent.class.getName());
+ /**
+ * The name of the {@link PropertyChangeEvent} that we use to deliver
+ * events on changes in the state of ICE processing in this agent.
+ */
+ public static final String PROPERTY_ICE_PROCESSING_STATE
+ = "IceProcessingState";
+
/**
* The LinkedHashMap used to store the media streams
* This map preserves the insertion order of the media streams.
@@ -124,13 +131,6 @@ public class Agent
*/
private final DefaultNominator nominator;
- /**
- * The name of the {@link PropertyChangeEvent} that we use to deliver
- * events on changes in the state of ICE processing in this agent.
- */
- public static final String PROPERTY_ICE_PROCESSING_STATE
- = "IceProcessingState";
-
/**
* The value of Ta as specified by the application or -1
* if non was specified and we should calculate one ourselves.
@@ -141,7 +141,7 @@ public class Agent
* The List of remote addresses that we have discovered through
* incoming connectivity checks, before actually receiving a session
* description from the peer and that may potentially contain peer reflexive
- * addresses. This list is stored and only if and while connectivity checks
+ * addresses. This list is stored only if and while connectivity checks
* are not running. Once they start, we are able to determine whether the
* addresses in here are actually peer-reflexive or not, and schedule
* the necessary triggered checks.
@@ -241,7 +241,7 @@ public class Agent
private boolean shutdown = false;
/**
- * Indicates that harvesting has been started at least ones. Used to warn
+ * Indicates that harvesting has been started at least once. Used to warn
* users who are trying to trickle, that they have already completed a
* harvest. We may use it to throw an exception at some point if it's ever
* a problem.
@@ -301,8 +301,8 @@ public class Agent
// Since we add a new stream, we must wait to add the component and the
// remote candidates before starting to "RUN" this Agent.
- // This is usefull if this Agent is already in COMPLETED state
- // (isStarted() == true) due to a previous successful ICE preocedure:
+ // This is useful if this Agent is already in COMPLETED state
+ // (isStarted() == true) due to a previous successful ICE procedure:
// this way incoming connectivity checks are registered in the
// preDiscoveredPairsQueue until this Agent is in RUNNING state.
this.setState(IceProcessingState.WAITING);
@@ -322,7 +322,7 @@ public class Agent
* @param minPort the port number where we should first try to bind before
* moving to the next one (i.e. minPort + 1)
* @param maxPort the maximum port number where we should try binding
- * before giving up and throwinG an exception.
+ * before giving up and throwing an exception.
*
* @return the newly created {@link Component} and with a list containing
* all and only local candidates.
@@ -364,10 +364,10 @@ public class Agent
/*
* Lyubomir: After we've gathered the LocalCandidate for a Component and
- * before we've make them available to the caller, we have to make sure
+ * before we've made them available to the caller, we have to make sure
* that the ConnectivityCheckServer is started. If there's been a
* previous connectivity establishment which has completed, it has
- * stopped the ConnectivityCheckServer. If the ConnectivtyCheckServer is
+ * stopped the ConnectivityCheckServer. If the ConnectivityCheckServer is
* not started after we've made the gathered LocalCandidates available
* to the caller, the caller may send them and a connectivity check may
* arrive from the remote Agent.
@@ -1388,9 +1388,8 @@ public class Agent
{
//first check whether we already know about the remote address in case
//we've just discovered a peer-reflexive candidate.
- CandidatePair knownPair = null;
-
- knownPair = this.findCandidatePair(
+ CandidatePair knownPair
+ = findCandidatePair(
triggerPair.getLocalCandidate().getTransportAddress(),
triggerPair.getRemoteCandidate().getTransportAddress());
diff --git a/src/org/ice4j/ice/harvest/HostCandidateHarvester.java b/src/org/ice4j/ice/harvest/HostCandidateHarvester.java
index 7d93f0d..db1cdd6 100644
--- a/src/org/ice4j/ice/harvest/HostCandidateHarvester.java
+++ b/src/org/ice4j/ice/harvest/HostCandidateHarvester.java
@@ -35,7 +35,7 @@ public class HostCandidateHarvester
= Logger.getLogger(HostCandidateHarvester.class.getName());
/**
- * Manages statisics about harvesting time.
+ * Manages statistics about harvesting time.
*/
private HarvestStatistics harvestStatistics = new HarvestStatistics();
@@ -312,7 +312,7 @@ public class HostCandidateHarvester
* @param minPort the port number where we should first try to bind before
* moving to the next one (i.e. minPort + 1)
* @param maxPort the maximum port number where we should try binding
- * before giving up and throwinG an exception.
+ * before giving up and throwing an exception.
*
* @return the newly created DatagramSocket.
*
@@ -488,7 +488,7 @@ public class HostCandidateHarvester
* @param minPort the port number where we should first try to bind before
* moving to the next one (i.e. minPort + 1)
* @param maxPort the maximum port number where we should try binding
- * before giving up and throwinG an exception.
+ * before giving up and throwing an exception.
*
* @throws IllegalArgumentException if either minPort or
* maxPort is not a valid port number or if minPort is
diff --git a/src/org/ice4j/socket/IceSocketWrapper.java b/src/org/ice4j/socket/IceSocketWrapper.java
index 17897f4..4c8c6d3 100644
--- a/src/org/ice4j/socket/IceSocketWrapper.java
+++ b/src/org/ice4j/socket/IceSocketWrapper.java
@@ -19,11 +19,11 @@ public abstract class IceSocketWrapper
/**
* Sends a DatagramPacket from this socket
* It is a utility method to provide a common way to send for both
- * UDP and TCP socket. If the underlying socket is a TCP ones, it is still
+ * UDP and TCP socket. If the underlying socket is a TCP one, it is still
* possible to get the OutputStream and do stuff with it.
*
*
- * @param p DatagramPacket to sent
+ * @param p DatagramPacket to send
* @throws IOException if something goes wrong
*/
public abstract void send(DatagramPacket p)
@@ -32,7 +32,7 @@ public abstract class IceSocketWrapper
/**
* Receives a DatagramPacket from this socket.
* It is a utility method to provide a common way to receive for both
- * UDP and TCP socket. If the underlying socket is a TCP ones, it is still
+ * UDP and TCP socket. If the underlying socket is a TCP one, it is still
* possible to get the InputStream and do stuff with it.
*
* @param p DatagramPacket
@@ -68,20 +68,20 @@ public abstract class IceSocketWrapper
public abstract SocketAddress getLocalSocketAddress();
/**
- * Returns Socket object if the delegate socket is a TCP ones, null
+ * Returns Socket object if the delegate socket is a TCP one, null
* otherwise.
*
- * @return Socket object if the delegate socket is a TCP ones, null
- * otherwise
+ * @return Socket object if the delegate socket is a TCP one, null
+ * otherwise.
*/
public abstract Socket getTCPSocket();
/**
- * Returns DatagramSocket object if the delegate socket is a TCP ones, null
+ * Returns DatagramSocket object if the delegate socket is a UDP one, null
* otherwise.
*
- * @return DatagramSocket object if the delegate socket is a TCP ones, null
- * otherwise
+ * @return DatagramSocket object if the delegate socket is a UDP one, null
+ * otherwise.
*/
public abstract DatagramSocket getUDPSocket();
}
diff --git a/src/org/ice4j/socket/IceTcpSocketWrapper.java b/src/org/ice4j/socket/IceTcpSocketWrapper.java
index 5c4d11c..4e2402d 100644
--- a/src/org/ice4j/socket/IceTcpSocketWrapper.java
+++ b/src/org/ice4j/socket/IceTcpSocketWrapper.java
@@ -135,24 +135,18 @@ public class IceTcpSocketWrapper
}
/**
- * Returns Socket object if the delegate socket is a TCP ones, null
- * otherwise.
- *
- * @return Socket object if the delegate socket is a TCP ones, null
- * otherwise
+ * {@inheritDoc}
*/
+ @Override
public Socket getTCPSocket()
{
return socket;
}
/**
- * Returns DatagramSocket object if the delegate socket is a TCP ones, null
- * otherwise.
- *
- * @return DatagramSocket object if the delegate socket is a TCP ones, null
- * otherwise
+ * {@inheritDoc}
*/
+ @Override
public DatagramSocket getUDPSocket()
{
return null;
diff --git a/src/org/ice4j/socket/IceUdpSocketWrapper.java b/src/org/ice4j/socket/IceUdpSocketWrapper.java
index c59fa4b..6b40452 100644
--- a/src/org/ice4j/socket/IceUdpSocketWrapper.java
+++ b/src/org/ice4j/socket/IceUdpSocketWrapper.java
@@ -87,24 +87,18 @@ public class IceUdpSocketWrapper
}
/**
- * Returns Socket object if the delegate socket is a TCP ones, null
- * otherwise.
- *
- * @return Socket object if the delegate socket is a TCP ones, null
- * otherwise
+ * {@inheritDoc}
*/
+ @Override
public Socket getTCPSocket()
{
return null;
}
/**
- * Returns DatagramSocket object if the delegate socket is a TCP ones, null
- * otherwise.
- *
- * @return DatagramSocket object if the delegate socket is a TCP ones, null
- * otherwise
+ * {@inheritDoc}
*/
+ @Override
public DatagramSocket getUDPSocket()
{
return socket;
diff --git a/src/org/ice4j/socket/MultiplexingSocket.java b/src/org/ice4j/socket/MultiplexingSocket.java
index 5b04e48..8822bd9 100644
--- a/src/org/ice4j/socket/MultiplexingSocket.java
+++ b/src/org/ice4j/socket/MultiplexingSocket.java
@@ -317,18 +317,19 @@ public class MultiplexingSocket
* @throws SocketTimeoutException if the timeout has expired
* @throws IOException if an I/O error occurs
*/
- private void receive(List received, DatagramPacket p,
- int timeout)
+ private void receive(List received,
+ DatagramPacket p,
+ int timeout)
throws SocketTimeoutException, IOException
{
- long now, start = System.currentTimeMillis();
+ long now, start = System.currentTimeMillis();
DatagramPacket r = null;
do
{
- now = System.currentTimeMillis();
- if (timeout > 0 && now - start >= timeout)
- throw new SocketTimeoutException("Socket timeout");
+ now = System.currentTimeMillis();
+ if (timeout > 0 && now - start >= timeout)
+ throw new SocketTimeoutException("Socket timeout");
boolean doReceive;
@@ -341,10 +342,10 @@ public class MultiplexingSocket
doReceive = false;
try
{
- if (timeout > 0)
- receiveSyncRoot.wait(timeout - (now - start));
- else
- receiveSyncRoot.wait();
+ if (timeout > 0)
+ receiveSyncRoot.wait(timeout - (now - start));
+ else
+ receiveSyncRoot.wait();
}
catch (InterruptedException iex)
{
diff --git a/src/org/ice4j/stack/StunStack.java b/src/org/ice4j/stack/StunStack.java
index 0de9d53..8f2a17a 100644
--- a/src/org/ice4j/stack/StunStack.java
+++ b/src/org/ice4j/stack/StunStack.java
@@ -56,7 +56,7 @@ public class StunStack
/**
* Our network gateway.
*/
- private NetAccessManager netAccessManager = null;
+ private final NetAccessManager netAccessManager;
/**
* The {@link CredentialsManager} that we are using for retrieving
@@ -464,8 +464,6 @@ public class StunStack
ioex);
}
}
-
- /**
/**
* Sends a specific STUN Indication to a specific destination