Program: 50571
Project: 50571
Buggy source:
public void setMembers(List<MemberImpl> lsMembers){
  final Set<MembershipListener> listenerSet=listeners.get();
  Set<Member> setNew=new LinkedHashSet<Member>(lsMembers.size());
  for (  MemberImpl member : lsMembers) {
    final ClusterMember dummy=new ClusterMember(node.factory.getName(),member.getAddress(),member.localMember(),member.getNodeType());
    Member clusterMember=clusterMembers.get(dummy);
    if (clusterMember == null) {
      clusterMember=dummy;
      if (listenerSet != null && listenerSet.size() > 0) {
        node.executorManager.executeLocaly(new Runnable(){
          public void run(){
            MembershipEvent membershipEvent=new MembershipEvent(ClusterImpl.this,dummy,MembershipEvent.MEMBER_ADDED);
            for (            MembershipListener listener : listenerSet) {
              listener.memberAdded(membershipEvent);
            }
          }
        }
);
      }
    }
    if (clusterMember.localMember()) {
      localMember.set(clusterMember);
    }
    setNew.add(clusterMember);
  }
  if (listenerSet != null && listenerSet.size() > 0) {
    Set<Member> it=clusterMembers.keySet();
    for (    final Member cm : it) {
      if (!setNew.contains(cm)) {
        node.executorManager.executeLocaly(new Runnable(){
          public void run(){
            MembershipEvent membershipEvent=new MembershipEvent(ClusterImpl.this,cm,MembershipEvent.MEMBER_REMOVED);
            for (            MembershipListener listener : listenerSet) {
              listener.memberRemoved(membershipEvent);
            }
          }
        }
);
      }
    }
  }
  clusterMembers.clear();
  for (  Member cm : setNew) {
    clusterMembers.put(cm,cm);
  }
  members.set(setNew);
}

Fixed version (ground truth):
public void setMembers(List<MemberImpl> lsMembers){
  final Set<MembershipListener> listenerSet=listeners.get();
  Set<Member> setNew=new LinkedHashSet<Member>(lsMembers.size());
  for (  MemberImpl member : lsMembers) {
    final ClusterMember dummy=new ClusterMember(node.factory.getName(),member.getAddress(),member.localMember(),member.getNodeType());
    Member clusterMember=clusterMembers.get(dummy);
    if (clusterMember == null) {
      clusterMember=dummy;
      if (listenerSet != null && listenerSet.size() > 0) {
        node.executorManager.executeLocally(new Runnable(){
          public void run(){
            MembershipEvent membershipEvent=new MembershipEvent(ClusterImpl.this,dummy,MembershipEvent.MEMBER_ADDED);
            for (            MembershipListener listener : listenerSet) {
              listener.memberAdded(membershipEvent);
            }
          }
        }
);
      }
    }
    if (clusterMember.localMember()) {
      localMember.set(clusterMember);
    }
    setNew.add(clusterMember);
  }
  if (listenerSet != null && listenerSet.size() > 0) {
    Set<Member> it=clusterMembers.keySet();
    for (    final Member cm : it) {
      if (!setNew.contains(cm)) {
        node.executorManager.executeLocally(new Runnable(){
          public void run(){
            MembershipEvent membershipEvent=new MembershipEvent(ClusterImpl.this,cm,MembershipEvent.MEMBER_REMOVED);
            for (            MembershipListener listener : listenerSet) {
              listener.memberRemoved(membershipEvent);
            }
          }
        }
);
      }
    }
  }
  clusterMembers.clear();
  for (  Member cm : setNew) {
    clusterMembers.put(cm,cm);
  }
  members.set(setNew);
}