Skip to content
Snippets Groups Projects
Commit f609b97f authored by Lyubomir Marinov's avatar Lyubomir Marinov
Browse files

- Fixes the Eclipse .classpath of libjitsi which was broken because of the...

- Fixes the Eclipse .classpath of libjitsi which was broken because of the change of the JSON implementation library.
- Fixes a call-related memory leak.
parent 0331039a
Branches
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<classpathentry kind="lib" path="lib/fmj.jar"/> <classpathentry kind="lib" path="lib/fmj.jar"/>
<classpathentry kind="lib" path="lib/ice4j.jar"/> <classpathentry kind="lib" path="lib/ice4j.jar"/>
<classpathentry kind="lib" path="lib/jain-sdp.jar"/> <classpathentry kind="lib" path="lib/jain-sdp.jar"/>
<classpathentry kind="lib" path="lib/json-20090723.jar"/> <classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/jspeex.jar"/> <classpathentry kind="lib" path="lib/jspeex.jar"/>
<classpathentry kind="lib" path="lib/lcrypto-jdk16-143.jar"/> <classpathentry kind="lib" path="lib/lcrypto-jdk16-143.jar"/>
<classpathentry kind="lib" path="lib/osgi.core.jar"/> <classpathentry kind="lib" path="lib/osgi.core.jar"/>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
import java.beans.*; import java.beans.*;
import java.util.*; import java.util.*;
import org.jitsi.util.*;
/** /**
* Represents a source of <tt>PropertyChangeEvent</tt>s which notifies * Represents a source of <tt>PropertyChangeEvent</tt>s which notifies
* <tt>PropertyChangeListener</tt>s about changes in the values of properties. * <tt>PropertyChangeListener</tt>s about changes in the values of properties.
...@@ -17,6 +19,12 @@ ...@@ -17,6 +19,12 @@
*/ */
public class PropertyChangeNotifier public class PropertyChangeNotifier
{ {
/**
* The <tt>Logger</tt> used by the <tt>PropertyChangeNotifier</tt> class and
* its instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(PropertyChangeNotifier.class);
/** /**
* The list of <tt>PropertyChangeListener</tt>s interested in and notified * The list of <tt>PropertyChangeListener</tt>s interested in and notified
...@@ -30,7 +38,7 @@ public class PropertyChangeNotifier ...@@ -30,7 +38,7 @@ public class PropertyChangeNotifier
* Adds a specific <tt>PropertyChangeListener</tt> to the list of listeners * Adds a specific <tt>PropertyChangeListener</tt> to the list of listeners
* interested in and notified about changes in the values of the properties * interested in and notified about changes in the values of the properties
* of this <tt>PropertyChangeNotifier</tt>. * of this <tt>PropertyChangeNotifier</tt>.
* *
* @param listener a <tt>PropertyChangeListener</tt> to be notified about * @param listener a <tt>PropertyChangeListener</tt> to be notified about
* changes in the values of the properties of this * changes in the values of the properties of this
* <tt>PropertyChangeNotifier</tt>. If the specified listener is already in * <tt>PropertyChangeNotifier</tt>. If the specified listener is already in
...@@ -39,19 +47,30 @@ public class PropertyChangeNotifier ...@@ -39,19 +47,30 @@ public class PropertyChangeNotifier
*/ */
public void addPropertyChangeListener(PropertyChangeListener listener) public void addPropertyChangeListener(PropertyChangeListener listener)
{ {
if (listener != null) if (listener == null)
{
if (logger.isDebugEnabled())
{
logger.debug(
"The specified argument listener is null"
+ " and that does not make sense.");
}
}
else
{
synchronized (listeners) synchronized (listeners)
{ {
if (!listeners.contains(listener)) if (!listeners.contains(listener))
listeners.add(listener); listeners.add(listener);
} }
}
} }
/** /**
* Removes a specific <tt>PropertyChangeListener</tt> from the list of * Removes a specific <tt>PropertyChangeListener</tt> from the list of
* listeners interested in and notified about changes in the values of the * listeners interested in and notified about changes in the values of the
* properties of this <tt>PropertyChangeNotifer</tt>. * properties of this <tt>PropertyChangeNotifer</tt>.
* *
* @param listener a <tt>PropertyChangeListener</tt> to no longer be * @param listener a <tt>PropertyChangeListener</tt> to no longer be
* notified about changes in the values of the properties of this * notified about changes in the values of the properties of this
* <tt>PropertyChangeNotifier</tt> * <tt>PropertyChangeNotifier</tt>
...@@ -59,10 +78,12 @@ public void addPropertyChangeListener(PropertyChangeListener listener) ...@@ -59,10 +78,12 @@ public void addPropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener) public void removePropertyChangeListener(PropertyChangeListener listener)
{ {
if (listener != null) if (listener != null)
{
synchronized (listeners) synchronized (listeners)
{ {
listeners.remove(listener); listeners.remove(listener);
} }
}
} }
/** /**
...@@ -73,7 +94,7 @@ public void removePropertyChangeListener(PropertyChangeListener listener) ...@@ -73,7 +94,7 @@ public void removePropertyChangeListener(PropertyChangeListener listener)
* specific new value. <tt>PropertyChangeNotifier</tt> does not check * specific new value. <tt>PropertyChangeNotifier</tt> does not check
* whether the specified <tt>oldValue</tt> and <tt>newValue</tt> are indeed * whether the specified <tt>oldValue</tt> and <tt>newValue</tt> are indeed
* different. * different.
* *
* @param property the name of the property of this * @param property the name of the property of this
* <tt>PropertyChangeNotifier</tt> which had its value changed * <tt>PropertyChangeNotifier</tt> which had its value changed
* @param oldValue the value of the property with the specified name before * @param oldValue the value of the property with the specified name before
...@@ -83,29 +104,27 @@ public void removePropertyChangeListener(PropertyChangeListener listener) ...@@ -83,29 +104,27 @@ public void removePropertyChangeListener(PropertyChangeListener listener)
*/ */
protected void firePropertyChange( protected void firePropertyChange(
String property, String property,
Object oldValue, Object oldValue, Object newValue)
Object newValue)
{ {
PropertyChangeListener[] listeners; PropertyChangeListener[] ls;
synchronized (this.listeners) synchronized (listeners)
{ {
listeners ls
= this.listeners.toArray( = listeners.toArray(
new PropertyChangeListener[this.listeners.size()]); new PropertyChangeListener[listeners.size()]);
} }
if (listeners.length != 0) if (ls.length != 0)
{ {
PropertyChangeEvent event PropertyChangeEvent ev
= new PropertyChangeEvent( = new PropertyChangeEvent(
getPropertyChangeSource(property, oldValue, newValue), getPropertyChangeSource(property, oldValue, newValue),
property, property,
oldValue, oldValue, newValue);
newValue);
for (PropertyChangeListener listener : listeners) for (PropertyChangeListener l : ls)
listener.propertyChange(event); l.propertyChange(ev);
} }
} }
...@@ -116,7 +135,7 @@ protected void firePropertyChange( ...@@ -116,7 +135,7 @@ protected void firePropertyChange(
* <tt>PropertyChangeNotifier</tt> about the change in the value of a * <tt>PropertyChangeNotifier</tt> about the change in the value of a
* property with a specific name from a specific old value to a specific new * property with a specific name from a specific old value to a specific new
* value. * value.
* *
* @param property the name of the property which had its value changed from * @param property the name of the property which had its value changed from
* the specified old value to the specified new value * the specified old value to the specified new value
* @param oldValue the value of the property with the specified name before * @param oldValue the value of the property with the specified name before
...@@ -132,8 +151,7 @@ protected void firePropertyChange( ...@@ -132,8 +151,7 @@ protected void firePropertyChange(
*/ */
protected Object getPropertyChangeSource( protected Object getPropertyChangeSource(
String property, String property,
Object oldValue, Object oldValue, Object newValue)
Object newValue)
{ {
return this; return this;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment