From ef562bd688a63dbd09eb87b304d2fb386ddc617a Mon Sep 17 00:00:00 2001 From: "lubomir.marinov" Date: Thu, 11 Feb 2010 15:48:42 +0000 Subject: [PATCH] - Removes a couple of unnecessary lines which duplicated the previous two lines. - Fixes a NullPointerException and related warnings about inconsistent synchronization. --- src/org/ice4j/TransportAddress.java | 17 ++++++++++++++++- src/org/ice4j/stack/Connector.java | 5 +---- src/org/ice4j/stack/EventDispatcher.java | 6 +++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/org/ice4j/TransportAddress.java b/src/org/ice4j/TransportAddress.java index 5c0523b..4e92b77 100644 --- a/src/org/ice4j/TransportAddress.java +++ b/src/org/ice4j/TransportAddress.java @@ -14,8 +14,8 @@ import org.ice4j.ice.*; * The Address class is used to define destinations to outgoing Stun Packets. * * @author Emil Ivov + * @author Lubomir Marinov */ - public class TransportAddress extends InetSocketAddress { @@ -168,6 +168,21 @@ public class TransportAddress return transport; } + /** + * Determines whether this TransportAddress is value equal to a + * specific TransportAddress. + * + * @param transportAddress the TransportAddress to test for value + * equality with this TransportAddress + * @return true if this TransportAddress is value equal to + * the specified transportAddress; otherwise, false + * @see #equalsTransportAddress(Object) + */ + public boolean equals(TransportAddress transportAddress) + { + return equalsTransportAddress(transportAddress); + } + /** * Compares this object against the specified object. The result is * true if and only if the argument is not null and it diff --git a/src/org/ice4j/stack/Connector.java b/src/org/ice4j/stack/Connector.java index aba0cc8..29fd940 100644 --- a/src/org/ice4j/stack/Connector.java +++ b/src/org/ice4j/stack/Connector.java @@ -131,10 +131,6 @@ class Connector localSock.receive(packet); - //get lost if we are no longer running. - if(!isRunning) - return; - //get lost if we are no longer running. if(!isRunning) return; @@ -225,6 +221,7 @@ class Connector * Returns a String representation of the object. * @return a String representation of the object. */ + @Override public String toString() { return "org.ice4j.stack.AccessPoint@" diff --git a/src/org/ice4j/stack/EventDispatcher.java b/src/org/ice4j/stack/EventDispatcher.java index 1a0209f..49aaf25 100644 --- a/src/org/ice4j/stack/EventDispatcher.java +++ b/src/org/ice4j/stack/EventDispatcher.java @@ -32,7 +32,7 @@ public class EventDispatcher * Hashtable for managing property change listeners registered for specific * properties. Maps property names to PropertyChangeSupport objects. */ - private Hashtable + private final Hashtable requestListenersChildren = new Hashtable(); @@ -176,7 +176,7 @@ public class EventDispatcher synchronized(requestListenersChildren) { - if (requestListenersChildren != null) + if (!requestListenersChildren.isEmpty()) { EventDispatcher child = requestListenersChildren.get(localAddr); if (child != null && child.requestListeners != null) @@ -196,6 +196,6 @@ public class EventDispatcher { if(requestListeners != null) requestListeners.removeAllElements(); - requestListenersChildren = null; + requestListenersChildren.clear(); } }