Program: 85870
Project: 85870
Buggy source:
protected synchronized void handleNewPeer(final Peer peer){
  log.info("String_Node_Str",peer);
  try {
    if (bloomFilter != null)     peer.sendMessage(bloomFilter);
  }
 catch (  IOException e) {
  }
  peer.setMemoryPool(memoryPool);
  peer.setDownloadData(false);
  if (downloadListener != null && downloadPeer == null && chain != null) {
    log.info("String_Node_Str");
    startBlockChainDownloadFromPeer(peer);
  }
 else {
    Peer newDownloadPeer=selectDownloadPeer(peers);
    if (downloadPeer != newDownloadPeer) {
      setDownloadPeer(newDownloadPeer);
    }
  }
  peer.addEventListener(getDataListener);
  announcePendingWalletTransactions(wallets,Collections.singletonList(peer));
  for (  PeerEventListener listener : peerEventListeners) {
    peer.addEventListener(listener);
  }
  setupPingingForNewPeer(peer);
  EventListenerInvoker.invoke(peerEventListeners,new EventListenerInvoker<PeerEventListener>(){
    @Override public void invoke(    PeerEventListener listener){
      listener.onPeerConnected(peer,peers.size());
    }
  }
);
  final PeerGroup thisGroup=this;
  peer.addEventListener(new AbstractPeerEventListener(){
    int filteredBlocksReceivedFromPeer=0;
    @Override public Message onPreMessageReceived(    Peer peer,    Message m){
      if (m instanceof FilteredBlock) {
        filteredBlocksReceivedFromPeer++;
        if (filteredBlocksReceivedFromPeer % RESEND_BLOOM_FILTER_BLOCK_COUNT == RESEND_BLOOM_FILTER_BLOCK_COUNT - 1) {
          try {
synchronized (thisGroup) {
              peer.sendMessage(bloomFilter);
            }
          }
 catch (          IOException e) {
            throw new RuntimeException(e);
          }
        }
      }
      return m;
    }
  }
);
}

Fixed version (ground truth):
protected synchronized void handleNewPeer(final Peer peer){
  log.info("String_Node_Str",peer);
  try {
    if (bloomFilter != null)     peer.sendMessage(bloomFilter);
  }
 catch (  IOException e) {
  }
  peer.setMemoryPool(memoryPool);
  peer.setDownloadData(false);
  Peer newDownloadPeer=selectDownloadPeer(peers);
  if (downloadPeer != newDownloadPeer) {
    setDownloadPeer(newDownloadPeer);
    boolean shouldDownloadChain=downloadListener != null && chain != null;
    if (shouldDownloadChain) {
      startBlockChainDownloadFromPeer(downloadPeer);
    }
  }
  peer.addEventListener(getDataListener);
  announcePendingWalletTransactions(wallets,Collections.singletonList(peer));
  for (  PeerEventListener listener : peerEventListeners) {
    peer.addEventListener(listener);
  }
  setupPingingForNewPeer(peer);
  EventListenerInvoker.invoke(peerEventListeners,new EventListenerInvoker<PeerEventListener>(){
    @Override public void invoke(    PeerEventListener listener){
      listener.onPeerConnected(peer,peers.size());
    }
  }
);
  final PeerGroup thisGroup=this;
  peer.addEventListener(new AbstractPeerEventListener(){
    int filteredBlocksReceivedFromPeer=0;
    @Override public Message onPreMessageReceived(    Peer peer,    Message m){
      if (m instanceof FilteredBlock) {
        filteredBlocksReceivedFromPeer++;
        if (filteredBlocksReceivedFromPeer % RESEND_BLOOM_FILTER_BLOCK_COUNT == RESEND_BLOOM_FILTER_BLOCK_COUNT - 1) {
          try {
synchronized (thisGroup) {
              peer.sendMessage(bloomFilter);
            }
          }
 catch (          IOException e) {
            throw new RuntimeException(e);
          }
        }
      }
      return m;
    }
  }
);
}