Program: 48695
Project: 48695
Buggy source:
/** 
 * update sub job status into main job's execution context for reporting
 * @param subJobExecution sub job execution
 * @param nodeName node name of sub job
 * @param mainJobExecutionContext main job execution context
 */
private void updateExecutionStatus(JobExecution subJobExecution,String nodeName,ExecutionContext mainJobExecutionContext){
  String rollbackStr=(String)subJobExecution.getExecutionContext().get(JobConstants.SUB_JOB_FAIL_FLAG);
  boolean rollback=false;
  if (rollbackStr != null) {
    rollback=Boolean.parseBoolean(rollbackStr);
  }
  if (subJobExecution.getStatus().isUnsuccessful() || rollback) {
    String errorMessage=subJobExecution.getExecutionContext().getString(JobConstants.CURRENT_ERROR_MESSAGE);
    Object failedObj=mainJobExecutionContext.get(JobConstants.SUB_JOB_NODES_FAIL);
    List<NodeOperationStatus> failedNodes=null;
    if (failedObj == null) {
      failedNodes=new ArrayList<NodeOperationStatus>();
    }
 else {
      failedNodes=(ArrayList<NodeOperationStatus>)failedObj;
    }
    NodeOperationStatus failedSubJob=new NodeOperationStatus(nodeName,false,errorMessage);
    failedNodes.add(failedSubJob);
    mainJobExecutionContext.put(JobConstants.SUB_JOB_NODES_FAIL,failedNodes);
  }
 else {
    Object succeededObj=mainJobExecutionContext.get(JobConstants.SUB_JOB_NODES_SUCCEED);
    List<NodeOperationStatus> succeededNodes=null;
    if (succeededObj == null) {
      succeededNodes=new ArrayList<NodeOperationStatus>();
    }
 else {
      succeededNodes=(ArrayList<NodeOperationStatus>)succeededObj;
    }
    NodeOperationStatus succeededSubJob=new NodeOperationStatus(nodeName);
    succeededNodes.add(succeededSubJob);
    mainJobExecutionContext.put(JobConstants.SUB_JOB_NODES_SUCCEED,succeededNodes);
  }
}

Fixed version (ground truth):
/** 
 * update sub job status into main job's execution context for reporting
 * @param subJobExecution sub job execution
 * @param nodeName node name of sub job
 * @param mainJobExecutionContext main job execution context
 */
private void updateExecutionStatus(JobExecution subJobExecution,String nodeName,ExecutionContext mainJobExecutionContext){
  String rollbackStr=(String)subJobExecution.getExecutionContext().get(JobConstants.SUB_JOB_FAIL_FLAG);
  boolean rollback=false;
  if (rollbackStr != null) {
    rollback=Boolean.parseBoolean(rollbackStr);
  }
  if (subJobExecution.getStatus().isUnsuccessful() || rollback) {
    Object errorMessageO=subJobExecution.getExecutionContext().get(JobConstants.CURRENT_ERROR_MESSAGE);
    String errorMessage=null;
    if (errorMessageO != null) {
      errorMessage=(String)errorMessageO;
    }
    Object failedObj=mainJobExecutionContext.get(JobConstants.SUB_JOB_NODES_FAIL);
    List<NodeOperationStatus> failedNodes=null;
    if (failedObj == null) {
      failedNodes=new ArrayList<NodeOperationStatus>();
    }
 else {
      failedNodes=(ArrayList<NodeOperationStatus>)failedObj;
    }
    NodeOperationStatus failedSubJob=new NodeOperationStatus(nodeName,false,errorMessage);
    failedNodes.add(failedSubJob);
    mainJobExecutionContext.put(JobConstants.SUB_JOB_NODES_FAIL,failedNodes);
  }
 else {
    Object succeededObj=mainJobExecutionContext.get(JobConstants.SUB_JOB_NODES_SUCCEED);
    List<NodeOperationStatus> succeededNodes=null;
    if (succeededObj == null) {
      succeededNodes=new ArrayList<NodeOperationStatus>();
    }
 else {
      succeededNodes=(ArrayList<NodeOperationStatus>)succeededObj;
    }
    NodeOperationStatus succeededSubJob=new NodeOperationStatus(nodeName);
    succeededNodes.add(succeededSubJob);
    mainJobExecutionContext.put(JobConstants.SUB_JOB_NODES_SUCCEED,succeededNodes);
  }
}