Program: 12447
Project: 12447
Buggy source:
private Integer doSend() throws Exception {
  if (message == null) {
    this.progress.incrFailed();
    return 0;
  }
  if (message.getClients() != null) {
    SentProgress thisProg=new SentProgress(message.getClients().size());
    for (    String client : message.getClients()) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str",client,message);
      }
      Connection c=ConnectionKeeper.get(product.getAppKey(),client);
      if (c != null) {
        c.send(thisProg,message);
      }
 else {
        if (product.getClientTypeid().intValue() != ClientType.iOS) {
          thisProg.incrFailed();
          continue;
        }
        Client cc=ClientServiceImpl.instance.findByUserId(client);
        if (cc == null) {
          logger.error("String_Node_Str" + client);
          thisProg.incrFailed();
          continue;
        }
        if (!cc.isDevice(ClientType.iOS)) {
          thisProg.incrFailed();
          continue;
        }
        if (StringUtils.isBlank(cc.getDeviceToken())) {
          thisProg.incrFailed();
          logger.error("String_Node_Str" + client);
          continue;
        }
        APNSKeeper.push(thisProg,this.product,cc,message);
      }
    }
    try {
      thisProg.getCountDownLatch().await();
    }
 catch (    InterruptedException e) {
      logger.error(e.getMessage(),e);
    }
    logger.info("String_Node_Str" + message.getId() + "String_Node_Str"+ thisProg);
    int total=thisProg.getSuccess().get();
    if (total > 0) {
      MetricBuilder.pushMeter.mark(total);
      MetricBuilder.pushSingleMeter.mark(total);
    }
    try {
      if (message.getStatusId().intValue() == PayloadStatus.Pending0) {
        message.setTotalUsers(total);
        message.setSentDate(new Date().getTime() / 1000);
        message.setStatusId(PayloadStatus.Sent);
        PayloadServiceImpl.instance.saveWithId(message);
      }
 else {
        PayloadServiceImpl.instance.updateSendStatus(message,total);
      }
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
    this.progress.incrSuccess();
    return total;
  }
 else {
    logger.error("String_Node_Str",message);
  }
  return 0;
}

Fixed version (ground truth):
private Integer doSend() throws Exception {
  if (message == null) {
    this.progress.incrFailed();
    return 0;
  }
  if (message.getClients() != null) {
    SentProgress thisProg=new SentProgress(message.getClients().size());
    for (    String client : message.getClients()) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str",client,message);
      }
      Connection c=ConnectionKeeper.get(product.getAppKey(),client);
      if (c != null) {
        c.send(thisProg,message);
      }
 else {
        Client cc=ClientServiceImpl.instance.findByUserId(client);
        if (cc == null) {
          logger.error("String_Node_Str" + client);
          thisProg.incrFailed();
          continue;
        }
        if (!cc.isDevice(ClientType.iOS)) {
          thisProg.incrFailed();
          message.addFailedClient(cc.getUserId());
          continue;
        }
        if (StringUtils.isBlank(cc.getDeviceToken())) {
          thisProg.incrFailed();
          message.addFailedClient(cc.getUserId());
          logger.error("String_Node_Str" + client);
          continue;
        }
        APNSKeeper.push(thisProg,this.product,cc,message);
      }
    }
    try {
      thisProg.getCountDownLatch().await();
    }
 catch (    InterruptedException e) {
      logger.error(e.getMessage(),e);
    }
    logger.info("String_Node_Str" + message.getId() + "String_Node_Str"+ thisProg);
    int total=thisProg.getSuccess().get();
    if (total > 0) {
      MetricBuilder.pushMeter.mark(total);
      MetricBuilder.pushSingleMeter.mark(total);
    }
    try {
      if (message.getStatusId().intValue() == PayloadStatus.Pending0) {
        message.setTotalUsers(total);
        message.setSentDate(new Date().getTime() / 1000);
        message.setStatusId(PayloadStatus.Sent);
        PayloadServiceImpl.instance.saveAfterSent(message);
      }
 else {
        PayloadServiceImpl.instance.updateSendStatus(message,total);
      }
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
    this.progress.incrSuccess();
    return total;
  }
 else {
    logger.error("String_Node_Str",message);
  }
  return 0;
}