Program: 49140
Project: 49140
Buggy source:
@Override public Map<String,Object> work(boolean mqEnabled,TaskEntity taskEntity,boolean successed,String errorMessage,Logger logger) throws IOException {
  Map<String,Object> result=new HashMap<String,Object>();
  String[] cmdArray;
  if (logger.isInfoEnabled()) {
    cmdArray=new String[taskEntity.getCmdArray().length + 1];
    int i;
    for (i=0; i < taskEntity.getCmdArray().length; ++i) {
      cmdArray[i]=taskEntity.getCmdArray()[i];
    }
    cmdArray[i]=logger.isDebugEnabled() ? "String_Node_Str" : "String_Node_Str";
  }
 else {
    cmdArray=taskEntity.getCmdArray();
  }
  Process proc=Runtime.getRuntime().exec(cmdArray,null,taskEntity.getWorkDir());
  Thread stdoutReaperThread=new Thread(new StreamReaper(proc.getInputStream(),new File(taskEntity.getWorkDir(),TaskManager.STDOUT_FILENAME)));
  Thread stderrReaperThread=new Thread(new StreamReaper(proc.getErrorStream(),new File(taskEntity.getWorkDir(),TaskManager.STDERR_FILENAME)));
  MessageProcessor messageProcessor=null;
  Thread messageProcessorThread=null;
  if (mqEnabled) {
    String routeKey=taskEntity.getMessageRouteKey();
    messageProcessor=new MessageProcessor(taskEntity.getId(),ConfigInfo.getMqServerHost(),ConfigInfo.getMqServerPort(),ConfigInfo.getMqServerUsername(),ConfigInfo.getMqServerPassword(),ConfigInfo.getMqExchangeName(),routeKey,routeKey,false);
    messageProcessorThread=new Thread(messageProcessor);
    messageProcessorThread.setDaemon(true);
    messageProcessorThread.start();
  }
  stdoutReaperThread.setDaemon(true);
  stderrReaperThread.setDaemon(true);
  stdoutReaperThread.start();
  stderrReaperThread.start();
  boolean exitSuccess=true;
  while (true) {
    try {
      int exitValue=proc.waitFor();
      if (exitValue == 0) {
        successed=true;
        logger.info("String_Node_Str" + taskEntity.getId() + "String_Node_Str");
      }
 else {
        logger.error("String_Node_Str" + taskEntity.getId() + "String_Node_Str"+ exitValue);
      }
      break;
    }
 catch (    InterruptedException e) {
      logger.warn("String_Node_Str",e);
      exitSuccess=kill(proc,logger);
      if (mqEnabled) {
        logger.warn("String_Node_Str",e);
        messageProcessor.forceStopNow();
      }
      break;
    }
  }
  try {
    logger.info("String_Node_Str" + taskEntity.getId());
    if (mqEnabled) {
      messageProcessor.forceStop();
      try {
        messageProcessorThread.join();
      }
 catch (      InterruptedException e) {
        logger.warn("String_Node_Str",e);
        if (mqEnabled) {
          messageProcessor.forceStopNow();
          messageProcessorThread.join();
        }
      }
    }
    if (exitSuccess) {
      stdoutReaperThread.join();
      stderrReaperThread.join();
    }
 else {
      logger.error("String_Node_Str" + taskEntity.getCmdArray());
    }
    logger.info("String_Node_Str" + taskEntity.getId());
  }
 catch (  InterruptedException e) {
    logger.error("String_Node_Str",e);
  }
  if (mqEnabled) {
    successed=messageProcessor.isSuccess();
    if (!successed) {
      errorMessage=messageProcessor.getErrorMessage();
    }
  }
  result.put("String_Node_Str",successed);
  result.put("String_Node_Str",errorMessage);
  return result;
}

Fixed version (ground truth):
@Override public Map<String,Object> work(boolean mqEnabled,TaskEntity taskEntity,boolean successed,String errorMessage,Logger logger) throws IOException {
  Map<String,Object> result=new HashMap<String,Object>();
  String[] cmdArray;
  if (logger.isInfoEnabled()) {
    cmdArray=new String[taskEntity.getCmdArray().length + 1];
    int i;
    for (i=0; i < taskEntity.getCmdArray().length; ++i) {
      cmdArray[i]=taskEntity.getCmdArray()[i];
    }
    cmdArray[i]=logger.isDebugEnabled() ? "String_Node_Str" : "String_Node_Str";
  }
 else {
    cmdArray=taskEntity.getCmdArray();
  }
  Process proc=Runtime.getRuntime().exec(cmdArray,null,taskEntity.getWorkDir());
  Thread stdoutReaperThread=new Thread(new StreamReaper(proc.getInputStream(),new File(taskEntity.getWorkDir(),TaskManager.STDOUT_FILENAME)));
  Thread stderrReaperThread=new Thread(new StreamReaper(proc.getErrorStream(),new File(taskEntity.getWorkDir(),TaskManager.STDERR_FILENAME)));
  MessageProcessor messageProcessor=null;
  Thread messageProcessorThread=null;
  if (mqEnabled) {
    String routeKey=taskEntity.getMessageRouteKey();
    messageProcessor=new MessageProcessor(taskEntity.getId(),ConfigInfo.getMqServerHost(),ConfigInfo.getMqServerPort(),ConfigInfo.getMqServerUsername(),ConfigInfo.getMqServerPassword(),ConfigInfo.getMqExchangeName(),routeKey,routeKey,false);
    messageProcessorThread=new Thread(messageProcessor);
    messageProcessorThread.setDaemon(true);
    messageProcessorThread.start();
  }
  stdoutReaperThread.setDaemon(true);
  stderrReaperThread.setDaemon(true);
  stdoutReaperThread.start();
  stderrReaperThread.start();
  boolean exitSuccess=true;
  while (true) {
    try {
      int exitValue=proc.waitFor();
      if (exitValue == 0) {
        successed=true;
        logger.info("String_Node_Str" + taskEntity.getId() + "String_Node_Str");
      }
 else {
        logger.error("String_Node_Str" + taskEntity.getId() + "String_Node_Str"+ exitValue);
      }
      break;
    }
 catch (    InterruptedException e) {
      logger.warn("String_Node_Str",e);
      exitSuccess=kill(proc,logger);
      if (mqEnabled) {
        logger.warn("String_Node_Str",e);
        messageProcessor.forceStopNow();
      }
      break;
    }
  }
  try {
    logger.info("String_Node_Str" + taskEntity.getId());
    if (mqEnabled) {
      messageProcessor.forceStop();
      try {
        messageProcessorThread.join();
      }
 catch (      InterruptedException e) {
        logger.warn("String_Node_Str",e);
        if (mqEnabled) {
          messageProcessor.forceStopNow();
          messageProcessorThread.join();
        }
      }
    }
    if (exitSuccess) {
      stdoutReaperThread.join();
      stderrReaperThread.join();
    }
 else {
      logger.error("String_Node_Str" + Arrays.toString(taskEntity.getCmdArray()));
    }
    logger.info("String_Node_Str" + taskEntity.getId());
  }
 catch (  InterruptedException e) {
    logger.error("String_Node_Str",e);
  }
  if (mqEnabled) {
    successed=messageProcessor.isSuccess();
    if (!successed) {
      errorMessage=messageProcessor.getErrorMessage();
    }
  }
  result.put("String_Node_Str",successed);
  result.put("String_Node_Str",errorMessage);
  return result;
}