Program: 12422
Project: 12422
Buggy source:
private Integer doSend() throws Exception {
  if (message == null) {
    return 0;
  }
  if (message.getClients() == null || message.getClients().size() == 0) {
    logger.error("String_Node_Str",message);
    message.setStatusId(PayloadStatus.Failed);
    message.setTotalUsers(0);
    PayloadServiceImpl.instance.add(message);
    return 0;
  }
  message.setStatusId(PayloadStatus.Pending);
  message.setTotalUsers(0);
  PayloadServiceImpl.instance.add(message);
  for (  String client : message.getClients()) {
    Client cc=ClientServiceImpl.instance.findByUserId(client);
    if (cc == null) {
      logger.error("String_Node_Str" + client);
      if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.SendAfterOnline_VALUE) {
        message.setStatus(client,new PushStatus(PushStatus.NoClient));
      }
      continue;
    }
    message.setBadge(cc.getBadge() + 1);
    Connection c=ConnectionKeeper.get(product.getAppKey(),client);
    if (c != null) {
      c.send(message);
    }
 else {
      if (!cc.isDevice(ClientType.iOS)) {
        logger.error("String_Node_Str" + client);
        message.setStatus(cc.getUserId(),new PushStatus(PushStatus.NoConnections));
        continue;
      }
      if (StringUtils.isBlank(cc.getDeviceToken()) || "String_Node_Str".equalsIgnoreCase(cc.getDeviceToken())) {
        logger.error("String_Node_Str" + client);
        if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.SendAfterOnline_VALUE) {
          message.setStatus(cc.getUserId(),new PushStatus(PushStatus.NO_DEVICE_TOKEN));
        }
 else {
          message.setStatus(cc.getUserId(),new PushStatus(PushStatus.Ignore));
        }
        continue;
      }
      if (0 == message.getToMode()) {
        if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.APNS_VALUE) {
          APNSKeeper.instance.push(this.product,cc,message);
        }
 else         if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.SendAfterOnline_VALUE) {
          message.setStatus(cc.getUserId(),new PushStatus(PushStatus.WaitOnline));
        }
      }
 else {
        message.setStatus(cc.getUserId(),new PushStatus(PushStatus.Ignore));
      }
    }
  }
  PayloadServiceImpl.instance.updateSendStatus(message);
  return message.getClients().size();
}

Fixed version (ground truth):
private Integer doSend() throws Exception {
  if (message == null) {
    return 0;
  }
  if (message.getClients() == null || message.getClients().size() == 0) {
    logger.error("String_Node_Str",message);
    message.setStatusId(PayloadStatus.Failed);
    message.setTotalUsers(0);
    PayloadServiceImpl.instance.add(message);
    return 0;
  }
  if (message.getStatusId().intValue() == PayloadStatus.Pending0) {
    message.setStatusId(PayloadStatus.Pending);
    message.setTotalUsers(0);
    PayloadServiceImpl.instance.add(message);
  }
  for (  String client : message.getClients()) {
    Client cc=ClientServiceImpl.instance.findByUserId(client);
    if (cc == null) {
      logger.error("String_Node_Str" + client);
      if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.SendAfterOnline_VALUE) {
        message.setStatus(client,new PushStatus(PushStatus.NoClient));
      }
      continue;
    }
    message.setBadge(cc.getBadge() + 1);
    Connection c=ConnectionKeeper.get(product.getAppKey(),client);
    if (c != null) {
      c.send(message);
    }
 else {
      if (!cc.isDevice(ClientType.iOS)) {
        logger.error("String_Node_Str" + client);
        message.setStatus(cc.getUserId(),new PushStatus(PushStatus.NoConnections));
        continue;
      }
      if (StringUtils.isBlank(cc.getDeviceToken()) || "String_Node_Str".equalsIgnoreCase(cc.getDeviceToken())) {
        logger.error("String_Node_Str" + client);
        if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.SendAfterOnline_VALUE) {
          message.setStatus(cc.getUserId(),new PushStatus(PushStatus.NO_DEVICE_TOKEN));
        }
 else {
          message.setStatus(cc.getUserId(),new PushStatus(PushStatus.Ignore));
        }
        continue;
      }
      if (0 == message.getToMode()) {
        if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.APNS_VALUE) {
          APNSKeeper.instance.push(this.product,cc,message);
        }
 else         if (message.getOfflineMode().intValue() == PBAPNSMessage.OfflineModes.SendAfterOnline_VALUE) {
          message.setStatus(cc.getUserId(),new PushStatus(PushStatus.WaitOnline));
        }
      }
 else {
        message.setStatus(cc.getUserId(),new PushStatus(PushStatus.Ignore));
      }
    }
  }
  PayloadServiceImpl.instance.updateSendStatus(message);
  return message.getClients().size();
}