Program: 85629
Project: 85629
Buggy source:
private void processInv(InventoryMessage inv){
  List<InventoryItem> items=inv.getItems();
  List<InventoryItem> transactions=new LinkedList<InventoryItem>();
  List<InventoryItem> blocks=new LinkedList<InventoryItem>();
  for (  InventoryItem item : items) {
switch (item.type) {
case Transaction:
      transactions.add(item);
    break;
case Block:
  blocks.add(item);
break;
default :
throw new IllegalStateException("String_Node_Str" + item.type);
}
}
final boolean downloadData=this.vDownloadData;
if (transactions.size() == 0 && blocks.size() == 1) {
if (downloadData && blockChain != null) {
if (!blockChain.isOrphan(blocks.get(0).hash)) {
blocksAnnounced.incrementAndGet();
}
}
 else {
blocksAnnounced.incrementAndGet();
}
}
GetDataMessage getdata=new GetDataMessage(params);
Iterator<InventoryItem> it=transactions.iterator();
while (it.hasNext()) {
InventoryItem item=it.next();
TransactionConfidence conf=context.getConfidenceTable().seen(item.hash,this.getAddress());
if (conf.numBroadcastPeers() > 1) {
it.remove();
}
 else {
log.debug("String_Node_Str",getAddress(),item.hash);
getdata.addItem(item);
pendingTxDownloads.add(conf);
}
}
boolean pingAfterGetData=false;
lock.lock();
try {
if (blocks.size() > 0 && downloadData && blockChain != null) {
for (InventoryItem item : blocks) {
if (blockChain.isOrphan(item.hash) && downloadBlockBodies) {
final Block orphanRoot=checkNotNull(blockChain.getOrphanRoot(item.hash));
blockChainDownloadLocked(orphanRoot.getHash());
}
 else {
if (!pendingBlockDownloads.contains(item.hash)) {
  if (vPeerVersionMessage.isBloomFilteringSupported() && useFilteredBlocks) {
    getdata.addFilteredBlock(item.hash);
    pingAfterGetData=true;
  }
 else {
    getdata.addItem(item);
  }
  pendingBlockDownloads.add(item.hash);
}
}
}
}
}
  finally {
lock.unlock();
}
if (!getdata.getItems().isEmpty()) {
sendMessage(getdata);
}
if (pingAfterGetData) sendMessage(new Ping((long)(Math.random() * Long.MAX_VALUE)));
}

Fixed version (ground truth):
private void processInv(InventoryMessage inv){
  List<InventoryItem> items=inv.getItems();
  List<InventoryItem> transactions=new LinkedList<InventoryItem>();
  List<InventoryItem> blocks=new LinkedList<InventoryItem>();
  for (  InventoryItem item : items) {
switch (item.type) {
case Transaction:
      transactions.add(item);
    break;
case Block:
  blocks.add(item);
break;
default :
throw new IllegalStateException("String_Node_Str" + item.type);
}
}
final boolean downloadData=this.vDownloadData;
if (transactions.size() == 0 && blocks.size() == 1) {
if (downloadData && blockChain != null) {
if (!blockChain.isOrphan(blocks.get(0).hash)) {
blocksAnnounced.incrementAndGet();
}
}
 else {
blocksAnnounced.incrementAndGet();
}
}
GetDataMessage getdata=new GetDataMessage(params);
Iterator<InventoryItem> it=transactions.iterator();
while (it.hasNext()) {
InventoryItem item=it.next();
TransactionConfidence conf=context.getConfidenceTable().seen(item.hash,this.getAddress());
if (conf.numBroadcastPeers() > 1) {
it.remove();
}
 else if (conf.getSource().equals(TransactionConfidence.Source.SELF)) {
it.remove();
}
 else {
log.debug("String_Node_Str",getAddress(),item.hash);
getdata.addItem(item);
pendingTxDownloads.add(conf);
}
}
boolean pingAfterGetData=false;
lock.lock();
try {
if (blocks.size() > 0 && downloadData && blockChain != null) {
for (InventoryItem item : blocks) {
if (blockChain.isOrphan(item.hash) && downloadBlockBodies) {
final Block orphanRoot=checkNotNull(blockChain.getOrphanRoot(item.hash));
blockChainDownloadLocked(orphanRoot.getHash());
}
 else {
if (!pendingBlockDownloads.contains(item.hash)) {
  if (vPeerVersionMessage.isBloomFilteringSupported() && useFilteredBlocks) {
    getdata.addFilteredBlock(item.hash);
    pingAfterGetData=true;
  }
 else {
    getdata.addItem(item);
  }
  pendingBlockDownloads.add(item.hash);
}
}
}
}
}
  finally {
lock.unlock();
}
if (!getdata.getItems().isEmpty()) {
sendMessage(getdata);
}
if (pingAfterGetData) sendMessage(new Ping((long)(Math.random() * Long.MAX_VALUE)));
}