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

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