Program: 105059
Project: 105059
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override List<Endpoint> speechActivityEndpointsChanged(List<Endpoint> endpoints){
  Lock writeLock=lastNSyncRoot.writeLock();
  List<Endpoint> endpointsEnteringLastN=null;
  boolean lastNEndpointsChanged=false;
  writeLock.lock();
  try {
    int lastN=getLastN();
    if (endpoints == null) {
      endpoints=conferenceSpeechActivity.getEndpoints();
    }
    if (lastN > 0) {
      Endpoint thisEndpoint=getEndpoint();
      endpointsEnteringLastN=new ArrayList<Endpoint>(lastN);
      for (      Endpoint e : endpoints) {
        if (!e.equals(thisEndpoint)) {
          endpointsEnteringLastN.add(e);
          if (endpointsEnteringLastN.size() >= lastN)           break;
        }
      }
      if (!endpointsEnteringLastN.isEmpty())       lastNEndpointsChanged=true;
      if (lastNEndpoints != null && !lastNEndpoints.isEmpty()) {
        int n=0;
        for (        WeakReference<Endpoint> wr : lastNEndpoints) {
          Endpoint e=wr.get();
          if (e != null) {
            if (e.equals(thisEndpoint)) {
              continue;
            }
 else {
              endpointsEnteringLastN.remove(e);
              if (lastNIndexOf(endpoints,lastN,e) < 0)               lastNEndpointsChanged=true;
            }
          }
          ++n;
          if (n >= lastN)           break;
        }
      }
    }
    lastNEndpoints=new ArrayList<WeakReference<Endpoint>>(endpoints.size());
    for (    Endpoint endpoint : endpoints)     lastNEndpoints.add(new WeakReference<Endpoint>(endpoint));
  }
  finally {
    writeLock.unlock();
  }
  if (lastNEndpointsChanged)   lastNEndpointsChanged(endpointsEnteringLastN);
  return endpointsEnteringLastN;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override List<Endpoint> speechActivityEndpointsChanged(List<Endpoint> endpoints){
  Lock writeLock=lastNSyncRoot.writeLock();
  List<Endpoint> endpointsEnteringLastN=null;
  boolean lastNEndpointsChanged=false;
  writeLock.lock();
  try {
    int lastN=getLastN();
    if (endpoints == null) {
      endpoints=conferenceSpeechActivity.getEndpoints();
    }
    if (lastN > 0) {
      Endpoint thisEndpoint=getEndpoint();
      endpointsEnteringLastN=new ArrayList<Endpoint>(lastN);
      for (      Endpoint e : endpoints) {
        if (!e.equals(thisEndpoint)) {
          endpointsEnteringLastN.add(e);
          if (endpointsEnteringLastN.size() >= lastN)           break;
        }
      }
      if (lastNEndpoints != null && !lastNEndpoints.isEmpty()) {
        int n=0;
        for (        WeakReference<Endpoint> wr : lastNEndpoints) {
          Endpoint e=wr.get();
          if (e != null) {
            if (e.equals(thisEndpoint)) {
              continue;
            }
 else {
              endpointsEnteringLastN.remove(e);
              if (lastNIndexOf(endpoints,lastN,e) < 0)               lastNEndpointsChanged=true;
            }
          }
          ++n;
          if (n >= lastN)           break;
        }
      }
    }
    lastNEndpoints=new ArrayList<WeakReference<Endpoint>>(endpoints.size());
    for (    Endpoint endpoint : endpoints)     lastNEndpoints.add(new WeakReference<Endpoint>(endpoint));
  }
  finally {
    writeLock.unlock();
  }
  if (endpointsEnteringLastN != null && !endpointsEnteringLastN.isEmpty()) {
    lastNEndpointsChanged=true;
  }
  if (lastNEndpointsChanged)   lastNEndpointsChanged(endpointsEnteringLastN);
  return endpointsEnteringLastN;
}