nus-yam/ex-repair huggingface dataset:
Program: 12444
Project: 12444
Buggy source:
public void send(final SentProgress progress,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    logger.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void send(final SentProgress progress,final Payload message,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
          message.addFailedClient(userId);
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    message.addFailedClient(userId);
    logger.error(e.getMessage(),e);
  }
}
Program: 12445
Project: 12445
Buggy source:
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",channel,cf.cause());
    progress.incrFailed();
  }
 else {
    progress.incrSuccess();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",channel,channel.hashCode());
    }
  }
}

Fixed version (ground truth):
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",channel,cf.cause());
    progress.incrFailed();
    message.addFailedClient(userId);
  }
 else {
    progress.incrSuccess();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",channel,channel.hashCode());
    }
  }
}
Program: 12446
Project: 12446
Buggy source:
private void saveBoradcastStatus(Payload message,int 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) {
    e.printStackTrace();
  }
  if (total > 0) {
    MetricBuilder.pushMeter.mark(total);
    MetricBuilder.boradcastMeter.mark(total);
  }
}

Fixed version (ground truth):
private void saveBoradcastStatus(Payload message,int 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) {
    e.printStackTrace();
  }
  if (total > 0) {
    MetricBuilder.pushMeter.mark(total);
    MetricBuilder.boradcastMeter.mark(total);
  }
}
Program: 12448
Project: 12448
Buggy source:
/** 
 * 连接断开，移除连接影射，客户端发起重连
 */
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  ConnectionKeeper.remove(ctx.channel().hashCode());
}

Fixed version (ground truth):
/** 
 * 连接断开，移除连接影射，客户端发起重连
 */
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  Connection connection=ConnectionKeeper.get(ctx.channel().hashCode());
  if (null != connection) {
    Client client=ClientServiceImpl.instance.findByUserId(connection.getUserId());
    if (null != client) {
      ClientServiceImpl.instance.updateStatus(client.getId(),ClientStatus.Offline);
    }
  }
  ConnectionKeeper.remove(ctx.channel().hashCode());
}
Program: 12449
Project: 12449
Buggy source:
@Override public void run(){
  Client c0=ClientServiceImpl.instance.findByUserId(cc.getUserId());
  if (c0 != null) {
    ClientServiceImpl.instance.updateOnlineTs(c0.getId());
  }
}

Fixed version (ground truth):
@Override public void run(){
  Client c0=ClientServiceImpl.instance.findByUserId(cc.getUserId());
  if (c0 != null) {
    ClientServiceImpl.instance.updateStatus(c0.getId(),ClientStatus.Offline);
  }
}
Program: 12451
Project: 12451
Buggy source:
public static void push(SentProgress progress,Product product,Client cc,Payload message){
  String json=message.asJson();
  ApnsService service=get(product);
  if (service != null) {
    try {
      service.push(cc.getDeviceToken(),json);
      progress.incrSuccess();
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      progress.incrFailed();
    }
  }
}

Fixed version (ground truth):
public static void push(SentProgress progress,Product product,Client cc,Payload message){
  String json=message.asJson();
  ApnsService service=get(product);
  if (service != null) {
    try {
      service.push(cc.getDeviceToken(),json);
      progress.incrSuccess();
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      progress.incrFailed();
      message.addFailedClient(cc.getUserId());
    }
  }
}
Program: 12452
Project: 12452
Buggy source:
public void addFailedClient(String userId){
  failedClients.put(userId,1);
}

Fixed version (ground truth):
public void addFailedClient(String userId,PushError error){
  failedClients.put(userId,error);
}
Program: 12453
Project: 12453
Buggy source:
public Set<String> getFailedClients(){
  return failedClients.keySet();
}

Fixed version (ground truth):
public Map<String,PushError> getFailedClients(){
  return failedClients;
}
Program: 12455
Project: 12455
Buggy source:
@Override @TxMain public void updateSendStatus(final Payload message,final int counting){
  jdbcExecutor.submit(new Runnable(){
    @Override public void run(){
      String sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,counting,new Date().getTime() / 1000,message.getId());
      sql="String_Node_Str";
      List<Object[]> args=Lists.newArrayList();
      Set<String> cc=message.getFailedClients();
      for (      String userId : message.getClients()) {
        int statusId=cc.contains(userId) ? 0 : 1;
        args.add(new Object[]{statusId,new Date().getTime() / 1000,message.getId(),userId});
      }
      mainJdbc.batchUpdate(sql,args);
      MetricBuilder.jdbcUpdateMeter.mark(2);
      updatePendingCount(false);
    }
  }
);
  updatePendingCount(true);
}

Fixed version (ground truth):
@Override @TxMain public void updateSendStatus(final Payload message,final int counting){
  jdbcExecutor.submit(new Runnable(){
    @Override public void run(){
      String sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,counting,new Date().getTime() / 1000,message.getId());
      sql="String_Node_Str";
      List<Object[]> args=Lists.newArrayList();
      for (      String userId : message.getClients()) {
        PushError error=message.getFailedClients().get(userId);
        int statusId=error != null ? 0 : 1;
        args.add(new Object[]{statusId,new Date().getTime() / 1000,error != null ? error.getCode() : null,error != null ? error.getMsg() : null,message.getId(),userId});
      }
      mainJdbc.batchUpdate(sql,args);
      MetricBuilder.jdbcUpdateMeter.mark(2);
      updatePendingCount(false);
    }
  }
);
  updatePendingCount(true);
}
Program: 12456
Project: 12456
Buggy source:
public void send(final SentProgress progress,final Payload message,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
          message.addFailedClient(userId);
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    message.addFailedClient(userId);
    logger.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void send(final SentProgress progress,final Payload message,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
          message.addFailedClient(userId,new PushError(PushError.UnKnown,cf.cause().getMessage()));
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    message.addFailedClient(userId,new PushError(PushError.UnKnown,e.getMessage()));
    logger.error(e.getMessage(),e);
  }
}
Program: 12457
Project: 12457
Buggy source:
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",channel,cf.cause());
    progress.incrFailed();
    message.addFailedClient(userId);
  }
 else {
    progress.incrSuccess();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",channel,channel.hashCode());
    }
  }
}

Fixed version (ground truth):
@Override public void operationComplete(Future<? super Void> future) throws Exception {
  if (cf.cause() != null) {
    logger.error("String_Node_Str",channel,cf.cause());
    progress.incrFailed();
    message.addFailedClient(userId,new PushError(PushError.UnKnown,cf.cause().getMessage()));
  }
 else {
    progress.incrSuccess();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",channel,channel.hashCode());
    }
  }
}
Program: 12459
Project: 12459
Buggy source:
public static void push(SentProgress progress,Product product,Client cc,Payload message){
  String json=message.asJson();
  ApnsService service=get(product);
  if (service != null) {
    try {
      service.push(cc.getDeviceToken(),json);
      progress.incrSuccess();
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      progress.incrFailed();
      message.addFailedClient(cc.getUserId());
    }
  }
}

Fixed version (ground truth):
public static void push(SentProgress progress,Product product,Client cc,Payload message){
  String json=message.asJson();
  ApnsService service=get(product);
  if (service != null) {
    try {
      service.push(cc.getDeviceToken(),json);
      progress.incrSuccess();
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      progress.incrFailed();
      message.addFailedClient(cc.getUserId(),new PushError(PushError.iOSPushError,e.getMessage()));
    }
  }
}
Program: 12461
Project: 12461
Buggy source:
public static ApnsService get(Product product){
  if (product.getClientTypeid().intValue() != ClientType.iOS) {
    return null;
  }
  ApnsService service=mapping.get(product.getId());
  if (service == null) {
    boolean sandbox=(Boolean)ServerConfig.getConf().get("String_Node_Str");
    ApnsServiceBuilder builder=APNS.newService();
    if (sandbox) {
      builder.withCert(product.getDevCertPath(),product.getDevCertPass());
      builder.withSandboxDestination();
    }
 else {
      builder.withCert(product.getCertPath(),product.getCertPass());
    }
    service=builder.asPool(10).withDelegate(delegateAdapter).build();
    mapping.put(product.getId(),service);
  }
  return service;
}

Fixed version (ground truth):
public static ApnsService get(Product product){
  if (product.getClientTypeid().intValue() != ClientType.iOS) {
    return null;
  }
  if (StringUtils.isBlank(product.getDevCertPath()) || StringUtils.isBlank(product.getDevCertPass()) || StringUtils.isBlank(product.getCertPath())|| StringUtils.isBlank(product.getCertPass())) {
    logger.error("String_Node_Str",product);
    return null;
  }
  ApnsService service=mapping.get(product.getId());
  if (service == null) {
    boolean sandbox=(Boolean)ServerConfig.getConf().get("String_Node_Str");
    ApnsServiceBuilder builder=APNS.newService();
    if (sandbox) {
      builder.withCert(product.getDevCertPath(),product.getDevCertPass());
      builder.withSandboxDestination();
    }
 else {
      builder.withCert(product.getCertPath(),product.getCertPass());
    }
    service=builder.asPool(10).withDelegate(delegateAdapter).build();
    mapping.put(product.getId(),service);
  }
  return service;
}
Program: 12462
Project: 12462
Buggy source:
public static void push(SentProgress progress,Product product,Client cc,Payload message){
  String json=message.asJson();
  ApnsService service=get(product);
  if (service != null) {
    try {
      service.push(cc.getDeviceToken(),json);
      progress.incrSuccess();
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      progress.incrFailed();
      message.addFailedClient(cc.getUserId(),new PushError(PushError.iOSPushError,e.getMessage()));
    }
  }
}

Fixed version (ground truth):
public static void push(SentProgress progress,Product product,Client cc,Payload message){
  String json=message.asJson();
  ApnsService service=get(product);
  if (service != null) {
    try {
      service.push(cc.getDeviceToken(),json);
      progress.incrSuccess();
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      progress.incrFailed();
      message.addFailedClient(cc.getUserId(),new PushError(PushError.iOSPushError,e.getMessage()));
    }
  }
 else {
    logger.error("String_Node_Str");
    progress.incrFailed();
    message.addFailedClient(cc.getUserId(),new PushError(PushError.iOSPushConfigError,null));
  }
}
Program: 12463
Project: 12463
Buggy source:
@Override public void afterPropertiesSet() throws Exception {
  instance=this;
  int limit=Integer.parseInt(appConfigs.getProperty("String_Node_Str","String_Node_Str"));
  jdbcExecutor=new ThreadPoolTaskExecutor();
  jdbcExecutor.setCorePoolSize(limit / 5);
  jdbcExecutor.setMaxPoolSize(limit);
  jdbcExecutor.setWaitForTasksToCompleteOnShutdown(true);
  jdbcExecutor.afterPropertiesSet();
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      long total=jdbcPending.get();
      logger.info("String_Node_Str" + total);
      try {
        Thread.sleep(10 * 1000);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
);
  thread.start();
}

Fixed version (ground truth):
@Override public void afterPropertiesSet() throws Exception {
  instance=this;
  int limit=Integer.parseInt(appConfigs.getProperty("String_Node_Str","String_Node_Str"));
  jdbcExecutor=new ThreadPoolTaskExecutor();
  jdbcExecutor.setCorePoolSize(limit / 5);
  jdbcExecutor.setMaxPoolSize(limit);
  jdbcExecutor.setWaitForTasksToCompleteOnShutdown(true);
  jdbcExecutor.afterPropertiesSet();
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      while (!stopping) {
        long total=jdbcPending.get();
        logger.info("String_Node_Str" + total);
        try {
          Thread.sleep(10 * 1000);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
  }
);
  thread.start();
}
Program: 12464
Project: 12464
Buggy source:
@Override public void run(){
  long total=jdbcPending.get();
  logger.info("String_Node_Str" + total);
  try {
    Thread.sleep(10 * 1000);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopping) {
    long total=jdbcPending.get();
    logger.info("String_Node_Str" + total);
    try {
      Thread.sleep(10 * 1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 12465
Project: 12465
Buggy source:
@Override @TxMain public void updateSendStatus(final Payload message,final int counting){
  jdbcExecutor.submit(new Runnable(){
    @Override public void run(){
      String sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,counting,new Date().getTime() / 1000,message.getId());
      sql="String_Node_Str";
      List<Object[]> args=Lists.newArrayList();
      for (      String userId : message.getClients()) {
        PushError error=message.getFailedClients().get(userId);
        int statusId=error != null ? 0 : 1;
        args.add(new Object[]{statusId,new Date().getTime() / 1000,error != null ? error.getCode() : null,error != null ? error.getMsg() : null,message.getId(),userId});
      }
      mainJdbc.batchUpdate(sql,args);
      MetricBuilder.jdbcUpdateMeter.mark(2);
      updatePendingCount(false);
    }
  }
);
  updatePendingCount(true);
}

Fixed version (ground truth):
@Override @TxMain public void updateSendStatus(final Payload message,final int counting){
  jdbcExecutor.submit(new Runnable(){
    @Override public void run(){
      String sql="String_Node_Str";
      mainJdbc.update(sql,counting > 0 ? PayloadStatus.Sent : PayloadStatus.Pending,counting,new Date().getTime() / 1000,message.getId());
      sql="String_Node_Str";
      List<Object[]> args=Lists.newArrayList();
      for (      String userId : message.getClients()) {
        PushError error=message.getFailedClients().get(userId);
        int statusId=error != null ? 0 : 1;
        args.add(new Object[]{statusId,new Date().getTime() / 1000,error != null ? error.getCode() : null,error != null ? error.getMsg() : null,message.getId(),userId});
      }
      mainJdbc.batchUpdate(sql,args);
      MetricBuilder.jdbcUpdateMeter.mark(2);
      updatePendingCount(false);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str");
      }
    }
  }
);
  updatePendingCount(true);
}
Program: 12467
Project: 12467
Buggy source:
/** 
 * 更新最后发送时间
 */
public void updateOpTime(){
  lastOpTime=(int)(new Date().getTime() - epoch);
}

Fixed version (ground truth):
/** 
 * 更新最后发送时间
 */
public void updateOpTime(){
  lastOpTime=(int)(new Date().getTime() / 1000 - epoch);
}
Program: 12469
Project: 12469
Buggy source:
public void send(final SentProgress progress,final byte[] msg){
  final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
  data.writeBytes(msg);
  final ChannelFuture cf=channel.writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super java.lang.Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",channel,cf.cause());
        progress.incrFailed();
      }
 else {
        progress.incrSuccess();
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str",channel,channel.hashCode());
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public void send(final SentProgress progress,final byte[] msg){
  try {
    final ByteBuf data=channel.config().getAllocator().buffer(msg.length);
    data.writeBytes(msg);
    final ChannelFuture cf=channel.writeAndFlush(data);
    cf.addListener(new GenericFutureListener<Future<? super Void>>(){
      @Override public void operationComplete(      Future<? super Void> future) throws Exception {
        if (cf.cause() != null) {
          logger.error("String_Node_Str",channel,cf.cause());
          progress.incrFailed();
        }
 else {
          progress.incrSuccess();
          if (logger.isDebugEnabled()) {
            logger.debug("String_Node_Str",channel,channel.hashCode());
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    progress.incrFailed();
    logger.error(e.getMessage(),e);
  }
}
Program: 12470
Project: 12470
Buggy source:
public Payload(PayloadMessage message){
  this.title=message.title;
  this.badge=message.badge;
  this.sound=message.sound;
  this.clients=message.clients;
  this.extras=MessageUtils.toJson(message.ext);
  this.broadcast=message.broadcast ? 1 : 0;
}

Fixed version (ground truth):
public Payload(PayloadMessage message){
  this.title=message.title;
  this.badge=message.badge;
  this.sound=message.sound;
  this.clients=message.clients;
  this.extras=MessageUtils.toJson(message.ext);
  this.broadcast=message.broadcast == null || !message.broadcast ? 0 : 1;
}
Program: 12471
Project: 12471
Buggy source:
private void ack(final ChannelHandlerContext ctx,PBAPNSEvent cc){
  PBAPNSMessage.Builder builder=PBAPNSMessage.newBuilder();
  builder.setAps(PBAPNSBody.newBuilder().setAlert("String_Node_Str").setBadge(0));
  if (cc != null) {
    builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(cc.getOp() + "String_Node_Str"));
  }
 else {
    builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
  }
  byte[] bytes=builder.build().toByteArray();
  final ByteBuf data=ctx.alloc().buffer(bytes.length);
  data.writeBytes(bytes);
  final ChannelFuture cf=ctx.channel().writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",cf.cause());
        ctx.close();
      }
    }
  }
);
}

Fixed version (ground truth):
private void ack(final ChannelHandlerContext ctx,PBAPNSEvent cc){
  PBAPNSMessage.Builder builder=PBAPNSMessage.newBuilder();
  builder.setAps(PBAPNSBody.newBuilder().setAlert("String_Node_Str").setBadge(0));
  if (cc != null) {
    builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(cc.getOp() + "String_Node_Str").setKey("String_Node_Str").setValue("String_Node_Str"));
  }
 else {
    builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str").setKey("String_Node_Str").setValue("String_Node_Str"));
  }
  byte[] bytes=builder.build().toByteArray();
  final ByteBuf data=ctx.alloc().buffer(bytes.length);
  data.writeBytes(bytes);
  final ChannelFuture cf=ctx.channel().writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",cf.cause());
        ctx.close();
      }
    }
  }
);
}
Program: 12473
Project: 12473
Buggy source:
public void start(){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      connect();
    }
  }
);
  thread.start();
  try {
    countDownLatch.await();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
public void start(){
  connect();
}
Program: 12474
Project: 12474
Buggy source:
private void connect(){
  port=Integer.parseInt(props.getProperty("String_Node_Str","String_Node_Str"));
  host=props.getProperty("String_Node_Str","String_Node_Str");
  logger.info("String_Node_Str" + host + "String_Node_Str"+ port);
  workerGroup=new NioEventLoopGroup();
  try {
    b.group(workerGroup);
    b.channel(NioSocketChannel.class);
    b.option(ChannelOption.SO_KEEPALIVE,true);
    b.option(ChannelOption.TCP_NODELAY,true);
    b.handler(new ChannelInitializer<SocketChannel>(){
      @Override public void initChannel(      SocketChannel ch) throws Exception {
        ChannelPipeline pipeline=ch.pipeline();
        pipeline.addLast("String_Node_Str",new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE,0,4,0,4));
        pipeline.addLast("String_Node_Str",new ByteArrayDecoder());
        pipeline.addLast("String_Node_Str",new LengthFieldPrepender(4,false));
        pipeline.addLast("String_Node_Str",new ByteArrayEncoder());
        pipeline.addLast("String_Node_Str",new ClientConnectHandler());
      }
    }
);
    for (int i=0; i < workerGroup.executorCount(); i++) {
      ChannelFuture f=newChannel();
      if (f != null) {
        try {
          f.get();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
catch (        ExecutionException e) {
          e.printStackTrace();
        }
      }
    }
    countDownLatch.countDown();
    System.out.println("String_Node_Str");
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    workerGroup.shutdownGracefully();
  }
}

Fixed version (ground truth):
private void connect(){
  port=Integer.parseInt(props.getProperty("String_Node_Str","String_Node_Str"));
  host=props.getProperty("String_Node_Str","String_Node_Str");
  logger.info("String_Node_Str" + host + "String_Node_Str"+ port);
  workerGroup=new NioEventLoopGroup();
  try {
    b.group(workerGroup);
    b.channel(NioSocketChannel.class);
    b.option(ChannelOption.SO_KEEPALIVE,true);
    b.option(ChannelOption.TCP_NODELAY,true);
    b.handler(new ChannelInitializer<SocketChannel>(){
      @Override public void initChannel(      SocketChannel ch) throws Exception {
        ChannelPipeline pipeline=ch.pipeline();
        pipeline.addLast("String_Node_Str",new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE,0,4,0,4));
        pipeline.addLast("String_Node_Str",new ByteArrayDecoder());
        pipeline.addLast("String_Node_Str",new LengthFieldPrepender(4,false));
        pipeline.addLast("String_Node_Str",new ByteArrayEncoder());
        pipeline.addLast("String_Node_Str",new ClientConnectHandler());
      }
    }
);
    for (int i=0; i < workerGroup.executorCount(); i++) {
      ChannelFuture f=newChannel();
      if (f != null) {
        try {
          f.get();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
catch (        ExecutionException e) {
          e.printStackTrace();
        }
      }
    }
    countDownLatch.countDown();
    logger.info("String_Node_Str",host,port);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    workerGroup.shutdownGracefully();
  }
}
Program: 12475
Project: 12475
Buggy source:
@Override public Integer call() throws Exception {
  Payload message=PayloadService.instance.findLatest(product.getId(),userId);
  if (message == null) {
    return 0;
  }
  if (message.getClients() != null) {
    SentProgress progress=new SentProgress(message.getClients().size());
    for (    String client : message.getClients()) {
      Connection c=ConnectionKeeper.get(product.getAppKey(),client);
      if (c != null) {
        c.send(progress,message);
      }
 else {
        progress.incrFailed();
      }
    }
    try {
      progress.getCountDownLatch().await();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    int total=progress.getSuccess().get();
    try {
      PayloadService.instance.updateSendStatus(message,total);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    return total;
  }
  return 0;
}

Fixed version (ground truth):
@Override public Integer call() throws Exception {
  Payload message=PayloadService.instance.findLatest(product.getId(),userId);
  if (message == null) {
    return 0;
  }
  if (message.getClients() != null) {
    SentProgress progress=new SentProgress(message.getClients().size());
    for (    String client : message.getClients()) {
      Connection c=ConnectionKeeper.get(product.getAppKey(),client);
      if (c != null) {
        c.send(progress,message);
      }
 else {
        progress.incrFailed();
      }
    }
    try {
      progress.getCountDownLatch().await();
    }
 catch (    InterruptedException e) {
      logger.error(e.getMessage(),e);
    }
    int total=progress.getSuccess().get();
    try {
      PayloadService.instance.updateSendStatus(message,total);
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
    return total;
  }
  return 0;
}
Program: 12477
Project: 12477
Buggy source:
@Override public Boolean call() throws Exception {
  Client client=ClientService.instance.findByUserId(cc.getUserId());
  boolean isnew=false;
  if (client == null) {
    client=new Client();
    Product product=ProductService.instance.findByKey(cc.getAppKey());
    client.setProductId(product.getId());
    client.setUserId(cc.getUserId());
    client.setTypeId(cc.getTypeId());
    client.setDeviceToken(cc.getToken());
    try {
      ClientService.instance.add(client);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    isnew=true;
  }
  if (!isnew) {
    Dispatcher dispatcher=DispatcherRunner.instance.get(cc.getAppKey());
    if (dispatcher != null) {
      dispatcher.pushOfflinePayload(cc.getUserId());
    }
    try {
      ClientService.instance.updateOnlineTs(client.getId());
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public Boolean call() throws Exception {
  Client client=ClientService.instance.findByUserId(cc.getUserId());
  boolean isnew=false;
  if (client == null) {
    client=new Client();
    Product product=ProductService.instance.findByKey(cc.getAppKey());
    client.setProductId(product.getId());
    client.setUserId(cc.getUserId());
    client.setTypeId(cc.getTypeId());
    client.setDeviceToken(cc.getToken());
    try {
      ClientService.instance.add(client);
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
    isnew=true;
  }
  if (!isnew) {
    Dispatcher dispatcher=DispatcherRunner.instance.get(cc.getAppKey());
    if (dispatcher != null) {
      dispatcher.pushOfflinePayload(cc.getUserId());
    }
    try {
      ClientService.instance.updateOnlineTs(client.getId());
    }
 catch (    Exception e) {
      logger.error(e.getMessage(),e);
    }
  }
  return true;
}
Program: 12478
Project: 12478
Buggy source:
/** 
 * 读取新消息 LengthFieldBasedFrameDecoder 自动解包
 */
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  MetricBuilder.requestMeter.mark();
  final PBAPNSEvent cc;
  try {
    byte[] bytes=(byte[])msg;
    logger.info("String_Node_Str",bytes.length);
    cc=PBAPNSEvent.newBuilder().mergeFrom(bytes).build();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    ack(ctx,null);
    return;
  }
  ReferenceCountUtil.release(msg);
  if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.Android_VALUE) {
    MetricBuilder.clientAndroidMeter.mark();
  }
 else   if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.iOS_VALUE) {
    MetricBuilder.clientIOSMeter.mark();
  }
  if (cc.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
    ConnectionKeeper.add(cc.getAppKey(),cc.getUserId(),new Connection(ctx.channel()));
    poolTaskExecutor.submit(new OnNewlyAddThread(cc));
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.KeepAlive_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.PushAck_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.Offline_VALUE) {
    poolTaskExecutor.submit(new Runnable(){
      @Override public void run(){
        Client c0=ClientService.instance.findByUserId(cc.getUserId());
        if (c0 != null) {
          ClientService.instance.updateOnlineTs(c0.getId());
        }
      }
    }
);
    ctx.close();
  }
}

Fixed version (ground truth):
/** 
 * 读取新消息 LengthFieldBasedFrameDecoder 自动解包
 */
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  MetricBuilder.requestMeter.mark();
  final PBAPNSEvent cc;
  try {
    byte[] bytes=(byte[])msg;
    logger.info("String_Node_Str",bytes.length);
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",bytes);
    }
    cc=PBAPNSEvent.newBuilder().mergeFrom(bytes).build();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    ack(ctx,null);
    return;
  }
  ReferenceCountUtil.release(msg);
  if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.Android_VALUE) {
    MetricBuilder.clientAndroidMeter.mark();
  }
 else   if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.iOS_VALUE) {
    MetricBuilder.clientIOSMeter.mark();
  }
  if (cc.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
    ConnectionKeeper.add(cc.getAppKey(),cc.getUserId(),new Connection(ctx.channel()));
    poolTaskExecutor.submit(new OnNewlyAddThread(cc));
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.KeepAlive_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.PushAck_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.Offline_VALUE) {
    poolTaskExecutor.submit(new Runnable(){
      @Override public void run(){
        Client c0=ClientService.instance.findByUserId(cc.getUserId());
        if (c0 != null) {
          ClientService.instance.updateOnlineTs(c0.getId());
        }
      }
    }
);
    ctx.close();
  }
}
Program: 12479
Project: 12479
Buggy source:
private void ack(final ChannelHandlerContext ctx,PBAPNSEvent cc){
  PBAPNSMessage.Builder builder=PBAPNSMessage.newBuilder();
  builder.setAps(PBAPNSBody.newBuilder().setAlert("String_Node_Str").setBadge(0));
  builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(cc.getOp() + "String_Node_Str"));
  byte[] bytes=builder.build().toByteArray();
  final ByteBuf data=ctx.alloc().buffer(bytes.length);
  data.writeBytes(bytes);
  final ChannelFuture cf=ctx.channel().writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",cf.cause());
        ctx.close();
      }
    }
  }
);
}

Fixed version (ground truth):
private void ack(final ChannelHandlerContext ctx,PBAPNSEvent cc){
  PBAPNSMessage.Builder builder=PBAPNSMessage.newBuilder();
  builder.setAps(PBAPNSBody.newBuilder().setAlert("String_Node_Str").setBadge(0));
  if (cc != null) {
    builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue(cc.getOp() + "String_Node_Str"));
  }
 else {
    builder.addUserInfo(PBAPNSUserInfo.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
  }
  byte[] bytes=builder.build().toByteArray();
  final ByteBuf data=ctx.alloc().buffer(bytes.length);
  data.writeBytes(bytes);
  final ChannelFuture cf=ctx.channel().writeAndFlush(data);
  cf.addListener(new GenericFutureListener<Future<? super Void>>(){
    @Override public void operationComplete(    Future<? super Void> future) throws Exception {
      if (cf.cause() != null) {
        logger.error("String_Node_Str",cf.cause());
        ctx.close();
      }
    }
  }
);
}
Program: 12480
Project: 12480
Buggy source:
/** 
 * 读取新消息 LengthFieldBasedFrameDecoder 自动解包
 */
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  MetricBuilder.requestMeter.mark();
  final PBAPNSEvent cc;
  try {
    cc=PBAPNSEvent.newBuilder().mergeFrom((byte[])msg).build();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    ack(ctx,null);
    return;
  }
  ReferenceCountUtil.release(msg);
  if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.Android_VALUE) {
    MetricBuilder.clientAndroidMeter.mark();
  }
 else   if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.iOS_VALUE) {
    MetricBuilder.clientIOSMeter.mark();
  }
  if (cc.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
    ConnectionKeeper.add(cc.getAppKey(),cc.getUserId(),new Connection(ctx.channel()));
    poolTaskExecutor.submit(new OnNewlyAddThread(cc));
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.KeepAlive_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.PushAck_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.Offline_VALUE) {
    poolTaskExecutor.submit(new Runnable(){
      @Override public void run(){
        Client c0=ClientService.instance.findByUserId(cc.getUserId());
        if (c0 != null) {
          ClientService.instance.updateOnlineTs(c0.getId());
        }
      }
    }
);
    ctx.close();
  }
}

Fixed version (ground truth):
/** 
 * 读取新消息 LengthFieldBasedFrameDecoder 自动解包
 */
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  MetricBuilder.requestMeter.mark();
  final PBAPNSEvent cc;
  try {
    byte[] bytes=(byte[])msg;
    logger.info("String_Node_Str",bytes.length);
    cc=PBAPNSEvent.newBuilder().mergeFrom(bytes).build();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    ack(ctx,null);
    return;
  }
  ReferenceCountUtil.release(msg);
  if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.Android_VALUE) {
    MetricBuilder.clientAndroidMeter.mark();
  }
 else   if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.iOS_VALUE) {
    MetricBuilder.clientIOSMeter.mark();
  }
  if (cc.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
    ConnectionKeeper.add(cc.getAppKey(),cc.getUserId(),new Connection(ctx.channel()));
    poolTaskExecutor.submit(new OnNewlyAddThread(cc));
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.KeepAlive_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.PushAck_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.Offline_VALUE) {
    poolTaskExecutor.submit(new Runnable(){
      @Override public void run(){
        Client c0=ClientService.instance.findByUserId(cc.getUserId());
        if (c0 != null) {
          ClientService.instance.updateOnlineTs(c0.getId());
        }
      }
    }
);
    ctx.close();
  }
}
Program: 12481
Project: 12481
Buggy source:
@Override public void add(Payload payload){
  BinaryShardedJedis jedis=redisBucket.getResource();
  try {
    long id=jedis.incr(QPUSH_PK);
    payload.setId(id);
    payload.setStatusId(PayloadStatus.Pending0);
    payload.setCreateAt(new Date().getTime() / 1000);
    String key=String.format("String_Node_Str",payload.getProductId(),payload.getBroadcast());
    jedis.rpush(key.getBytes(),MessageUtils.asBytes(payload));
    long total=jedis.incr(QPUSH_PENDING);
    redisBucket.returnResource(jedis);
    logger.info("String_Node_Str" + total);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    redisBucket.returnBrokenResource(jedis);
  }
}

Fixed version (ground truth):
@Override public void add(Payload payload){
  BinaryShardedJedis jedis=redisBucket.getResource();
  try {
    long id=jedis.incr(QPUSH_PK);
    payload.setId(id);
    payload.setStatusId(PayloadStatus.Pending0);
    payload.setCreateAt(new Date().getTime() / 1000);
    String key=String.format("String_Node_Str",payload.getProductId(),payload.getBroadcast());
    long ret=jedis.rpush(key.getBytes(),MessageUtils.asBytes(payload));
    long total=jedis.incr(QPUSH_PENDING);
    redisBucket.returnResource(jedis);
    logger.info("String_Node_Str",total,ret);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    redisBucket.returnBrokenResource(jedis);
  }
}
Program: 12482
Project: 12482
Buggy source:
public void add(final Client client){
  if (client == null) {
    return;
  }
  final String sql="String_Node_Str";
  KeyHolder holder=new GeneratedKeyHolder();
  this.mainJdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
      ps.setObject(0,client.getProductId());
      ps.setObject(1,client.getUserId());
      ps.setObject(2,client.getDeviceToken());
      ps.setObject(3,new Date());
      ps.setObject(4,ClientStatus.NewlyAdd);
      ps.setObject(5,client.getTypeId());
      return ps;
    }
  }
,holder);
  client.setId(holder.getKey().longValue());
}

Fixed version (ground truth):
public void add(final Client client){
  if (client == null) {
    return;
  }
  final String sql="String_Node_Str";
  KeyHolder holder=new GeneratedKeyHolder();
  this.mainJdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
      ps.setObject(1,client.getProductId());
      ps.setObject(2,client.getUserId());
      ps.setObject(3,client.getDeviceToken());
      ps.setObject(4,new Date());
      ps.setObject(5,ClientStatus.NewlyAdd);
      ps.setObject(6,client.getTypeId());
      return ps;
    }
  }
,holder);
  client.setId(holder.getKey().longValue());
}
Program: 12483
Project: 12483
Buggy source:
@Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
  PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
  ps.setObject(0,client.getProductId());
  ps.setObject(1,client.getUserId());
  ps.setObject(2,client.getDeviceToken());
  ps.setObject(3,new Date());
  ps.setObject(4,ClientStatus.NewlyAdd);
  ps.setObject(5,client.getTypeId());
  return ps;
}

Fixed version (ground truth):
@Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
  PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
  ps.setObject(1,client.getProductId());
  ps.setObject(2,client.getUserId());
  ps.setObject(3,client.getDeviceToken());
  ps.setObject(4,new Date());
  ps.setObject(5,ClientStatus.NewlyAdd);
  ps.setObject(6,client.getTypeId());
  return ps;
}
Program: 12484
Project: 12484
Buggy source:
public void add(final Payload payload){
  if (payload == null) {
    return;
  }
  final String sql="String_Node_Str";
  if (payload.getClients() != null) {
    payload.setTotalUsers(payload.getClients().size());
  }
 else {
    payload.setTotalUsers(-1);
  }
  KeyHolder holder=new GeneratedKeyHolder();
  this.mainJdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
      ps.setObject(0,payload.getTitle());
      ps.setObject(1,payload.getBadge());
      ps.setObject(2,payload.getExtras());
      ps.setObject(3,payload.getSound());
      ps.setObject(4,payload.getProductId());
      ps.setObject(5,payload.getTotalUsers());
      ps.setObject(6,new Date().getTime() / 1000);
      ps.setObject(7,PayloadStatus.Pending);
      ps.setObject(8,payload.getBroadcast());
      return ps;
    }
  }
,holder);
  payload.setId(holder.getKey().longValue());
  if (payload.getClients() != null) {
    List<Object[]> args=Lists.newArrayList();
    final String sql0="String_Node_Str";
    for (    String userId : payload.getClients()) {
      args.add(new Object[]{payload.getId(),userId,payload.getProductId()});
    }
    this.mainJdbc.batchUpdate(sql0,args);
  }
}

Fixed version (ground truth):
public void add(final Payload payload){
  if (payload == null) {
    return;
  }
  final String sql="String_Node_Str";
  if (payload.getClients() != null) {
    payload.setTotalUsers(payload.getClients().size());
  }
 else {
    payload.setTotalUsers(-1);
  }
  KeyHolder holder=new GeneratedKeyHolder();
  this.mainJdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
      ps.setObject(1,payload.getTitle());
      ps.setObject(2,payload.getBadge());
      ps.setObject(3,payload.getExtras());
      ps.setObject(4,payload.getSound());
      ps.setObject(5,payload.getProductId());
      ps.setObject(6,payload.getTotalUsers());
      ps.setObject(7,new Date().getTime() / 1000);
      ps.setObject(8,PayloadStatus.Pending);
      ps.setObject(9,payload.getBroadcast());
      return ps;
    }
  }
,holder);
  payload.setId(holder.getKey().longValue());
  if (payload.getClients() != null) {
    List<Object[]> args=Lists.newArrayList();
    final String sql0="String_Node_Str";
    for (    String userId : payload.getClients()) {
      args.add(new Object[]{payload.getId(),userId,payload.getProductId()});
    }
    this.mainJdbc.batchUpdate(sql0,args);
  }
}
Program: 12485
Project: 12485
Buggy source:
@Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
  PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
  ps.setObject(0,payload.getTitle());
  ps.setObject(1,payload.getBadge());
  ps.setObject(2,payload.getExtras());
  ps.setObject(3,payload.getSound());
  ps.setObject(4,payload.getProductId());
  ps.setObject(5,payload.getTotalUsers());
  ps.setObject(6,new Date().getTime() / 1000);
  ps.setObject(7,PayloadStatus.Pending);
  ps.setObject(8,payload.getBroadcast());
  return ps;
}

Fixed version (ground truth):
@Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
  PreparedStatement ps=connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
  ps.setObject(1,payload.getTitle());
  ps.setObject(2,payload.getBadge());
  ps.setObject(3,payload.getExtras());
  ps.setObject(4,payload.getSound());
  ps.setObject(5,payload.getProductId());
  ps.setObject(6,payload.getTotalUsers());
  ps.setObject(7,new Date().getTime() / 1000);
  ps.setObject(8,PayloadStatus.Pending);
  ps.setObject(9,payload.getBroadcast());
  return ps;
}