Program: 63203
Project: 63203
Buggy source:
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public String submitJob(CubeInstance cube,long startDate,long endDate,CubeBuildTypeEnum buildType,String submitter) throws IOException, JobException, InvalidJobInstanceException {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str" + cube.getName() + "String_Node_Str"+ jobInstance.getUuid()+ "String_Node_Str");
    }
  }
  String uuid=null;
  try {
    List<CubeSegment> cubeSegments;
    if (buildType == RealizationBuildTypeEnum.BUILD) {
      cubeSegments=this.getCubeManager().appendSegments(cube,startDate,endDate);
    }
 else     if (buildType == RealizationBuildTypeEnum.MERGE) {
      cubeSegments=this.getCubeManager().mergeSegments(cube,startDate,endDate);
    }
 else {
      throw new JobException("String_Node_Str" + buildType);
    }
    List<JobInstance> jobs=Lists.newArrayListWithExpectedSize(cubeSegments.size());
    for (    CubeSegment segment : cubeSegments) {
      uuid=segment.getUuid();
      JobInstance job=getJobManager().createJob(cube.getName(),segment.getName(),segment.getUuid(),buildType,submitter);
      segment.setLastBuildJobID(uuid);
      jobs.add(job);
    }
    getCubeManager().updateCube(cube);
    for (    JobInstance job : jobs) {
      this.getJobManager().submitJob(job);
      permissionService.init(job,null);
      permissionService.inherit(job,cube);
    }
  }
 catch (  CubeIntegrityException e) {
    throw new InternalErrorException(e.getLocalizedMessage(),e);
  }
  return uuid;
}

Fixed version (ground truth):
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public String submitJob(CubeInstance cube,long startDate,long endDate,CubeBuildTypeEnum buildType,String submitter) throws IOException, JobException, InvalidJobInstanceException {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str" + cube.getName() + "String_Node_Str"+ jobInstance.getUuid()+ "String_Node_Str");
    }
  }
  String uuid=null;
  try {
    List<CubeSegment> cubeSegments;
    if (buildType == CubeBuildTypeEnum.BUILD) {
      cubeSegments=this.getCubeManager().appendSegments(cube,startDate,endDate);
    }
 else     if (buildType == CubeBuildTypeEnum.MERGE) {
      cubeSegments=this.getCubeManager().mergeSegments(cube,startDate,endDate);
    }
 else {
      throw new JobException("String_Node_Str" + buildType);
    }
    List<JobInstance> jobs=Lists.newArrayListWithExpectedSize(cubeSegments.size());
    for (    CubeSegment segment : cubeSegments) {
      uuid=segment.getUuid();
      JobInstance job=getJobManager().createJob(cube.getName(),segment.getName(),segment.getUuid(),buildType,submitter);
      segment.setLastBuildJobID(uuid);
      jobs.add(job);
    }
    getCubeManager().updateCube(cube);
    for (    JobInstance job : jobs) {
      this.getJobManager().submitJob(job);
      permissionService.init(job,null);
      permissionService.inherit(job,cube);
    }
  }
 catch (  CubeIntegrityException e) {
    throw new InternalErrorException(e.getLocalizedMessage(),e);
  }
  return uuid;
}