From 3f6e5c75645ee91c69177c1c2791ef12d85061ec Mon Sep 17 00:00:00 2001 From: "lubomir.marinov" Date: Mon, 4 Oct 2010 07:08:00 +0000 Subject: [PATCH] Fixes warnings, javadocs, formatting. --- src/org/ice4j/ice/Agent.java | 41 ++++++++++++++------------ src/org/ice4j/ice/Candidate.java | 5 ++-- src/org/ice4j/ice/RemoteCandidate.java | 4 +-- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java index 485b81e..22e5058 100644 --- a/src/org/ice4j/ice/Agent.java +++ b/src/org/ice4j/ice/Agent.java @@ -17,7 +17,6 @@ import java.util.logging.*; import org.ice4j.*; import org.ice4j.ice.harvest.*; -import org.ice4j.message.*; import org.ice4j.stack.*; /** @@ -56,18 +55,18 @@ public class Agent = new PropertyChangeListener[0]; /** - * The Logger used by the Agent - * class and its instances for logging output. + * The Logger used by the Agent class and its instances + * for logging output. */ - private static final Logger logger = Logger - .getLogger(Agent.class.getName()); + private static final Logger logger + = Logger.getLogger(Agent.class.getName()); /** * The LinkedHashMap used to store the media streams * This map preserves the insertion order of the media streams. */ - private Map mediaStreams - = new LinkedHashMap(); + private final Map mediaStreams + = new LinkedHashMap(); /** * The candidate harvester that we use to gather candidate on the local @@ -119,7 +118,7 @@ public class Agent * the necessary triggered checks. */ private final List preDiscoveredPairsQueue - = new Vector(); + = new LinkedList(); /** * The lock that we use while starting connectivity establishment. @@ -467,11 +466,17 @@ public class Agent = stateListeners.toArray(NO_STATE_CHANGE_LISTENERS); } - PropertyChangeEvent evt = new PropertyChangeEvent( - this, PROPERTY_ICE_PROCESSING_STATE, oldState, newState); + if (stateListenersCopy.length != 0) + { + PropertyChangeEvent evt + = new PropertyChangeEvent( + this, + PROPERTY_ICE_PROCESSING_STATE, + oldState, newState); - for(PropertyChangeListener l : stateListenersCopy) - l.propertyChange(evt); + for(PropertyChangeListener l : stateListenersCopy) + l.propertyChange(evt); + } } /** @@ -772,7 +777,7 @@ public class Agent @Override public String toString() { - StringBuffer buff = new StringBuffer("ICE Agent (stream-count="); + StringBuilder buff = new StringBuilder("ICE Agent (stream-count="); buff.append(getStreamCount()).append(" ice-pwd:") .append(getLocalPassword()); @@ -782,11 +787,8 @@ public class Agent .append(getTieBreaker()); buff.append("):\n"); - List streams = getStreams(); - for(IceMediaStream stream : streams) - { + for(IceMediaStream stream : getStreams()) buff.append(stream.toString()).append("\n"); - } return buff.toString(); } @@ -956,8 +958,9 @@ public class Agent * @param priority the priority that the remote party assigned to * @param remoteUFrag the user fragment that we should be using when and if * we decide to send a check to remoteAddress. - * @param useCandidate indicates whether the incoming check {@link Request} - * contained the USE-CANDIDATE ICE attribute. + * @param useCandidate indicates whether the incoming check + * {@link org.ice4j.message.Request} contained the USE-CANDIDATE ICE + * attribute. */ protected void incomingCheckReceived(TransportAddress remoteAddress, TransportAddress localAddress, diff --git a/src/org/ice4j/ice/Candidate.java b/src/org/ice4j/ice/Candidate.java index 1cd14df..d1dabfe 100644 --- a/src/org/ice4j/ice/Candidate.java +++ b/src/org/ice4j/ice/Candidate.java @@ -260,6 +260,7 @@ public abstract class Candidate * * @throws java.lang.NullPointerException if obj is null; */ + @Override public boolean equals(Object obj) throws NullPointerException { @@ -614,10 +615,10 @@ public abstract class Candidate * * @return a String representation of this Candidate. */ + @Override public String toString() { - StringBuffer buff - = new StringBuffer("candidate: "); + StringBuilder buff = new StringBuilder("candidate: "); buff.append(" ").append(getFoundation()); buff.append(" ").append(getParentComponent().getComponentID()); diff --git a/src/org/ice4j/ice/RemoteCandidate.java b/src/org/ice4j/ice/RemoteCandidate.java index 4f2ba33..51a2467 100644 --- a/src/org/ice4j/ice/RemoteCandidate.java +++ b/src/org/ice4j/ice/RemoteCandidate.java @@ -45,9 +45,8 @@ public class RemoteCandidate long priority) { super(transportAddress, parentComponent, type); - super.setFoundation(foundation); + setFoundation(foundation); setPriority(priority); - } /** @@ -98,6 +97,7 @@ public class RemoteCandidate * as "related" for this Candidate or null if they didn't * include it in SDP. */ + @Override public TransportAddress getRelatedAddress() { return raddr;