Program: 70216
Project: 70216
Buggy source:
public NIONode startWorker() throws Exception {
  String name=nw.getName();
  String user=nw.getUser();
  int minPort=nw.getConfiguration().getMinPort();
  int maxPort=nw.getConfiguration().getMaxPort();
  int port=minPort;
  NIONode n=null;
  int pid=-1;
  while (port <= maxPort) {
    String[] command;
    if (pid != -1) {
      command=getStopCommand(pid);
      ProcessOut po=executeCommand(user,name,command);
      if (po.getExitValue() != 0) {
        logger.error(ERROR_SHUTTING_DOWN_RETRY);
      }
    }
    command=getStartCommand(nw,port);
    ProcessOut po=executeCommand(user,name,command);
    if (po.getExitValue() == 0) {
      String output=po.getOutput();
      String[] lines=output.split("String_Node_Str");
      pid=Integer.parseInt(lines[lines.length - 1]);
      long delay=300;
      long totalWait=0;
      n=new NIONode(name,port);
      String nodeName=nw.getName();
      addresstoWorkerStarter.put(nodeName,this);
      logger.debug("String_Node_Str");
      CommandCheckWorker cmd=new CommandCheckWorker(DEPLOYMENT_ID,nodeName);
      while ((!workerIsReady) && (totalWait < MAX_WAIT_FOR_INIT)) {
        Thread.sleep(delay);
        if (!workerIsReady) {
          if (debug) {
            logger.debug("String_Node_Str" + nodeName);
          }
          Connection c=NIOAdaptor.tm.startConnection(n);
          c.sendCommand(cmd);
          c.receive();
          c.finishConnection();
          totalWait+=delay;
          delay=(delay < 1900) ? delay * 2 : 2000;
        }
      }
    }
 else {
      throw new Exception("String_Node_Str" + name + "String_Node_Str"+ user+ "String_Node_Str"+ "String_Node_Str"+ po.getOutput()+ "String_Node_Str"+ "String_Node_Str"+ po.getError()+ "String_Node_Str");
    }
    if (!workerIsReady) {
      ++port;
    }
 else {
      try {
        Runtime.getRuntime().addShutdownHook(new Ender(this,nw,pid));
      }
 catch (      IllegalStateException e) {
        logger.warn("String_Node_Str",e);
      }
      return n;
    }
  }
  if (!workerIsReady) {
    logger.debug("String_Node_Str" + name + "String_Node_Str"+ user+ "String_Node_Str");
    throw new Exception("String_Node_Str" + name + "String_Node_Str"+ user+ "String_Node_Str");
  }
 else {
    return n;
  }
}

Fixed version (ground truth):
public NIONode startWorker() throws Exception {
  String name=nw.getName();
  String user=nw.getUser();
  int minPort=nw.getConfiguration().getMinPort();
  int maxPort=nw.getConfiguration().getMaxPort();
  int port=minPort;
  NIONode n=null;
  int pid=-1;
  while (port <= maxPort && !toStop) {
    String[] command;
    if (pid != -1) {
      command=getStopCommand(pid);
      ProcessOut po=executeCommand(user,name,command);
      if (po.getExitValue() != 0) {
        logger.error(ERROR_SHUTTING_DOWN_RETRY);
      }
    }
    command=getStartCommand(nw,port);
    ProcessOut po=executeCommand(user,name,command);
    if (po.getExitValue() == 0) {
      String output=po.getOutput();
      String[] lines=output.split("String_Node_Str");
      pid=Integer.parseInt(lines[lines.length - 1]);
      long delay=300;
      long totalWait=0;
      n=new NIONode(name,port);
      String nodeName=nw.getName();
      addresstoWorkerStarter.put(nodeName,this);
      logger.debug("String_Node_Str");
      CommandCheckWorker cmd=new CommandCheckWorker(DEPLOYMENT_ID,nodeName);
      while ((!workerIsReady) && (totalWait < MAX_WAIT_FOR_INIT) && !toStop) {
        Thread.sleep(delay);
        if (!workerIsReady) {
          if (debug) {
            logger.debug("String_Node_Str" + nodeName);
          }
          Connection c=NIOAdaptor.tm.startConnection(n);
          c.sendCommand(cmd);
          c.receive();
          c.finishConnection();
          totalWait+=delay;
          delay=(delay < 1900) ? delay * 2 : 2000;
        }
      }
    }
 else {
      throw new Exception("String_Node_Str" + name + "String_Node_Str"+ user+ "String_Node_Str"+ "String_Node_Str"+ po.getOutput()+ "String_Node_Str"+ "String_Node_Str"+ po.getError()+ "String_Node_Str");
    }
    if (!workerIsReady) {
      ++port;
    }
 else {
      try {
        Runtime.getRuntime().addShutdownHook(new Ender(this,nw,pid));
      }
 catch (      IllegalStateException e) {
        logger.warn("String_Node_Str",e);
      }
      nw.setStarted(true);
      return n;
    }
  }
  if (toStop) {
    logger.debug("String_Node_Str" + name + "String_Node_Str");
    return null;
  }
 else   if (!workerIsReady) {
    logger.debug("String_Node_Str" + name + "String_Node_Str"+ user+ "String_Node_Str");
    throw new Exception("String_Node_Str" + name + "String_Node_Str"+ user+ "String_Node_Str");
  }
 else {
    return n;
  }
}