Program: 105031
Project: 105031
Buggy source:
/** 
 * Gets an <tt>Endpoint</tt> participating in this <tt>Conference</tt> which has a specific identifier/ID. If an <tt>Endpoint</tt> participating in this <tt>Conference</tt> with the specified <tt>id</tt> does not exist at the time the method is invoked, the method optionally initializes a new <tt>Endpoint</tt> instance with the specified <tt>id</tt> and adds it to the list of <tt>Endpoint</tt>s participating in this <tt>Conference</tt>.
 * @param id the identifier/ID of the <tt>Endpoint</tt> which is to bereturned
 * @return an <tt>Endpoint</tt> participating in this <tt>Conference</tt>which has the specified <tt>id</tt> or <tt>null</tt> if there is no such <tt>Endpoint</tt> and <tt>create</tt> equals <tt>false</tt>
 */
private Endpoint getEndpoint(String id,boolean create){
  Endpoint endpoint=null;
  boolean changed=false;
synchronized (endpoints) {
    for (Iterator<WeakReference<Endpoint>> i=endpoints.iterator(); i.hasNext(); ) {
      Endpoint e=i.next().get();
      if (e == null) {
        i.remove();
        changed=true;
      }
 else       if (e.getID().equals(id)) {
        endpoint=e;
      }
    }
    if (create && endpoint == null) {
      endpoint=new Endpoint(id);
      endpoint.addPropertyChangeListener(propertyChangeListener);
      endpoints.add(new WeakReference<Endpoint>(endpoint));
      changed=true;
      LoggingService loggingService=videobridge.getLoggingService();
      if (loggingService != null)       loggingService.logEvent(EventFactory.endpointCreated(getID(),id));
    }
  }
  if (changed)   firePropertyChange(ENDPOINTS_PROPERTY_NAME,null,null);
  return endpoint;
}

Fixed version (ground truth):
/** 
 * Gets an <tt>Endpoint</tt> participating in this <tt>Conference</tt> which has a specific identifier/ID. If an <tt>Endpoint</tt> participating in this <tt>Conference</tt> with the specified <tt>id</tt> does not exist at the time the method is invoked, the method optionally initializes a new <tt>Endpoint</tt> instance with the specified <tt>id</tt> and adds it to the list of <tt>Endpoint</tt>s participating in this <tt>Conference</tt>.
 * @param id the identifier/ID of the <tt>Endpoint</tt> which is to bereturned
 * @return an <tt>Endpoint</tt> participating in this <tt>Conference</tt>which has the specified <tt>id</tt> or <tt>null</tt> if there is no such <tt>Endpoint</tt> and <tt>create</tt> equals <tt>false</tt>
 */
private Endpoint getEndpoint(String id,boolean create){
  Endpoint endpoint=null;
  boolean changed=false;
synchronized (endpoints) {
    for (Iterator<WeakReference<Endpoint>> i=endpoints.iterator(); i.hasNext(); ) {
      Endpoint e=i.next().get();
      if (e == null) {
        i.remove();
        changed=true;
      }
 else       if (e.getID().equals(id)) {
        endpoint=e;
      }
    }
    if (create && endpoint == null) {
      endpoint=new Endpoint(id,this);
      endpoint.addPropertyChangeListener(propertyChangeListener);
      endpoints.add(new WeakReference<Endpoint>(endpoint));
      changed=true;
      LoggingService loggingService=videobridge.getLoggingService();
      if (loggingService != null)       loggingService.logEvent(EventFactory.endpointCreated(getID(),id));
    }
  }
  if (changed)   firePropertyChange(ENDPOINTS_PROPERTY_NAME,null,null);
  return endpoint;
}