nus-yam/ex-repair huggingface dataset:
Program: 63117
Project: 63117
Buggy source:
@Before public void setUp() throws Exception {
  this.createTestMetadata();
  server=new Server(7070);
  ServletContextHandler context=new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("String_Node_Str");
  server.setHandler(context);
  configA=KylinConfig.getInstanceFromEnv();
  configB=KylinConfig.getKylinConfigFromInputStream(KylinConfig.getKylinPropertiesAsInputSteam());
  configB.setMetadataUrl(tempTestMetadataUrl);
  context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler(){
    @Override public void handle(    String type,    String name,    String event){
      final CacheService cacheService=new CacheService(){
        @Override public KylinConfig getConfig(){
          return configB;
        }
      }
;
      Broadcaster.TYPE wipeType=Broadcaster.TYPE.getType(type);
      Broadcaster.EVENT wipeEvent=Broadcaster.EVENT.getEvent(event);
      final String log="String_Node_Str" + wipeType + "String_Node_Str"+ wipeEvent+ "String_Node_Str"+ name;
      logger.info(log);
switch (wipeEvent) {
case CREATE:
case UPDATE:
        cacheService.rebuildCache(wipeType,name);
      break;
case DROP:
    cacheService.removeCache(wipeType,name);
  break;
default :
throw new RuntimeException("String_Node_Str" + wipeEvent);
}
}
}
)),"String_Node_Str");
server.start();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  this.createTestMetadata();
  server=new Server(7070);
  ServletContextHandler context=new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("String_Node_Str");
  server.setHandler(context);
  configA=KylinConfig.getInstanceFromEnv();
  configB=KylinConfig.getKylinConfigFromInputStream(KylinConfig.getKylinPropertiesAsInputSteam());
  configB.setMetadataUrl(tempTestMetadataUrl);
  context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler(){
    @Override public void handle(    String type,    String name,    String event){
      final CacheService cacheService=new CacheService(){
        @Override public KylinConfig getConfig(){
          return configB;
        }
      }
;
      Broadcaster.TYPE wipeType=Broadcaster.TYPE.getType(type);
      Broadcaster.EVENT wipeEvent=Broadcaster.EVENT.getEvent(event);
      final String log="String_Node_Str" + wipeType + "String_Node_Str"+ wipeEvent+ "String_Node_Str"+ name;
      logger.info(log);
      counter.incrementAndGet();
switch (wipeEvent) {
case CREATE:
case UPDATE:
        cacheService.rebuildCache(wipeType,name);
      break;
case DROP:
    cacheService.removeCache(wipeType,name);
  break;
default :
throw new RuntimeException("String_Node_Str" + wipeEvent);
}
}
}
)),"String_Node_Str");
server.start();
counter.set(0L);
}
Program: 63118
Project: 63118
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((expression == null) ? 0 : expression.hashCode());
  result=prime * result + ((parameter == null) ? 0 : parameter.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((expression == null) ? 0 : expression.hashCode());
  result=prime * result + ((isCount() || parameter == null) ? 0 : parameter.hashCode());
  return result;
}
Program: 63119
Project: 63119
Buggy source:
private MapReduceExecutable createInvertedIndexStep(IISegment seg,String intermediateHiveTable,String iiOutputTempPath){
  MapReduceExecutable buildIIStep=new MapReduceExecutable();
  StringBuilder cmd=new StringBuilder();
  appendMapReduceParameters(cmd,engineConfig);
  buildIIStep.setName(ExecutableConstants.STEP_NAME_BUILD_BASE_CUBOID);
  appendExecCmdParameters(cmd,"String_Node_Str",seg.getIIInstance().getName());
  appendExecCmdParameters(cmd,"String_Node_Str",intermediateHiveTable);
  appendExecCmdParameters(cmd,"String_Node_Str",iiOutputTempPath);
  appendExecCmdParameters(cmd,"String_Node_Str",ExecutableConstants.STEP_NAME_BUILD_II);
  buildIIStep.setMapReduceParams(cmd.toString());
  buildIIStep.setMapReduceJobClass(InvertedIndexJob.class);
  return buildIIStep;
}

Fixed version (ground truth):
private MapReduceExecutable createInvertedIndexStep(IISegment seg,String intermediateHiveTable,String iiOutputTempPath){
  MapReduceExecutable buildIIStep=new MapReduceExecutable();
  StringBuilder cmd=new StringBuilder();
  appendMapReduceParameters(cmd,engineConfig);
  buildIIStep.setName(ExecutableConstants.STEP_NAME_BUILD_II);
  appendExecCmdParameters(cmd,"String_Node_Str",seg.getIIInstance().getName());
  appendExecCmdParameters(cmd,"String_Node_Str",intermediateHiveTable);
  appendExecCmdParameters(cmd,"String_Node_Str",iiOutputTempPath);
  appendExecCmdParameters(cmd,"String_Node_Str",ExecutableConstants.STEP_NAME_BUILD_II);
  buildIIStep.setMapReduceParams(cmd.toString());
  buildIIStep.setMapReduceJobClass(InvertedIndexJob.class);
  return buildIIStep;
}
Program: 63120
Project: 63120
Buggy source:
@BeforeClass public static void beforeClass() throws Exception {
  ClasspathUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
  System.setProperty("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws Exception {
  logger.info("String_Node_Str" + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
  ClasspathUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
  System.setProperty("String_Node_Str","String_Node_Str");
}
Program: 63121
Project: 63121
Buggy source:
public Pair<CubeSegment,CubeSegment> appendAndMergeSegments(CubeInstance cube,long endDate) throws IOException {
  checkNoBuildingSegment(cube);
  checkCubeIsPartitioned(cube);
  long appendStart=calculateStartDateForAppendSegment(cube);
  CubeSegment appendSegment=newSegment(cube,appendStart,endDate);
  long startDate=cube.getDescriptor().getCubePartitionDesc().getPartitionDateStart();
  Pair<Long,Long> range=alignMergeRange(cube,startDate,endDate);
  CubeSegment mergeSegment=newSegment(cube,range.getFirst(),range.getSecond());
  validateNewSegments(cube,appendSegment,mergeSegment);
  cube.getSegments().add(appendSegment);
  cube.getSegments().add(mergeSegment);
  Collections.sort(cube.getSegments());
  updateCube(cube);
  return new Pair<CubeSegment,CubeSegment>(appendSegment,mergeSegment);
}

Fixed version (ground truth):
public Pair<CubeSegment,CubeSegment> appendAndMergeSegments(CubeInstance cube,long endDate) throws IOException {
  checkNoBuildingSegment(cube);
  checkCubeIsPartitioned(cube);
  long appendStart=calculateStartDateForAppendSegment(cube);
  CubeSegment appendSegment=newSegment(cube,appendStart,endDate);
  long startDate=cube.getDescriptor().getCubePartitionDesc().getPartitionDateStart();
  CubeSegment mergeSegment=newSegment(cube,startDate,endDate);
  validateNewSegments(cube,mergeSegment);
  cube.getSegments().add(appendSegment);
  cube.getSegments().add(mergeSegment);
  Collections.sort(cube.getSegments());
  updateCube(cube);
  return new Pair<CubeSegment,CubeSegment>(appendSegment,mergeSegment);
}
Program: 63122
Project: 63122
Buggy source:
private CubeSegment newSegment(CubeInstance cubeInstance,long startDate,long endDate){
  if (startDate >= endDate)   throw new IllegalArgumentException("String_Node_Str" + startDate + "String_Node_Str"+ endDate);
  CubeSegment segment=new CubeSegment();
  String incrementalSegName=CubeSegment.getSegmentName(startDate,endDate);
  segment.setUuid(UUID.randomUUID().toString());
  segment.setName(incrementalSegName);
  Date creatTime=new Date();
  segment.setCreateTime(DateStrDictionary.dateToString(creatTime));
  segment.setCreateTimeUTC(creatTime.getTime());
  segment.setDateRangeStart(startDate);
  segment.setDateRangeEnd(endDate);
  segment.setStatus(SegmentStatusEnum.NEW);
  segment.setStorageLocationIdentifier(generateStorageLocation());
  segment.setCubeInstance(cubeInstance);
  return segment;
}

Fixed version (ground truth):
private CubeSegment newSegment(CubeInstance cubeInstance,long startDate,long endDate){
  if (startDate >= endDate)   throw new IllegalArgumentException("String_Node_Str" + startDate + "String_Node_Str"+ endDate);
  CubeSegment segment=new CubeSegment();
  String incrementalSegName=CubeSegment.getSegmentName(startDate,endDate);
  segment.setUuid(UUID.randomUUID().toString());
  segment.setName(incrementalSegName);
  Date creatTime=new Date();
  segment.setCreateTime(DateStrDictionary.dateToString(creatTime));
  segment.setCreateTimeUTC(creatTime.getTime());
  segment.setDateRangeStart(startDate);
  segment.setDateRangeEnd(endDate);
  segment.setStatus(SegmentStatusEnum.NEW);
  segment.setStorageLocationIdentifier(generateStorageLocation());
  segment.setCubeInstance(cubeInstance);
  segment.validate();
  return segment;
}
Program: 63123
Project: 63123
Buggy source:
public void updateJobCounter(){
  try {
    Counters counters=job.getCounters();
    if (counters == null) {
      String errorMsg="String_Node_Str" + getMrJobId();
      log.warn(errorMsg);
      output.append(errorMsg);
      return;
    }
    this.output.append(counters.toString()).append("String_Node_Str");
    log.debug(counters.toString());
    mapInputRecords=String.valueOf(counters.findCounter(TaskCounter.MAP_INPUT_RECORDS).getValue());
    hdfsBytesWritten=String.valueOf(counters.findCounter("String_Node_Str","String_Node_Str").getValue());
  }
 catch (  Exception e) {
    log.error(e.getLocalizedMessage(),e);
    output.append(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void updateJobCounter(){
  try {
    Counters counters=job.getCounters();
    if (counters == null) {
      String errorMsg="String_Node_Str" + getMrJobId();
      log.warn(errorMsg);
      output.append(errorMsg);
      return;
    }
    this.output.append(counters.toString()).append("String_Node_Str");
    log.debug(counters.toString());
    mapInputRecords=String.valueOf(counters.findCounter(TaskCounter.MAP_INPUT_RECORDS).getValue());
    hdfsBytesWritten=String.valueOf(counters.findCounter("String_Node_Str","String_Node_Str").getValue());
    hdfsBytesRead=String.valueOf(counters.findCounter("String_Node_Str","String_Node_Str").getValue());
  }
 catch (  Exception e) {
    log.error(e.getLocalizedMessage(),e);
    output.append(e.getLocalizedMessage());
  }
}
Program: 63126
Project: 63126
Buggy source:
public Pair<CubeSegment,CubeSegment> appendAndMergeSegments(CubeInstance cube,long startDate,long endDate) throws IOException {
  checkNoBuildingSegment(cube);
  checkCubeIsPartitioned(cube);
  long appendStart=calculateStartDateForAppendSegment(cube);
  CubeSegment appendSegment=newSegment(cube,appendStart,endDate);
  Pair<Long,Long> range=alignMergeRange(cube,startDate,endDate);
  CubeSegment mergeSegment=newSegment(cube,range.getFirst(),range.getSecond());
  validateNewSegments(cube,appendSegment,mergeSegment);
  cube.getSegments().add(appendSegment);
  cube.getSegments().add(mergeSegment);
  Collections.sort(cube.getSegments());
  updateCube(cube);
  return new Pair<CubeSegment,CubeSegment>(appendSegment,mergeSegment);
}

Fixed version (ground truth):
public Pair<CubeSegment,CubeSegment> appendAndMergeSegments(CubeInstance cube,long endDate) throws IOException {
  checkNoBuildingSegment(cube);
  checkCubeIsPartitioned(cube);
  long appendStart=calculateStartDateForAppendSegment(cube);
  CubeSegment appendSegment=newSegment(cube,appendStart,endDate);
  long startDate=cube.getDescriptor().getCubePartitionDesc().getPartitionDateStart();
  Pair<Long,Long> range=alignMergeRange(cube,startDate,endDate);
  CubeSegment mergeSegment=newSegment(cube,range.getFirst(),range.getSecond());
  validateNewSegments(cube,appendSegment,mergeSegment);
  cube.getSegments().add(appendSegment);
  cube.getSegments().add(mergeSegment);
  Collections.sort(cube.getSegments());
  updateCube(cube);
  return new Pair<CubeSegment,CubeSegment>(appendSegment,mergeSegment);
}
Program: 63127
Project: 63127
Buggy source:
public CubeSegment appendSegments(CubeInstance cube,long startDate,long endDate) throws IOException {
  checkNoBuildingSegment(cube);
  CubeSegment newSegment;
  if (cube.getDescriptor().getCubePartitionDesc().isPartitioned()) {
    startDate=calculateStartDateForAppendSegment(cube);
    newSegment=newSegment(cube,startDate,endDate);
  }
 else {
    newSegment=newSegment(cube,0,Long.MAX_VALUE);
  }
  validateNewSegments(cube,newSegment);
  cube.getSegments().add(newSegment);
  Collections.sort(cube.getSegments());
  updateCube(cube);
  return newSegment;
}

Fixed version (ground truth):
public CubeSegment appendSegments(CubeInstance cube,long endDate) throws IOException {
  checkNoBuildingSegment(cube);
  CubeSegment newSegment;
  if (cube.getDescriptor().getCubePartitionDesc().isPartitioned()) {
    long startDate=calculateStartDateForAppendSegment(cube);
    newSegment=newSegment(cube,startDate,endDate);
  }
 else {
    newSegment=newSegment(cube,0,Long.MAX_VALUE);
  }
  validateNewSegments(cube,newSegment);
  cube.getSegments().add(newSegment);
  Collections.sort(cube.getSegments());
  updateCube(cube);
  return newSegment;
}
Program: 63128
Project: 63128
Buggy source:
/** 
 * @param storageLocationIdentifier the storageLocationIdentifier to set
 */
public void setStorageLocationIdentifier(String storageLocationIdentifier){
  this.storageLocationIdentifier=storageLocationIdentifier;
}

Fixed version (ground truth):
public void setStorageLocationIdentifier(String storageLocationIdentifier){
  this.storageLocationIdentifier=storageLocationIdentifier;
}
Program: 63131
Project: 63131
Buggy source:
@Test(expected=IllegalStateException.class) public void testInvalidRebuild() throws IOException {
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  System.out.println("String_Node_Str");
  cubeMgr.appendSegments(cubeInstance,1364688000000L + 1000L,1386806400000L);
}

Fixed version (ground truth):
@Test(expected=IllegalStateException.class) public void testInvalidRebuild() throws IOException {
  CubeInstance cubeInstance=cubeMgr.getCube("String_Node_Str");
  System.out.println("String_Node_Str");
  cubeMgr.appendSegments(cubeInstance,1386806400000L);
}
Program: 63135
Project: 63135
Buggy source:
private String buildSegment(String cubeName,long startDate,long endDate) throws Exception {
  CubeSegment segment=cubeManager.appendSegments(cubeManager.getCube(cubeName),startDate,endDate);
  CubingJobBuilder cubingJobBuilder=new CubingJobBuilder(jobEngineConfig);
  CubingJob job=cubingJobBuilder.buildJob(segment);
  jobService.addJob(job);
  waitForJob(job.getId());
  return job.getId();
}

Fixed version (ground truth):
private String buildSegment(String cubeName,long startDate,long endDate) throws Exception {
  CubeSegment segment=cubeManager.appendSegments(cubeManager.getCube(cubeName),endDate);
  CubingJobBuilder cubingJobBuilder=new CubingJobBuilder(jobEngineConfig);
  CubingJob job=cubingJobBuilder.buildJob(segment);
  jobService.addJob(job);
  waitForJob(job.getId());
  return job.getId();
}
Program: 63136
Project: 63136
Buggy source:
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public JobInstance submitJob(CubeInstance cube,long startDate,long endDate,CubeBuildTypeEnum buildType,String submitter) throws IOException, JobException {
  final List<CubingJob> cubingJobs=listAllCubingJobs(cube.getName(),null,EnumSet.allOf(ExecutableState.class));
  for (  CubingJob job : cubingJobs) {
    if (job.getStatus() == ExecutableState.READY || job.getStatus() == ExecutableState.RUNNING) {
      throw new JobException("String_Node_Str" + cube.getName() + "String_Node_Str"+ job.getId()+ "String_Node_Str");
    }
  }
  CubingJob job;
  CubingJobBuilder builder=new CubingJobBuilder(new JobEngineConfig(getConfig()));
  builder.setSubmitter(submitter);
  if (buildType == CubeBuildTypeEnum.BUILD) {
    if (cube.getDescriptor().hasHolisticCountDistinctMeasures() && cube.getSegments().size() > 0) {
      Pair<CubeSegment,CubeSegment> segs=getCubeManager().appendAndMergeSegments(cube,startDate,endDate);
      job=builder.buildAndMergeJob(segs.getFirst(),segs.getSecond());
    }
 else {
      CubeSegment newSeg=getCubeManager().appendSegments(cube,startDate,endDate);
      job=builder.buildJob(newSeg);
    }
  }
 else   if (buildType == CubeBuildTypeEnum.MERGE) {
    CubeSegment newSeg=getCubeManager().mergeSegments(cube,startDate,endDate);
    job=builder.mergeJob(newSeg);
  }
 else {
    throw new JobException("String_Node_Str" + buildType);
  }
  getExecutableManager().addJob(job);
  return parseToJobInstance(job);
}

Fixed version (ground truth):
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public JobInstance submitJob(CubeInstance cube,long startDate,long endDate,CubeBuildTypeEnum buildType,String submitter) throws IOException, JobException {
  final List<CubingJob> cubingJobs=listAllCubingJobs(cube.getName(),null,EnumSet.allOf(ExecutableState.class));
  for (  CubingJob job : cubingJobs) {
    if (job.getStatus() == ExecutableState.READY || job.getStatus() == ExecutableState.RUNNING) {
      throw new JobException("String_Node_Str" + cube.getName() + "String_Node_Str"+ job.getId()+ "String_Node_Str");
    }
  }
  CubingJob job;
  CubingJobBuilder builder=new CubingJobBuilder(new JobEngineConfig(getConfig()));
  builder.setSubmitter(submitter);
  if (buildType == CubeBuildTypeEnum.BUILD) {
    if (cube.getDescriptor().hasHolisticCountDistinctMeasures() && cube.getSegments().size() > 0) {
      Pair<CubeSegment,CubeSegment> segs=getCubeManager().appendAndMergeSegments(cube,endDate);
      job=builder.buildAndMergeJob(segs.getFirst(),segs.getSecond());
    }
 else {
      CubeSegment newSeg=getCubeManager().appendSegments(cube,endDate);
      job=builder.buildJob(newSeg);
    }
  }
 else   if (buildType == CubeBuildTypeEnum.MERGE) {
    CubeSegment newSeg=getCubeManager().mergeSegments(cube,startDate,endDate);
    job=builder.mergeJob(newSeg);
  }
 else {
    throw new JobException("String_Node_Str" + buildType);
  }
  getExecutableManager().addJob(job);
  return parseToJobInstance(job);
}
Program: 63137
Project: 63137
Buggy source:
@Before public void setUp() throws Exception {
  this.createTestMetadata();
  server=new Server(8080);
  ServletContextHandler context=new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("String_Node_Str");
  server.setHandler(context);
  configA=KylinConfig.getInstanceFromEnv();
  configB=KylinConfig.getKylinConfigFromInputStream(KylinConfig.getKylinPropertiesAsInputSteam());
  configB.setMetadataUrl(tempTestMetadataUrl);
  context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler(){
    @Override public void handle(    String type,    String name,    String event){
      final CacheService cacheService=new CacheService(){
        @Override public KylinConfig getConfig(){
          return configB;
        }
      }
;
      Broadcaster.TYPE wipeType=Broadcaster.TYPE.getType(type);
      Broadcaster.EVENT wipeEvent=Broadcaster.EVENT.getEvent(event);
      final String log="String_Node_Str" + wipeType + "String_Node_Str"+ wipeEvent+ "String_Node_Str"+ name;
      logger.info(log);
switch (wipeEvent) {
case CREATE:
case UPDATE:
        cacheService.rebuildCache(wipeType,name);
      break;
case DROP:
    cacheService.removeCache(wipeType,name);
  break;
default :
throw new RuntimeException("String_Node_Str" + wipeEvent);
}
}
}
)),"String_Node_Str");
server.start();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  this.createTestMetadata();
  server=new Server(7070);
  ServletContextHandler context=new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("String_Node_Str");
  server.setHandler(context);
  configA=KylinConfig.getInstanceFromEnv();
  configB=KylinConfig.getKylinConfigFromInputStream(KylinConfig.getKylinPropertiesAsInputSteam());
  configB.setMetadataUrl(tempTestMetadataUrl);
  context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler(){
    @Override public void handle(    String type,    String name,    String event){
      final CacheService cacheService=new CacheService(){
        @Override public KylinConfig getConfig(){
          return configB;
        }
      }
;
      Broadcaster.TYPE wipeType=Broadcaster.TYPE.getType(type);
      Broadcaster.EVENT wipeEvent=Broadcaster.EVENT.getEvent(event);
      final String log="String_Node_Str" + wipeType + "String_Node_Str"+ wipeEvent+ "String_Node_Str"+ name;
      logger.info(log);
switch (wipeEvent) {
case CREATE:
case UPDATE:
        cacheService.rebuildCache(wipeType,name);
      break;
case DROP:
    cacheService.removeCache(wipeType,name);
  break;
default :
throw new RuntimeException("String_Node_Str" + wipeEvent);
}
}
}
)),"String_Node_Str");
server.start();
}
Program: 63139
Project: 63139
Buggy source:
@Override protected void onExecuteStart(ExecutableContext executableContext){
  if (!jobService.getOutput(getId()).getExtra().containsKey(START_TIME)) {
    Map<String,String> info=Maps.newHashMap();
    info.put(START_TIME,Long.toString(System.currentTimeMillis()));
    jobService.updateJobOutput(getId(),ExecutableState.RUNNING,info,null);
    ;
  }
 else {
    jobService.updateJobOutput(getId(),ExecutableState.RUNNING,null,null);
  }
}

Fixed version (ground truth):
@Override protected void onExecuteStart(ExecutableContext executableContext){
  final Output output=jobService.getOutput(getId());
  if (output.getExtra().containsKey(START_TIME)) {
    final String mrJobId=output.getExtra().get(ExecutableConstants.MR_JOB_ID);
    if (mrJobId == null) {
      jobService.updateJobOutput(getId(),ExecutableState.RUNNING,null,null);
      return;
    }
    try {
      Job job=new Cluster(new Configuration()).getJob(JobID.forName(mrJobId));
      if (job.getJobState() == JobStatus.State.FAILED) {
        super.onExecuteStart(executableContext);
      }
 else {
        jobService.updateJobOutput(getId(),ExecutableState.RUNNING,null,null);
      }
    }
 catch (    IOException e) {
      logger.warn("String_Node_Str");
      super.onExecuteStart(executableContext);
    }
catch (    InterruptedException e) {
      logger.warn("String_Node_Str");
      super.onExecuteStart(executableContext);
    }
  }
 else {
    super.onExecuteStart(executableContext);
  }
}
Program: 63140
Project: 63140
Buggy source:
public static void deployJobJars() throws IOException {
  Pair<File,File> files=getJobJarFiles();
  File jobJar=files.getFirst();
  File coprocessorJar=files.getSecond();
  File jobJarRemote=new File(config().getKylinJobJarPath());
  File jobJarLocal=new File(jobJar.getParentFile(),jobJarRemote.getName());
  if (jobJar.equals(jobJarLocal) == false) {
    FileUtils.copyFile(jobJar,jobJarLocal);
  }
  File coprocessorJarRemote=new File(config().getCoprocessorLocalJar());
  File coprocessorJarLocal=new File(coprocessorJar.getParentFile(),coprocessorJarRemote.getName());
  if (coprocessorJar.equals(coprocessorJarLocal) == false) {
    FileUtils.copyFile(coprocessorJar,coprocessorJarLocal);
  }
  CliCommandExecutor cmdExec=config().getCliCommandExecutor();
  cmdExec.copyFile(jobJarLocal.getAbsolutePath(),jobJarRemote.getParent());
  cmdExec.copyFile(coprocessorJar.getAbsolutePath(),coprocessorJarRemote.getParent());
}

Fixed version (ground truth):
public static void deployJobJars() throws IOException {
  Pair<File,File> files=getJobJarFiles();
  File originalJobJar=files.getFirst();
  File originalCoprocessorJar=files.getSecond();
  File targetJobJar=new File(config().getKylinJobJarPath());
  File jobJarRenamedAsTarget=new File(originalJobJar.getParentFile(),targetJobJar.getName());
  if (originalJobJar.equals(jobJarRenamedAsTarget) == false) {
    FileUtils.copyFile(originalJobJar,jobJarRenamedAsTarget);
  }
  File targetCoprocessorJar=new File(config().getCoprocessorLocalJar());
  File coprocessorJarRenamedAsTarget=new File(originalCoprocessorJar.getParentFile(),targetCoprocessorJar.getName());
  if (originalCoprocessorJar.equals(coprocessorJarRenamedAsTarget) == false) {
    FileUtils.copyFile(originalCoprocessorJar,coprocessorJarRenamedAsTarget);
  }
  CliCommandExecutor cmdExec=config().getCliCommandExecutor();
  cmdExec.copyFile(jobJarRenamedAsTarget.getAbsolutePath(),targetJobJar.getParent());
  cmdExec.copyFile(coprocessorJarRenamedAsTarget.getAbsolutePath(),targetCoprocessorJar.getParent());
}
Program: 63141
Project: 63141
Buggy source:
public HiveClient(){
  hiveConf=new HiveConf(HiveClient.class);
}

Fixed version (ground truth):
public HiveClient(Map<String,String> configMap){
  this();
  appendConfiguration(configMap);
}
Program: 63142
Project: 63142
Buggy source:
@Override public void map(KEYIN key,HCatRecord record,Context context) throws IOException, InterruptedException {
  try {
    int[] flatTableIndexes=intermediateTableDesc.getRowKeyColumnIndexes();
    HCatFieldSchema fieldSchema=null;
    for (    int i : factDictCols) {
      outputKey.set((short)i);
      fieldSchema=schema.get(flatTableIndexes[i]);
      Object fieldValue=record.get(fieldSchema.getName(),schema);
      if (fieldValue == null)       fieldValue="String_Node_Str";
      byte[] bytes=Bytes.toBytes(fieldValue.toString());
      outputValue.set(bytes,0,bytes.length);
      context.write(outputKey,outputValue);
    }
  }
 catch (  Exception ex) {
    handleErrorRecord(record,ex);
  }
}

Fixed version (ground truth):
@Override public void map(KEYIN key,HCatRecord record,Context context) throws IOException, InterruptedException {
  try {
    int[] flatTableIndexes=intermediateTableDesc.getRowKeyColumnIndexes();
    HCatFieldSchema fieldSchema=null;
    for (    int i : factDictCols) {
      outputKey.set((short)i);
      fieldSchema=schema.get(flatTableIndexes[i]);
      Object fieldValue=record.get(fieldSchema.getName(),schema);
      if (fieldValue == null)       continue;
      byte[] bytes=Bytes.toBytes(fieldValue.toString());
      outputValue.set(bytes,0,bytes.length);
      context.write(outputKey,outputValue);
    }
  }
 catch (  Exception ex) {
    handleErrorRecord(record,ex);
  }
}
Program: 63143
Project: 63143
Buggy source:
@Override public int run(String[] args) throws Exception {
  Options options=new Options();
  try {
    options.addOption(OPTION_JOB_NAME);
    options.addOption(OPTION_TABLE_NAME);
    options.addOption(OPTION_OUTPUT_PATH);
    parseOptions(options,args);
    job=Job.getInstance(getConf(),getOptionValue(OPTION_JOB_NAME));
    String tableName=getOptionValue(OPTION_TABLE_NAME).toUpperCase();
    Path output=new Path(getOptionValue(OPTION_OUTPUT_PATH));
    log.info("String_Node_Str" + job.getJobName() + "String_Node_Str"+ tableName);
    MetadataManager metaMgr=MetadataManager.getInstance(KylinConfig.getInstanceFromEnv());
    TableDesc table=metaMgr.getTableDesc(tableName);
    job.getConfiguration().set(BatchConstants.TABLE_NAME,table.getIdentity());
    job.getConfiguration().set(BatchConstants.TABLE_COLUMNS,getColumns(table));
    setupMapInput();
    setupReduceOutput(output);
    return waitForCompletion(job);
  }
 catch (  Exception e) {
    printUsage(options);
    log.error(e.getLocalizedMessage(),e);
    return 2;
  }
}

Fixed version (ground truth):
@Override public int run(String[] args) throws Exception {
  Options options=new Options();
  try {
    options.addOption(OPTION_JOB_NAME);
    options.addOption(OPTION_TABLE_NAME);
    options.addOption(OPTION_II_NAME);
    options.addOption(OPTION_OUTPUT_PATH);
    parseOptions(options,args);
    job=Job.getInstance(getConf(),getOptionValue(OPTION_JOB_NAME));
    String tableName=getOptionValue(OPTION_TABLE_NAME).toUpperCase();
    String iiName=getOptionValue(OPTION_II_NAME);
    Path output=new Path(getOptionValue(OPTION_OUTPUT_PATH));
    log.info("String_Node_Str" + job.getJobName() + "String_Node_Str"+ tableName);
    IIManager iiMgr=IIManager.getInstance(KylinConfig.getInstanceFromEnv());
    IIInstance ii=iiMgr.getII(iiName);
    job.getConfiguration().set(BatchConstants.TABLE_NAME,tableName);
    job.getConfiguration().set(BatchConstants.TABLE_COLUMNS,getColumns(ii));
    setupMapInput();
    setupReduceOutput(output);
    return waitForCompletion(job);
  }
 catch (  Exception e) {
    printUsage(options);
    log.error(e.getLocalizedMessage(),e);
    return 2;
  }
}
Program: 63144
Project: 63144
Buggy source:
private String getColumns(TableDesc table){
  StringBuilder buf=new StringBuilder();
  for (  ColumnDesc col : table.getColumns()) {
    if (buf.length() > 0)     buf.append("String_Node_Str");
    buf.append(col.getName());
  }
  return buf.toString();
}

Fixed version (ground truth):
private String getColumns(IIInstance ii){
  IIJoinedFlatTableDesc iiflat=new IIJoinedFlatTableDesc(ii.getDescriptor());
  StringBuilder buf=new StringBuilder();
  for (  IntermediateColumnDesc col : iiflat.getColumnList()) {
    if (buf.length() > 0)     buf.append("String_Node_Str");
    buf.append(col.getColumnName());
  }
  return buf.toString();
}
Program: 63145
Project: 63145
Buggy source:
@Override public void map(KEYIN key,HCatRecord record,Context context) throws IOException, InterruptedException {
  HCatFieldSchema fieldSchema=null;
  for (short i=0; i < columnSize; i++) {
    outputKey.set(i);
    fieldSchema=schema.get(i);
    Object fieldValue=record.get(fieldSchema.getName(),schema);
    byte[] bytes;
    if (fieldValue != null) {
      bytes=Bytes.toBytes(fieldValue.toString());
    }
 else {
      bytes=NULL_VALUE;
    }
    outputValue.set(bytes,0,bytes.length);
    context.write(outputKey,outputValue);
  }
}

Fixed version (ground truth):
@Override public void map(KEYIN key,HCatRecord record,Context context) throws IOException, InterruptedException {
  HCatFieldSchema fieldSchema=null;
  for (short i=0; i < columnSize; i++) {
    outputKey.set(i);
    fieldSchema=schema.get(i);
    Object fieldValue=record.get(fieldSchema.getName(),schema);
    if (fieldValue == null)     continue;
    byte[] bytes=Bytes.toBytes(fieldValue.toString());
    outputValue.set(bytes,0,bytes.length);
    context.write(outputKey,outputValue);
  }
}
Program: 63146
Project: 63146
Buggy source:
private void setupMapInput(Path input,String inputFormat,String inputDelim) throws IOException {
  FileInputFormat.setInputPaths(job,input);
  File JarFile=new File(KylinConfig.getInstanceFromEnv().getKylinJobJarPath());
  if (JarFile.exists()) {
    job.setJar(KylinConfig.getInstanceFromEnv().getKylinJobJarPath());
  }
 else {
    job.setJarByClass(this.getClass());
  }
  if ("String_Node_Str".equalsIgnoreCase(inputFormat) || "String_Node_Str".equalsIgnoreCase(inputFormat)) {
    job.setInputFormatClass(TextInputFormat.class);
  }
 else {
    job.setInputFormatClass(SequenceFileInputFormat.class);
  }
  if ("String_Node_Str".equals(inputDelim)) {
    inputDelim="String_Node_Str";
  }
 else   if ("String_Node_Str".equals(inputDelim)) {
    inputDelim="String_Node_Str";
  }
  if (inputDelim != null) {
    job.getConfiguration().set(BatchConstants.INPUT_DELIM,inputDelim);
  }
  job.setMapperClass(InvertedIndexMapper.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(ImmutableBytesWritable.class);
  job.setPartitionerClass(InvertedIndexPartitioner.class);
}

Fixed version (ground truth):
private void setupMapInput(String intermediateTable) throws IOException {
  File JarFile=new File(KylinConfig.getInstanceFromEnv().getKylinJobJarPath());
  if (JarFile.exists()) {
    job.setJar(KylinConfig.getInstanceFromEnv().getKylinJobJarPath());
  }
 else {
    job.setJarByClass(this.getClass());
  }
  String[] dbTableNames=HadoopUtil.parseHiveTableName(intermediateTable);
  HCatInputFormat.setInput(job,dbTableNames[0],dbTableNames[1]);
  job.setInputFormatClass(HCatInputFormat.class);
  job.setMapperClass(InvertedIndexMapper.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(ImmutableBytesWritable.class);
  job.setPartitionerClass(InvertedIndexPartitioner.class);
}
Program: 63147
Project: 63147
Buggy source:
@Override public int run(String[] args) throws Exception {
  Options options=new Options();
  try {
    options.addOption(OPTION_JOB_NAME);
    options.addOption(OPTION_II_NAME);
    options.addOption(OPTION_INPUT_PATH);
    options.addOption(OPTION_INPUT_FORMAT);
    options.addOption(OPTION_INPUT_DELIM);
    options.addOption(OPTION_OUTPUT_PATH);
    parseOptions(options,args);
    job=Job.getInstance(getConf(),getOptionValue(OPTION_JOB_NAME));
    String iiname=getOptionValue(OPTION_II_NAME);
    Path input=new Path(getOptionValue(OPTION_INPUT_PATH));
    String inputFormat=getOptionValue(OPTION_INPUT_FORMAT);
    String inputDelim=getOptionValue(OPTION_INPUT_DELIM);
    Path output=new Path(getOptionValue(OPTION_OUTPUT_PATH));
    System.out.println("String_Node_Str" + job.getJobName());
    IIInstance ii=getII(iiname);
    short sharding=ii.getDescriptor().getSharding();
    setupMapInput(input,inputFormat,inputDelim);
    setupReduceOutput(output,sharding);
    attachMetadata(ii);
    return waitForCompletion(job);
  }
 catch (  Exception e) {
    printUsage(options);
    log.error(e.getLocalizedMessage(),e);
    return 2;
  }
}

Fixed version (ground truth):
@Override public int run(String[] args) throws Exception {
  Options options=new Options();
  try {
    options.addOption(OPTION_JOB_NAME);
    options.addOption(OPTION_II_NAME);
    options.addOption(OPTION_TABLE_NAME);
    options.addOption(OPTION_OUTPUT_PATH);
    parseOptions(options,args);
    job=Job.getInstance(getConf(),getOptionValue(OPTION_JOB_NAME));
    String iiname=getOptionValue(OPTION_II_NAME);
    String intermediateTable=getOptionValue(OPTION_TABLE_NAME);
    Path output=new Path(getOptionValue(OPTION_OUTPUT_PATH));
    System.out.println("String_Node_Str" + job.getJobName());
    IIInstance ii=getII(iiname);
    short sharding=ii.getDescriptor().getSharding();
    setupMapInput(intermediateTable);
    setupReduceOutput(output,sharding);
    attachMetadata(ii);
    return waitForCompletion(job);
  }
 catch (  Exception e) {
    printUsage(options);
    log.error(e.getLocalizedMessage(),e);
    return 2;
  }
}
Program: 63148
Project: 63148
Buggy source:
@Override protected void setup(Context context) throws IOException {
  Configuration conf=context.getConfiguration();
  String inputDelim=conf.get(BatchConstants.INPUT_DELIM);
  this.delim=inputDelim == null ? -1 : inputDelim.codePointAt(0);
  this.splitter=new BytesSplitter(200,4096);
  KylinConfig config=AbstractHadoopJob.loadKylinPropsAndMetadata(conf);
  IIManager mgr=IIManager.getInstance(config);
  IIInstance ii=mgr.getII(conf.get(BatchConstants.CFG_II_NAME));
  IISegment seg=ii.getSegment(conf.get(BatchConstants.CFG_II_SEGMENT_NAME),SegmentStatusEnum.NEW);
  this.info=new TableRecordInfo(seg);
  this.rec=this.info.createTableRecord();
  outputKey=new LongWritable();
  outputValue=new ImmutableBytesWritable(rec.getBytes());
}

Fixed version (ground truth):
@Override protected void setup(Context context) throws IOException {
  Configuration conf=context.getConfiguration();
  KylinConfig config=AbstractHadoopJob.loadKylinPropsAndMetadata(conf);
  IIManager mgr=IIManager.getInstance(config);
  IIInstance ii=mgr.getII(conf.get(BatchConstants.CFG_II_NAME));
  IISegment seg=ii.getSegment(conf.get(BatchConstants.CFG_II_SEGMENT_NAME),SegmentStatusEnum.NEW);
  this.info=new TableRecordInfo(seg);
  this.rec=this.info.createTableRecord();
  outputKey=new LongWritable();
  outputValue=new ImmutableBytesWritable(rec.getBytes());
  schema=HCatInputFormat.getTableSchema(context.getConfiguration());
  fields=schema.getFields();
}
Program: 63149
Project: 63149
Buggy source:
@Override public void map(KEYIN key,Text value,Context context) throws IOException, InterruptedException {
  if (delim == -1) {
    delim=splitter.detectDelim(value,info.getDigest().getColumnCount());
  }
  int nParts=splitter.split(value.getBytes(),value.getLength(),(byte)delim);
  SplittedBytes[] parts=splitter.getSplitBuffers();
  if (nParts != info.getDigest().getColumnCount()) {
    throw new RuntimeException("String_Node_Str" + parts.length + "String_Node_Str"+ value.toString()+ "String_Node_Str"+ info.getDigest().getColumnCount()+ "String_Node_Str");
  }
  rec.reset();
  for (int i=0; i < nParts; i++) {
    rec.setValueString(i,Bytes.toString(parts[i].value,0,parts[i].length));
  }
  outputKey.set(rec.getTimestamp());
  context.write(outputKey,outputValue);
}

Fixed version (ground truth):
@Override public void map(KEYIN key,HCatRecord record,Context context) throws IOException, InterruptedException {
  rec.reset();
  for (int i=0; i < fields.size(); i++) {
    Object fieldValue=record.get(i);
    rec.setValueString(i,fieldValue == null ? null : fieldValue.toString());
  }
  outputKey.set(rec.getTimestamp());
  context.write(outputKey,outputValue);
}
Program: 63150
Project: 63150
Buggy source:
/** 
 * Reload IIDesc from resource store It will be triggered by an desc update event.
 * @param name
 * @throws IOException
 */
public IIDesc reloadIIDesc(String name) throws IOException {
  String path=IIDesc.getIIDescResourcePath(name);
  IIDesc ndesc=loadIIDesc(path);
  iiDescMap.put(ndesc.getName(),ndesc);
  return ndesc;
}

Fixed version (ground truth):
/** 
 * Reload IIDesc from resource store It will be triggered by an desc update event.
 * @param name
 * @throws IOException
 */
public IIDesc reloadIIDesc(String name) throws IOException {
  String path=IIDesc.getIIDescResourcePath(name);
  IIDesc ndesc=loadIIDesc(path);
  iiDescMap.putLocal(ndesc.getName(),ndesc);
  return ndesc;
}
Program: 63152
Project: 63152
Buggy source:
private synchronized CubeInstance loadCubeInstance(String path) throws IOException {
  ResourceStore store=getStore();
  CubeInstance cubeInstance=null;
  try {
    cubeInstance=store.getResource(path,CubeInstance.class,CUBE_SERIALIZER);
    cubeInstance.setConfig(config);
    if (StringUtils.isBlank(cubeInstance.getName()))     throw new IllegalStateException("String_Node_Str");
    cubeMap.putLocal(cubeInstance.getName().toUpperCase(),cubeInstance);
    for (    CubeSegment segment : cubeInstance.getSegments()) {
      usedStorageLocation.add(segment.getName());
    }
    return cubeInstance;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + path,e);
    return null;
  }
}

Fixed version (ground truth):
private synchronized CubeInstance loadCubeInstance(String path) throws IOException {
  ResourceStore store=getStore();
  CubeInstance cubeInstance=null;
  try {
    cubeInstance=store.getResource(path,CubeInstance.class,CUBE_SERIALIZER);
    cubeInstance.setConfig(config);
    if (StringUtils.isBlank(cubeInstance.getName()))     throw new IllegalStateException("String_Node_Str");
    final String cubeName=cubeInstance.getName().toUpperCase();
    cubeMap.putLocal(cubeName,cubeInstance);
    for (    CubeSegment segment : cubeInstance.getSegments()) {
      usedStorageLocation.put(cubeName,segment.getStorageLocationIdentifier());
    }
    return cubeInstance;
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + path,e);
    return null;
  }
}
Program: 63153
Project: 63153
Buggy source:
private String generateStorageLocation(){
  String namePrefix=getHBaseStorageLocationPrefix();
  String tableName="String_Node_Str";
  do {
    StringBuffer sb=new StringBuffer();
    sb.append(namePrefix);
    for (int i=0; i < HBASE_TABLE_LENGTH; i++) {
      int idx=(int)(Math.random() * ALPHA_NUM.length());
      sb.append(ALPHA_NUM.charAt(idx));
    }
    tableName=sb.toString();
  }
 while (this.usedStorageLocation.contains(tableName));
  return tableName;
}

Fixed version (ground truth):
private String generateStorageLocation(){
  String namePrefix=getHBaseStorageLocationPrefix();
  String tableName="String_Node_Str";
  do {
    StringBuffer sb=new StringBuffer();
    sb.append(namePrefix);
    Random ran=new Random();
    for (int i=0; i < HBASE_TABLE_LENGTH; i++) {
      sb.append(ALPHA_NUM.charAt(ran.nextInt(ALPHA_NUM.length())));
    }
    tableName=sb.toString();
  }
 while (this.usedStorageLocation.containsValue(tableName));
  return tableName;
}
Program: 63154
Project: 63154
Buggy source:
/** 
 * After cube deletion, remove cube related cache
 * @param cube
 */
public void removeCubeCache(CubeInstance cube){
  cubeMap.remove(cube.getName().toUpperCase());
  for (  CubeSegment segment : cube.getSegments()) {
    usedStorageLocation.remove(segment.getName());
  }
}

Fixed version (ground truth):
/** 
 * After cube deletion, remove cube related cache
 * @param cube
 */
public void removeCubeCache(CubeInstance cube){
  final String cubeName=cube.getName().toUpperCase();
  cubeMap.remove(cubeName);
  usedStorageLocation.removeAll(cubeName);
}
Program: 63155
Project: 63155
Buggy source:
public void removeCubeCache(String cubeName){
  CubeInstance cube=CubeManager.getInstance(this.getConfig()).getCube(cubeName);
  CubeManager.getInstance(this.getConfig()).removeCubeCache(cube);
}

Fixed version (ground truth):
public void removeCubeCache(String cubeName){
  CubeManager.getInstance(this.getConfig()).removeCubeCacheLocal(cubeName);
}
Program: 63156
Project: 63156
Buggy source:
@Before public void setup() throws Exception {
  super.setUp();
  jobSchedulerController=new JobController();
  jobSchedulerController.setJobService(jobService);
  cubeController=new CubeController();
  cubeController.setJobService(jobService);
  cubeController.setCubeService(cubeService);
  KylinConfig testConfig=getTestConfig();
  cubeManager=CubeManager.getInstance(testConfig);
  cubeDescManager=CubeDescManager.getInstance(testConfig);
  jobDAO=JobDAO.getInstance(testConfig);
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  super.setUp();
  jobSchedulerController=new JobController();
  jobSchedulerController.setJobService(jobService);
  cubeController=new CubeController();
  cubeController.setJobService(jobService);
  cubeController.setCubeService(cubeService);
  KylinConfig testConfig=getTestConfig();
  cubeManager=CubeManager.getInstance(testConfig);
  cubeDescManager=CubeDescManager.getInstance(testConfig);
  jobDAO=JobDao.getInstance(testConfig);
}
Program: 63157
Project: 63157
Buggy source:
@Test public void testBasics() throws IOException {
  CubeDesc cubeDesc=cubeDescManager.getCubeDesc("String_Node_Str");
  CubeInstance cube=cubeManager.createCube(CUBE_NAME,"String_Node_Str",cubeDesc,"String_Node_Str");
  assertNotNull(cube);
  JobListRequest jobRequest=new JobListRequest();
  Assert.assertNotNull(jobSchedulerController.list(jobRequest));
  JobBuildRequest jobBuildRequest=new JobBuildRequest();
  jobBuildRequest.setBuildType("String_Node_Str");
  jobBuildRequest.setStartTime(0L);
  jobBuildRequest.setEndTime(new Date().getTime());
  JobInstance job=cubeController.rebuild(CUBE_NAME,jobBuildRequest);
  Assert.assertNotNull(jobSchedulerController.get(job.getId()));
  jobDAO.deleteJob(job);
  if (cubeManager.getCube(CUBE_NAME) != null) {
    cubeManager.dropCube(CUBE_NAME,false);
  }
}

Fixed version (ground truth):
@Test public void testBasics() throws IOException, PersistentException {
  CubeDesc cubeDesc=cubeDescManager.getCubeDesc("String_Node_Str");
  CubeInstance cube=cubeManager.createCube(CUBE_NAME,"String_Node_Str",cubeDesc,"String_Node_Str");
  assertNotNull(cube);
  JobListRequest jobRequest=new JobListRequest();
  Assert.assertNotNull(jobSchedulerController.list(jobRequest));
  JobBuildRequest jobBuildRequest=new JobBuildRequest();
  jobBuildRequest.setBuildType("String_Node_Str");
  jobBuildRequest.setStartTime(0L);
  jobBuildRequest.setEndTime(new Date().getTime());
  JobInstance job=cubeController.rebuild(CUBE_NAME,jobBuildRequest);
  Assert.assertNotNull(jobSchedulerController.get(job.getId()));
  jobDAO.deleteJob(job.getId());
  if (cubeManager.getCube(CUBE_NAME) != null) {
    cubeManager.dropCube(CUBE_NAME,false);
  }
}
Program: 63158
Project: 63158
Buggy source:
@Test public void testBasics() throws IOException {
  CubeDesc cubeDesc=cubeDescManager.getCubeDesc("String_Node_Str");
  CubeInstance cube=cubeManager.createCube(CUBE_NAME,"String_Node_Str",cubeDesc,"String_Node_Str");
  assertNotNull(cube);
  JobListRequest jobRequest=new JobListRequest();
  Assert.assertNotNull(jobSchedulerController.list(jobRequest));
  JobBuildRequest jobBuildRequest=new JobBuildRequest();
  jobBuildRequest.setBuildType("String_Node_Str");
  jobBuildRequest.setStartTime(0L);
  jobBuildRequest.setEndTime(new Date().getTime());
  JobInstance job=cubeController.rebuild(CUBE_NAME,jobBuildRequest);
  Assert.assertNotNull(jobSchedulerController.get(job.getId()));
  Map<String,String> output=jobSchedulerController.getStepOutput(job.getId(),0);
  Assert.assertNotNull(output);
  jobDAO.deleteJob(job);
  if (cubeManager.getCube(CUBE_NAME) != null) {
    cubeManager.dropCube(CUBE_NAME,false);
  }
}

Fixed version (ground truth):
@Test public void testBasics() throws IOException {
  CubeDesc cubeDesc=cubeDescManager.getCubeDesc("String_Node_Str");
  CubeInstance cube=cubeManager.createCube(CUBE_NAME,"String_Node_Str",cubeDesc,"String_Node_Str");
  assertNotNull(cube);
  JobListRequest jobRequest=new JobListRequest();
  Assert.assertNotNull(jobSchedulerController.list(jobRequest));
  JobBuildRequest jobBuildRequest=new JobBuildRequest();
  jobBuildRequest.setBuildType("String_Node_Str");
  jobBuildRequest.setStartTime(0L);
  jobBuildRequest.setEndTime(new Date().getTime());
  JobInstance job=cubeController.rebuild(CUBE_NAME,jobBuildRequest);
  Assert.assertNotNull(jobSchedulerController.get(job.getId()));
  jobDAO.deleteJob(job);
  if (cubeManager.getCube(CUBE_NAME) != null) {
    cubeManager.dropCube(CUBE_NAME,false);
  }
}
Program: 63159
Project: 63159
Buggy source:
@Override public int run(String[] args) throws Exception {
  Options options=new Options();
  try {
    options.addOption(OPTION_JOB_NAME);
    options.addOption(OPTION_TABLE_NAME);
    options.addOption(OPTION_INPUT_PATH);
    options.addOption(OPTION_INPUT_FORMAT);
    options.addOption(OPTION_INPUT_DELIM);
    options.addOption(OPTION_OUTPUT_PATH);
    parseOptions(options,args);
    job=Job.getInstance(getConf(),getOptionValue(OPTION_JOB_NAME));
    String tableName=getOptionValue(OPTION_TABLE_NAME).toUpperCase();
    Path input=new Path(getOptionValue(OPTION_INPUT_PATH));
    String inputFormat=getOptionValue(OPTION_INPUT_FORMAT);
    String inputDelim=getOptionValue(OPTION_INPUT_DELIM);
    Path output=new Path(getOptionValue(OPTION_OUTPUT_PATH));
    System.out.println("String_Node_Str" + job.getJobName());
    setupMapInput(input,inputFormat,inputDelim);
    setupReduceOutput(output);
    MetadataManager metaMgr=MetadataManager.getInstance(KylinConfig.getInstanceFromEnv());
    TableDesc table=metaMgr.getTableDesc(tableName);
    job.getConfiguration().set(BatchConstants.TABLE_NAME,tableName);
    job.getConfiguration().set(BatchConstants.TABLE_COLUMNS,getColumns(table));
    return waitForCompletion(job);
  }
 catch (  Exception e) {
    printUsage(options);
    log.error(e.getLocalizedMessage(),e);
    return 2;
  }
}

Fixed version (ground truth):
@Override public int run(String[] args) throws Exception {
  Options options=new Options();
  try {
    options.addOption(OPTION_JOB_NAME);
    options.addOption(OPTION_TABLE_NAME);
    options.addOption(OPTION_INPUT_PATH);
    options.addOption(OPTION_INPUT_FORMAT);
    options.addOption(OPTION_INPUT_DELIM);
    options.addOption(OPTION_OUTPUT_PATH);
    parseOptions(options,args);
    job=Job.getInstance(getConf(),getOptionValue(OPTION_JOB_NAME));
    String tableName=getOptionValue(OPTION_TABLE_NAME).toUpperCase();
    Path input=new Path(getOptionValue(OPTION_INPUT_PATH));
    String inputFormat=getOptionValue(OPTION_INPUT_FORMAT);
    String inputDelim=getOptionValue(OPTION_INPUT_DELIM);
    Path output=new Path(getOptionValue(OPTION_OUTPUT_PATH));
    System.out.println("String_Node_Str" + job.getJobName());
    MetadataManager metaMgr=MetadataManager.getInstance(KylinConfig.getInstanceFromEnv());
    TableDesc table=metaMgr.getTableDesc(tableName);
    job.getConfiguration().set(BatchConstants.TABLE_NAME,tableName);
    job.getConfiguration().set(BatchConstants.TABLE_COLUMNS,getColumns(table));
    setupMapInput(input,inputFormat,inputDelim);
    setupReduceOutput(output);
    return waitForCompletion(job);
  }
 catch (  Exception e) {
    printUsage(options);
    log.error(e.getLocalizedMessage(),e);
    return 2;
  }
}