nus-yam/ex-repair huggingface dataset:
Program: 7892
Project: 7892
Buggy source:
@Override public ImmutablePair<byte[],Map<byte[],byte[]>> next(){
  if (scanner == null) {
    return null;
  }
  try {
    Result result=scanner.next();
    if (result == null) {
      return null;
    }
    Map<byte[],byte[]> colValue=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
    byte[] rowKey=null;
    byte[] last=null;
    for (    KeyValue kv : result.raw()) {
      if (readPointer != null && !readPointer.isVisible(kv.getTimestamp())) {
        continue;
      }
      rowKey=kv.getKey();
      byte[] column=kv.getQualifier();
      if (Bytes.equals(column,last)) {
        continue;
      }
      byte[] value=kv.getValue();
      last=column;
      colValue.put(column,value);
    }
    if (rowKey == null) {
      return null;
    }
 else {
      return new ImmutablePair<byte[],Map<byte[],byte[]>>(rowKey,colValue);
    }
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public ImmutablePair<byte[],Map<byte[],byte[]>> next(){
  if (scanner == null) {
    return null;
  }
  try {
    Result result=scanner.next();
    if (result == null) {
      return null;
    }
    Map<byte[],byte[]> colValue=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
    byte[] rowKey=null;
    byte[] last=null;
    for (    KeyValue kv : result.raw()) {
      if (readPointer != null && !readPointer.isVisible(kv.getTimestamp())) {
        continue;
      }
      rowKey=kv.getRow();
      byte[] column=kv.getQualifier();
      if (Bytes.equals(column,last)) {
        continue;
      }
      byte[] value=kv.getValue();
      last=column;
      colValue.put(column,value);
    }
    if (rowKey == null) {
      return null;
    }
 else {
      return new ImmutablePair<byte[],Map<byte[],byte[]>>(rowKey,colValue);
    }
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
}
Program: 7893
Project: 7893
Buggy source:
@Test(timeout=20000) public void testBatchReads() throws OperationException, InterruptedException {
  final String table="String_Node_Str";
  SortedSet<Long> keysWritten=Sets.newTreeSet();
  List<WriteOperation> ops=Lists.newArrayListWithCapacity(500);
  Random rand=new Random(451);
  for (int i=0; i < 500; i++) {
    long keyLong=rand.nextLong();
    byte[] key=org.apache.hadoop.hbase.util.Bytes.toBytes(keyLong);
    ops.add(new Write(table,key,new byte[][]{c,key},new byte[][]{key,v}));
    keysWritten.add(keyLong);
  }
  local.commit(context,ops);
  OperationResult<List<KeyRange>> result=remote.execute(context,new GetSplits(table));
  Assert.assertFalse(result.isEmpty());
  List<KeyRange> splits=result.getValue();
  SortedSet<Long> keysToVerify=Sets.newTreeSet(keysWritten);
  verifySplits(table,splits,keysToVerify);
  long start=0x10000000L, stop=0x40000000L;
  result=remote.execute(context,new GetSplits(table,5,org.apache.hadoop.hbase.util.Bytes.toBytes(start),org.apache.hadoop.hbase.util.Bytes.toBytes(stop)));
  Assert.assertFalse(result.isEmpty());
  splits=result.getValue();
  Assert.assertTrue(splits.size() <= 5);
  keysToVerify=Sets.newTreeSet(keysWritten.subSet(start,stop));
  verifySplits(table,splits,keysToVerify);
}

Fixed version (ground truth):
@Test(timeout=30000) public void testBatchReads() throws OperationException, InterruptedException {
  final String table="String_Node_Str";
  SortedSet<Long> keysWritten=Sets.newTreeSet();
  List<WriteOperation> ops=Lists.newArrayListWithCapacity(500);
  Random rand=new Random(451);
  for (int i=0; i < 500; i++) {
    long keyLong=rand.nextLong();
    byte[] key=Bytes.toBytes(keyLong);
    ops.add(new Write(table,key,new byte[][]{c,key},new byte[][]{key,v}));
    keysWritten.add(keyLong);
  }
  local.commit(context,ops);
  OperationResult<List<KeyRange>> result=remote.execute(context,new GetSplits(table));
  Assert.assertFalse(result.isEmpty());
  List<KeyRange> splits=result.getValue();
  SortedSet<Long> keysToVerify=Sets.newTreeSet(keysWritten);
  verifySplits(table,splits,keysToVerify);
  long start=0x10000000L, stop=0x40000000L;
  result=remote.execute(context,new GetSplits(table,5,Bytes.toBytes(start),Bytes.toBytes(stop)));
  Assert.assertFalse(result.isEmpty());
  splits=result.getValue();
  Assert.assertTrue(splits.size() <= 5);
  keysToVerify=Sets.newTreeSet(keysWritten.subSet(start,stop));
  verifySplits(table,splits,keysToVerify);
}
Program: 7894
Project: 7894
Buggy source:
@Override public MapReduceManager startMapReduce(final String jobName,Map<String,String> arguments){
  try {
    final FlowIdentifier jobId=new FlowIdentifier(accountId,applicationId,jobName,0);
    jobId.setType(EntityType.QUERY);
    if (!isRunning(jobId)) {
      runningProcessses.remove(jobName);
    }
    Preconditions.checkState(runningProcessses.putIfAbsent(jobName,jobId) == null,"String_Node_Str",jobName);
    try {
      appFabricServer.start(token,new FlowDescriptor(jobId,arguments));
    }
 catch (    Exception e) {
      runningProcessses.remove(jobName);
      throw Throwables.propagate(e);
    }
    return new MapReduceManager(){
      @Override public void stop(){
        try {
          if (runningProcessses.remove(jobName,jobId)) {
            appFabricServer.stop(token,jobId);
          }
        }
 catch (        Exception e) {
          throw Throwables.propagate(e);
        }
      }
      @Override public void waitForFinish(      long timeout,      TimeUnit timeoutUnit) throws TimeoutException, InterruptedException {
        while (timeout > 0 && isRunning(jobId)) {
          timeoutUnit.sleep(1);
          timeout--;
        }
        if (timeout == 0 && isRunning(jobId)) {
          throw new TimeoutException("String_Node_Str");
        }
      }
    }
;
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public MapReduceManager startMapReduce(final String jobName,Map<String,String> arguments){
  try {
    final FlowIdentifier jobId=new FlowIdentifier(accountId,applicationId,jobName,0);
    jobId.setType(EntityType.MAPREDUCE);
    if (!isRunning(jobId)) {
      runningProcessses.remove(jobName);
    }
    Preconditions.checkState(runningProcessses.putIfAbsent(jobName,jobId) == null,"String_Node_Str",jobName);
    try {
      appFabricServer.start(token,new FlowDescriptor(jobId,arguments));
    }
 catch (    Exception e) {
      runningProcessses.remove(jobName);
      throw Throwables.propagate(e);
    }
    return new MapReduceManager(){
      @Override public void stop(){
        try {
          if (runningProcessses.remove(jobName,jobId)) {
            appFabricServer.stop(token,jobId);
          }
        }
 catch (        Exception e) {
          throw Throwables.propagate(e);
        }
      }
      @Override public void waitForFinish(      long timeout,      TimeUnit timeoutUnit) throws TimeoutException, InterruptedException {
        while (timeout > 0 && isRunning(jobId)) {
          timeoutUnit.sleep(1);
          timeout--;
        }
        if (timeout == 0 && isRunning(jobId)) {
          throw new TimeoutException("String_Node_Str");
        }
      }
    }
;
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 7895
Project: 7895
Buggy source:
public static Location deployApplication(AppFabricService.Iface appFabricServer,LocationFactory locationFactory,final String account,final AuthToken token,final String applicationId,final String fileName,Class<? extends Application> applicationClz) throws Exception {
  Preconditions.checkNotNull(applicationClz,"String_Node_Str");
  Application application=applicationClz.newInstance();
  ApplicationSpecification appSpec=application.configure();
  Location deployedJar=locationFactory.create(createDeploymentJar(applicationClz,appSpec).getAbsolutePath());
  try {
    ResourceIdentifier id=appFabricServer.init(token,new ResourceInfo(account,applicationId,fileName,0,System.currentTimeMillis()));
    BufferFileInputStream is=new BufferFileInputStream(deployedJar.getInputStream(),100 * 1024);
    try {
      byte[] chunk=is.read();
      while (chunk.length > 0) {
        appFabricServer.chunk(token,id,ByteBuffer.wrap(chunk));
        chunk=is.read();
        DeploymentStatus status=appFabricServer.dstatus(token,id);
        Preconditions.checkState(status.getOverall() == 2,"String_Node_Str");
      }
    }
  finally {
      is.close();
    }
    appFabricServer.deploy(token,id);
    int status=appFabricServer.dstatus(token,id).getOverall();
    while (status == 3) {
      status=appFabricServer.dstatus(token,id).getOverall();
      TimeUnit.MILLISECONDS.sleep(100);
    }
    Preconditions.checkState(status == 5,"String_Node_Str");
  }
  finally {
    deployedJar.delete(true);
  }
  return deployedJar;
}

Fixed version (ground truth):
private static Location deployApplication(AppFabricService.Iface appFabricServer,LocationFactory locationFactory,final String account,final AuthToken token,final String applicationId,final String fileName,Class<? extends Application> applicationClz) throws Exception {
  Preconditions.checkNotNull(applicationClz,"String_Node_Str");
  Application application=applicationClz.newInstance();
  ApplicationSpecification appSpec=application.configure();
  Location deployedJar=locationFactory.create(createDeploymentJar(applicationClz,appSpec).getAbsolutePath());
  ResourceIdentifier id=appFabricServer.init(token,new ResourceInfo(account,applicationId,fileName,0,System.currentTimeMillis()));
  BufferFileInputStream is=new BufferFileInputStream(deployedJar.getInputStream(),100 * 1024);
  try {
    byte[] chunk=is.read();
    while (chunk.length > 0) {
      appFabricServer.chunk(token,id,ByteBuffer.wrap(chunk));
      chunk=is.read();
      DeploymentStatus status=appFabricServer.dstatus(token,id);
      Preconditions.checkState(status.getOverall() == 2,"String_Node_Str");
    }
  }
  finally {
    is.close();
  }
  appFabricServer.deploy(token,id);
  int status=appFabricServer.dstatus(token,id).getOverall();
  while (status == 3) {
    status=appFabricServer.dstatus(token,id).getOverall();
    TimeUnit.MILLISECONDS.sleep(100);
  }
  Preconditions.checkState(status == 5,"String_Node_Str");
  return deployedJar;
}
Program: 7896
Project: 7896
Buggy source:
@Override public FlowManager startFlow(final String flowName,Map<String,String> arguments){
  try {
    final FlowIdentifier flowId=new FlowIdentifier(accountId,applicationId,flowName,0);
    Preconditions.checkState(runningProcessses.putIfAbsent(flowName,flowId) == null,"String_Node_Str",flowName);
    try {
    }
 catch (    Exception e) {
      runningProcessses.remove(flowName);
      throw Throwables.propagate(e);
    }
    return new FlowManager(){
      @Override public void setFlowletInstances(      String flowletName,      int instances){
        Preconditions.checkArgument(instances > 0,"String_Node_Str");
        try {
          appFabricServer.setInstances(token,flowId,flowletName,(short)instances);
        }
 catch (        Exception e) {
          throw Throwables.propagate(e);
        }
      }
      @Override public void stop(){
        try {
          if (runningProcessses.remove(flowName,flowId)) {
            appFabricServer.stop(token,flowId);
          }
        }
 catch (        Exception e) {
          throw Throwables.propagate(e);
        }
      }
    }
;
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public FlowManager startFlow(final String flowName,Map<String,String> arguments){
  try {
    final FlowIdentifier flowId=new FlowIdentifier(accountId,applicationId,flowName,0);
    Preconditions.checkState(runningProcessses.putIfAbsent(flowName,flowId) == null,"String_Node_Str",flowName);
    try {
      appFabricServer.start(token,new FlowDescriptor(flowId,arguments));
    }
 catch (    Exception e) {
      runningProcessses.remove(flowName);
      throw Throwables.propagate(e);
    }
    return new FlowManager(){
      @Override public void setFlowletInstances(      String flowletName,      int instances){
        Preconditions.checkArgument(instances > 0,"String_Node_Str");
        try {
          appFabricServer.setInstances(token,flowId,flowletName,(short)instances);
        }
 catch (        Exception e) {
          throw Throwables.propagate(e);
        }
      }
      @Override public void stop(){
        try {
          if (runningProcessses.remove(flowName,flowId)) {
            appFabricServer.stop(token,flowId);
          }
        }
 catch (        Exception e) {
          throw Throwables.propagate(e);
        }
      }
    }
;
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 7899
Project: 7899
Buggy source:
/** 
 * Check whether the Http return code is positive. If not, print the error message and return false. Otherwise, if verbose is on, print the response status line.
 * @param response the HTTP response
 * @return whether the response indicates success
 */
boolean checkHttpStatus(HttpResponse response){
  try {
    if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
      String reason=response.getEntity().getContent() == null ? null : IOUtils.toString(response.getEntity().getContent());
      if (verbose) {
        System.out.println(response.getStatusLine());
        if (reason != null) {
          System.out.println(reason);
        }
      }
 else {
        if (reason != null) {
          System.err.println(response.getStatusLine().getReasonPhrase() + "String_Node_Str" + reason);
        }
 else {
          System.err.println(response.getStatusLine().getReasonPhrase());
        }
      }
      return false;
    }
    if (verbose) {
      System.out.println(response.getStatusLine());
    }
    return true;
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Check whether the Http return code is positive. If not, print the error message and return false. Otherwise, if verbose is on, print the response status line.
 * @param response the HTTP response
 * @return whether the response indicates success
 */
boolean checkHttpStatus(HttpResponse response){
  try {
    if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
      String reason=response.getEntity().getContent() == null ? null : IOUtils.toString(response.getEntity().getContent());
      if (verbose) {
        System.out.println(response.getStatusLine());
        if (reason != null && !reason.isEmpty()) {
          System.out.println(reason);
        }
      }
 else {
        if (reason != null && !reason.isEmpty()) {
          System.err.println(response.getStatusLine().getReasonPhrase() + "String_Node_Str" + reason);
        }
 else {
          System.err.println(response.getStatusLine().getReasonPhrase());
        }
      }
      return false;
    }
    if (verbose) {
      System.out.println(response.getStatusLine());
    }
    return true;
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    return false;
  }
}
Program: 7902
Project: 7902
Buggy source:
Manager<?,?> create();

Fixed version (ground truth):
<U,V>Manager<U,V> create();
Program: 7903
Project: 7903
Buggy source:
/** 
 * Creates new application if it doesn't exist. Updates existing one otherwise.
 * @param id            application id
 * @param specification application specification to store
 * @param appArchiveLocation location of the deployed app archive
 * @throws OperationException
 */
void addApplication(Id.Application id,ApplicationSpecification specification,com.continuuity.weave.filesystem.Location appArchiveLocation) throws OperationException ;

Fixed version (ground truth):
/** 
 * Creates new application if it doesn't exist. Updates existing one otherwise.
 * @param id            application id
 * @param specification application specification to store
 * @param appArchiveLocation location of the deployed app archive
 * @throws OperationException
 */
void addApplication(Id.Application id,ApplicationSpecification specification,Location appArchiveLocation) throws OperationException ;
Program: 7904
Project: 7904
Buggy source:
/** 
 * Creates a JarResources using a   {@link Location}. It extracts all resources from a Jar into a internal map, keyed by resource names.
 * @param jar location of JAR file.
 * @throws IOException
 */
public JarResources(com.continuuity.weave.filesystem.Location jar) throws IOException {
  manifest=init(jar);
}

Fixed version (ground truth):
/** 
 * Creates a JarResources using a   {@link Location}. It extracts all resources from a Jar into a internal map, keyed by resource names.
 * @param jar location of JAR file.
 * @throws IOException
 */
public JarResources(Location jar) throws IOException {
  manifest=init(jar);
}
Program: 7905
Project: 7905
Buggy source:
/** 
 * Executes the <code>Application.configure</code> within the same JVM. <p> This method could be dangerous and should be used only in singlenode. </p>
 * @return A instance of {@link ListenableFuture}.
 */
@Override public ListenableFuture<ConfigResponse> config(){
  StringWriter writer=null;
  SettableFuture result=SettableFuture.create();
  try {
    Application app=null;
    if (archive != null && application == null) {
      Object mainClass=new Archive(id,archive).getMainClass().newInstance();
      app=(Application)mainClass;
    }
 else     if (application != null && archive == null) {
      app=application;
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
    ApplicationSpecification specification=app.configure();
    writer=new StringWriter();
    ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(specification,writer);
    result.set(new DefaultConfigResponse(0,newStringStream(writer.toString())));
  }
 catch (  Exception e) {
    LOG.debug(StackTraceUtil.toStringStackTrace(e));
    return Futures.immediateFailedFuture(e);
  }
catch (  Throwable throwable) {
    LOG.debug(StackTraceUtil.toStringStackTrace(throwable));
    return Futures.immediateFailedFuture(throwable);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        LOG.debug(StackTraceUtil.toStringStackTrace(e));
        return Futures.immediateFailedFuture(e);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Executes the <code>Application.configure</code> within the same JVM. <p> This method could be dangerous and should be used only in singlenode. </p>
 * @return A instance of {@link ListenableFuture}.
 */
@Override public ListenableFuture<ConfigResponse> config(){
  StringWriter writer=null;
  SettableFuture result=SettableFuture.create();
  try {
    Application app;
    if (archive != null && application == null) {
      Object mainClass=new Archive(id,archive).getMainClass().newInstance();
      app=(Application)mainClass;
    }
 else     if (application != null && archive == null) {
      app=application;
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
    ApplicationSpecification specification=app.configure();
    writer=new StringWriter();
    ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(specification,writer);
    result.set(new DefaultConfigResponse(0,newStringStream(writer.toString())));
  }
 catch (  Throwable t) {
    LOG.error(t.getMessage(),t);
    return Futures.immediateFailedFuture(t);
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException e) {
        LOG.debug(StackTraceUtil.toStringStackTrace(e));
        return Futures.immediateFailedFuture(e);
      }
    }
  }
  return result;
}
Program: 7906
Project: 7906
Buggy source:
/** 
 * Constructs the object with identifier and resource info provided.
 * @param info about the resource being uploaded.
 */
public SessionInfo(ResourceIdentifier identifier,ResourceInfo info,com.continuuity.weave.filesystem.Location archive,DeployStatus status){
  this.identifier=identifier;
  this.regtime=System.currentTimeMillis() / 1000;
  this.filename=info.getFilename();
  this.size=info.getSize();
  this.archive=archive;
  this.status=status;
}

Fixed version (ground truth):
/** 
 * Constructs the object with identifier and resource info provided.
 * @param info about the resource being uploaded.
 */
public SessionInfo(ResourceIdentifier identifier,ResourceInfo info,Location archive,DeployStatus status){
  this.identifier=identifier;
  this.regtime=System.currentTimeMillis() / 1000;
  this.filename=info.getFilename();
  this.size=info.getSize();
  this.archive=archive;
  this.status=status;
}
Program: 7907
Project: 7907
Buggy source:
/** 
 * Returns location of the resource.
 * @return Location to the resource.
 */
public com.continuuity.weave.filesystem.Location getArchiveLocation(){
  return archive;
}

Fixed version (ground truth):
/** 
 * Returns location of the resource.
 * @return Location to the resource.
 */
public Location getArchiveLocation(){
  return archive;
}
Program: 7908
Project: 7908
Buggy source:
/** 
 * Creates a   {@link com.continuuity.internal.app.deploy.InMemoryConfigurator} to run throughthe process of generation of  {@link ApplicationSpecification}
 * @param archive Location of archive.
 */
@Override public void process(com.continuuity.weave.filesystem.Location archive) throws Exception {
  InMemoryConfigurator inMemoryConfigurator=new InMemoryConfigurator(id,archive);
  ListenableFuture<ConfigResponse> result=inMemoryConfigurator.config();
  ConfigResponse response=result.get(120,TimeUnit.SECONDS);
  ApplicationSpecification specification=adapter.fromJson(response.get());
  Id.Application appId=Id.Application.from(id,specification.getName());
  emit(new ApplicationSpecLocation(appId,specification,archive));
}

Fixed version (ground truth):
/** 
 * Creates a   {@link com.continuuity.internal.app.deploy.InMemoryConfigurator} to run throughthe process of generation of  {@link ApplicationSpecification}
 * @param archive Location of archive.
 */
@Override public void process(Location archive) throws Exception {
  InMemoryConfigurator inMemoryConfigurator=new InMemoryConfigurator(id,archive);
  ListenableFuture<ConfigResponse> result=inMemoryConfigurator.config();
  ConfigResponse response=result.get(120,TimeUnit.SECONDS);
  ApplicationSpecification specification=adapter.fromJson(response.get());
  Id.Application appId=Id.Application.from(id,specification.getName());
  emit(new ApplicationSpecLocation(appId,specification,archive));
}
Program: 7910
Project: 7910
Buggy source:
public ProgramGenerationStage(Configuration configuration,com.continuuity.weave.filesystem.LocationFactory locationFactory){
  super(TypeToken.of(ApplicationSpecLocation.class));
  this.configuration=configuration;
  this.locationFactory=locationFactory;
}

Fixed version (ground truth):
public ProgramGenerationStage(Configuration configuration,LocationFactory locationFactory){
  super(TypeToken.of(ApplicationSpecLocation.class));
  this.configuration=configuration;
  this.locationFactory=locationFactory;
}
Program: 7912
Project: 7912
Buggy source:
private void logProcessed(){
  String[] flowlets={"String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String flowlet : flowlets)   LOG.info("String_Node_Str" + flowlet + "String_Node_Str"+ BenchmarkRuntimeStats.getFlowletMetrics(appName,flowName,flowlet).getProcessed());
}

Fixed version (ground truth):
private void logProcessed(){
  String[] flowlets={"String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String flowlet : flowlets) {
    LOG.info("String_Node_Str" + flowlet + "String_Node_Str"+ BenchmarkRuntimeStats.getFlowletMetrics(appName,flowName,flowlet).getProcessed());
  }
}
Program: 7914
Project: 7914
Buggy source:
private List<Split> getInputSelection(){
  String splitClassName=jobContext.getConfiguration().get(HCONF_ATTR_INPUT_SPLIT_CLASS);
  String splitsJson=jobContext.getConfiguration().get(HCONF_ATTR_INPUT_SPLITS);
  try {
    @SuppressWarnings("String_Node_Str") Class<? extends Split> splitClass=(Class<? extends Split>)Class.forName(splitClassName);
    return new Gson().fromJson(splitsJson,new ListSplitType(splitClass));
  }
 catch (  ClassNotFoundException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private List<Split> getInputSelection(){
  String splitClassName=jobContext.getConfiguration().get(HCONF_ATTR_INPUT_SPLIT_CLASS);
  String splitsJson=jobContext.getConfiguration().get(HCONF_ATTR_INPUT_SPLITS);
  try {
    @SuppressWarnings("String_Node_Str") Class<? extends Split> splitClass=(Class<? extends Split>)jobContext.getConfiguration().getClassLoader().loadClass(splitClassName);
    return new Gson().fromJson(splitsJson,new ListSplitType(splitClass));
  }
 catch (  ClassNotFoundException e) {
    throw Throwables.propagate(e);
  }
}
Program: 7915
Project: 7915
Buggy source:
private void submit(final MapReduce job,Location jobJarLocation,final BasicMapReduceContext context) throws Exception {
  jobConf=Job.getInstance(hConf);
  context.setJob(jobConf);
  job.beforeSubmit(context);
  wrapMapperClassIfNeeded(jobConf);
  wrapReducerClassIfNeeded(jobConf);
  DataSet inputDataset=setInputDataSetIfNeeded(jobConf,context);
  DataSet outputDataset=setOutputDataSetIfNeeded(jobConf,context);
  boolean useDataSetAsInputOrOutput=inputDataset != null || outputDataset != null;
  if (useDataSetAsInputOrOutput) {
    MapReduceContextProvider contextProvider=new MapReduceContextProvider(jobConf);
    contextProvider.set(context,cConf);
  }
  addContinuuityJarsToClasspath(jobConf);
  jobConf.setJar(jobJarLocation.toURI().getPath());
  new Thread(){
    @Override public void run(){
      boolean success=false;
      try {
        LoggingContextAccessor.setLoggingContext(context.getLoggingContext());
        try {
          LOG.info("String_Node_Str",context.toString());
          success=jobConf.waitForCompletion(true);
        }
 catch (        InterruptedException e) {
          throw Throwables.propagate(e);
        }
catch (        Exception e) {
          throw Throwables.propagate(e);
        }
        job.onFinish(success,context);
      }
 catch (      Exception e) {
        throw Throwables.propagate(e);
      }
 finally {
        stopController(success);
      }
    }
  }
.start();
}

Fixed version (ground truth):
private void submit(final MapReduce job,Location jobJarLocation,final BasicMapReduceContext context) throws Exception {
  jobConf=Job.getInstance(hConf);
  context.setJob(jobConf);
  job.beforeSubmit(context);
  wrapMapperClassIfNeeded(jobConf);
  wrapReducerClassIfNeeded(jobConf);
  DataSet inputDataset=setInputDataSetIfNeeded(jobConf,context);
  DataSet outputDataset=setOutputDataSetIfNeeded(jobConf,context);
  boolean useDataSetAsInputOrOutput=inputDataset != null || outputDataset != null;
  if (useDataSetAsInputOrOutput) {
    MapReduceContextProvider contextProvider=new MapReduceContextProvider(jobConf);
    contextProvider.set(context,cConf);
  }
  addContinuuityJarsToClasspath(jobConf);
  jobConf.setJar(jobJarLocation.toURI().getPath());
  jobConf.getConfiguration().setClassLoader(context.getProgram().getClassLoader());
  new Thread(){
    @Override public void run(){
      boolean success=false;
      try {
        LoggingContextAccessor.setLoggingContext(context.getLoggingContext());
        try {
          LOG.info("String_Node_Str",context.toString());
          success=jobConf.waitForCompletion(true);
        }
 catch (        InterruptedException e) {
          throw Throwables.propagate(e);
        }
catch (        Exception e) {
          throw Throwables.propagate(e);
        }
        job.onFinish(success,context);
      }
 catch (      Exception e) {
        throw Throwables.propagate(e);
      }
 finally {
        stopController(success);
      }
    }
  }
.start();
}
Program: 7916
Project: 7916
Buggy source:
@Override public void readFields(final DataInput in) throws IOException {
  try {
    Class<? extends Split> splitClass=(Class<Split>)Class.forName(Text.readString(in));
    split=new Gson().fromJson(Text.readString(in),splitClass);
  }
 catch (  ClassNotFoundException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public void readFields(final DataInput in) throws IOException {
  try {
    ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
    if (classLoader == null) {
      classLoader=getClass().getClassLoader();
    }
    Class<? extends Split> splitClass=(Class<Split>)classLoader.loadClass(Text.readString(in));
    split=new Gson().fromJson(Text.readString(in),splitClass);
  }
 catch (  ClassNotFoundException e) {
    throw Throwables.propagate(e);
  }
}
Program: 7917
Project: 7917
Buggy source:
@Override public void run(Context context) throws IOException, InterruptedException {
  String userMapper=context.getConfiguration().get(ATTR_MAPPER_CLASS);
  Mapper delegate=createMapperInstance(userMapper);
  MapReduceContextProvider mrContextProvider=new MapReduceContextProvider(context);
  BasicMapReduceContext basicMapReduceContext=mrContextProvider.get();
  basicMapReduceContext.injectFields(delegate);
  LoggingContextAccessor.setLoggingContext(basicMapReduceContext.getLoggingContext());
  delegate.run(context);
}

Fixed version (ground truth):
@Override public void run(Context context) throws IOException, InterruptedException {
  String userMapper=context.getConfiguration().get(ATTR_MAPPER_CLASS);
  Mapper delegate=createMapperInstance(context,userMapper);
  MapReduceContextProvider mrContextProvider=new MapReduceContextProvider(context);
  BasicMapReduceContext basicMapReduceContext=mrContextProvider.get();
  basicMapReduceContext.injectFields(delegate);
  LoggingContextAccessor.setLoggingContext(basicMapReduceContext.getLoggingContext());
  delegate.run(context);
}
Program: 7918
Project: 7918
Buggy source:
private Mapper createMapperInstance(String userMapper){
  try {
    return (Mapper)Class.forName(userMapper).newInstance();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + userMapper);
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private Mapper createMapperInstance(Context context,String userMapper){
  try {
    return (Mapper)context.getConfiguration().getClassLoader().loadClass(userMapper).newInstance();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + userMapper);
    throw Throwables.propagate(e);
  }
}
Program: 7919
Project: 7919
Buggy source:
@Override public void run(Context context) throws IOException, InterruptedException {
  String userReducer=context.getConfiguration().get(ATTR_REDUCER_CLASS);
  Reducer delegate=createReducerInstance(userReducer);
  MapReduceContextProvider mrContextProvider=new MapReduceContextProvider(context);
  BasicMapReduceContext basicMapReduceContext=mrContextProvider.get();
  basicMapReduceContext.injectFields(delegate);
  LoggingContextAccessor.setLoggingContext(basicMapReduceContext.getLoggingContext());
  delegate.run(context);
}

Fixed version (ground truth):
@Override public void run(Context context) throws IOException, InterruptedException {
  String userReducer=context.getConfiguration().get(ATTR_REDUCER_CLASS);
  Reducer delegate=createReducerInstance(context,userReducer);
  MapReduceContextProvider mrContextProvider=new MapReduceContextProvider(context);
  BasicMapReduceContext basicMapReduceContext=mrContextProvider.get();
  basicMapReduceContext.injectFields(delegate);
  LoggingContextAccessor.setLoggingContext(basicMapReduceContext.getLoggingContext());
  delegate.run(context);
}
Program: 7920
Project: 7920
Buggy source:
private Reducer createReducerInstance(String userReducer){
  try {
    return (Reducer)Class.forName(userReducer).newInstance();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + userReducer);
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private Reducer createReducerInstance(Context context,String userReducer){
  try {
    return (Reducer)context.getConfiguration().getClassLoader().loadClass(userReducer).newInstance();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + userReducer);
    throw Throwables.propagate(e);
  }
}
Program: 7921
Project: 7921
Buggy source:
public Job(JobID jobid,String jobSubmitDir) throws IOException {
  this.systemJobDir=new Path(jobSubmitDir);
  this.systemJobFile=new Path(systemJobDir,"String_Node_Str");
  this.id=jobid;
  JobConf conf=new JobConf(systemJobFile);
  this.localFs=FileSystem.getLocal(conf);
  this.localJobDir=localFs.makeQualified(conf.getLocalPath(jobDir));
  this.localJobFile=new Path(this.localJobDir,id + "String_Node_Str");
  localDistributedCacheManager=new LocalDistributedCacheManager();
  localDistributedCacheManager.setup(conf);
  OutputStream out=localFs.create(localJobFile);
  try {
    conf.writeXml(out);
  }
  finally {
    out.close();
  }
  this.job=new JobConf(localJobFile);
  if (localDistributedCacheManager.hasLocalClasspaths()) {
    ClassLoader classLoader=localDistributedCacheManager.makeClassLoader(getContextClassLoader());
    setContextClassLoader(classLoader);
    this.job.setClassLoader(classLoader);
  }
  profile=new JobProfile(job.getUser(),id,systemJobFile.toString(),"String_Node_Str",job.getJobName());
  status=new JobStatus(id,0.0f,0.0f,JobStatus.RUNNING,profile.getUser(),profile.getJobName(),profile.getJobFile(),profile.getURL().toString());
  jobs.put(id,this);
  this.start();
}

Fixed version (ground truth):
public Job(JobID jobid,String jobSubmitDir) throws IOException {
  this.systemJobDir=new Path(jobSubmitDir);
  this.systemJobFile=new Path(systemJobDir,"String_Node_Str");
  this.id=jobid;
  JobConf conf=new JobConf(systemJobFile);
  this.localFs=FileSystem.getLocal(conf);
  this.localJobDir=localFs.makeQualified(conf.getLocalPath(jobDir));
  this.localJobFile=new Path(this.localJobDir,id + "String_Node_Str");
  DistributedCache.addFileToClassPath(new Path(conf.getJar()),conf,FileSystem.get(conf));
  ClientDistributedCacheManager.determineTimestampsAndCacheVisibilities(conf);
  localDistributedCacheManager=new LocalDistributedCacheManager();
  localDistributedCacheManager.setup(conf);
  OutputStream out=localFs.create(localJobFile);
  try {
    conf.writeXml(out);
  }
  finally {
    out.close();
  }
  this.job=new JobConf(localJobFile);
  if (localDistributedCacheManager.hasLocalClasspaths()) {
    ClassLoader classLoader=localDistributedCacheManager.makeClassLoader(getContextClassLoader());
    setContextClassLoader(classLoader);
    this.job.setClassLoader(classLoader);
  }
  profile=new JobProfile(job.getUser(),id,systemJobFile.toString(),"String_Node_Str",job.getJobName());
  status=new JobStatus(id,0.0f,0.0f,JobStatus.RUNNING,profile.getUser(),profile.getJobName(),profile.getJobFile(),profile.getURL().toString());
  jobs.put(id,this);
  this.start();
}
Program: 7922
Project: 7922
Buggy source:
@Override public Scanner scan(ReadPointer readPointer){
  return new MemoryScanner(this.map.entrySet().iterator(),readPointer);
}

Fixed version (ground truth):
@Override public Scanner scan(byte[] startRow,byte[] stopRow,byte[][] columns,ReadPointer readPointer){
  ConcurrentNavigableMap<RowLockTable.Row,NavigableMap<Column,NavigableMap<Version,Value>>> submap;
  if (startRow != null) {
    if (stopRow != null) {
      submap=this.map.subMap(new RowLockTable.Row(startRow),new RowLockTable.Row(stopRow));
    }
 else {
      submap=this.map.tailMap(new RowLockTable.Row(startRow));
    }
  }
 else {
    if (stopRow != null) {
      submap=this.map.headMap(new RowLockTable.Row(stopRow));
    }
 else {
      submap=this.map;
    }
  }
  return new MemoryScanner(submap.entrySet().iterator(),columns,readPointer);
}
Program: 7923
Project: 7923
Buggy source:
@BeforeClass public static void configure() throws Exception {
  DataSet kv=new Table("String_Node_Str");
  DataSet t1=new Table("String_Node_Str");
  DataSet t2=new Table("String_Node_Str");
  DataSet t3=new Table("String_Node_Str");
  DataSet t4=new Table("String_Node_Str");
  setupInstantiator(Lists.newArrayList(kv,t1,t2,t3,t4));
  table=instantiator.getDataSet("String_Node_Str");
}

Fixed version (ground truth):
@BeforeClass public static void configure() throws Exception {
  DataSet kv=new Table("String_Node_Str");
  DataSet t1=new Table("String_Node_Str");
  DataSet t2=new Table("String_Node_Str");
  DataSet t3=new Table("String_Node_Str");
  DataSet t4=new Table("String_Node_Str");
  DataSet tBatch=new Table("String_Node_Str");
  setupInstantiator(Lists.newArrayList(kv,t1,t2,t3,t4,tBatch));
  table=instantiator.getDataSet("String_Node_Str");
}
Program: 7924
Project: 7924
Buggy source:
/** 
 * Sets up the in-memory operation executor and the data fabric
 */
@BeforeClass public static void setupDataFabric(){
  final Injector injector=Guice.createInjector(new DataFabricLocalModule("String_Node_Str",null));
  opex=injector.getInstance(OperationExecutor.class);
  fabric=new DataFabricImpl(opex,OperationUtil.DEFAULT);
}

Fixed version (ground truth):
/** 
 * Sets up the in-memory operation executor and the data fabric
 */
@BeforeClass public static void setupDataFabric(){
  final Injector injector=Guice.createInjector(new DataFabricModules().getInMemoryModules());
  opex=injector.getInstance(OperationExecutor.class);
  fabric=new DataFabricImpl(opex,OperationUtil.DEFAULT);
}
Program: 7925
Project: 7925
Buggy source:
/** 
 * Add 1 to the number of failed operations
 */
protected void failedOne(){
  failed.incrementAndGet();
}

Fixed version (ground truth):
/** 
 * Add 1 to the number of failed operations.
 */
protected void failedOne(){
  failed.incrementAndGet();
}
Program: 7926
Project: 7926
Buggy source:
/** 
 * Add a delta to the number of succeeded operations
 * @param count how many operations succeeded
 */
protected void succeededSome(int count){
  succeeded.addAndGet(count);
}

Fixed version (ground truth):
/** 
 * Add a delta to the number of succeeded operations.
 * @param count how many operations succeeded
 */
protected void succeededSome(int count){
  succeeded.addAndGet(count);
}
Program: 7927
Project: 7927
Buggy source:
/** 
 * Add 1 to the number of succeeded operations
 */
protected void succeededOne(){
  succeeded.incrementAndGet();
}

Fixed version (ground truth):
/** 
 * Add 1 to the number of succeeded operations.
 */
protected void succeededOne(){
  succeeded.incrementAndGet();
}
Program: 7928
Project: 7928
Buggy source:
/** 
 * Add a delta to the number of failed operations
 * @param count how many operations failed
 */
protected void failedSome(int count){
  failed.addAndGet(count);
}

Fixed version (ground truth):
/** 
 * Add a delta to the number of failed operations.
 * @param count how many operations failed
 */
protected void failedSome(int count){
  failed.addAndGet(count);
}
Program: 7929
Project: 7929
Buggy source:
/** 
 * Start a client-side transaction
 * @return the new transaction
 */
public Transaction startTransaction(OperationContext context) throws OperationException ;

Fixed version (ground truth):
/** 
 * Start a client-side transaction.
 * @return the new transaction
 */
public Transaction startTransaction(OperationContext context) throws OperationException ;
Program: 7930
Project: 7930
Buggy source:
/** 
 * Abort an existing transaction
 * @param context the operation context
 * @param transaction the transaction to be committed
 * @throws OperationException if the abort fails for any reason
 */
public void abort(OperationContext context,Transaction transaction) throws OperationException ;

Fixed version (ground truth):
/** 
 * Abort an existing transaction.
 * @param context the operation context
 * @param transaction the transaction to be committed
 * @throws OperationException if the abort fails for any reason
 */
public void abort(OperationContext context,Transaction transaction) throws OperationException ;
Program: 7931
Project: 7931
Buggy source:
/** 
 * Set the limit for the number of deferred operations May not be called after the transaction has started
 * @param countLimit the new limit
 */
public void setCountLimit(int countLimit){
  if (this.state != State.New) {
    throw new IllegalStateException("String_Node_Str");
  }
  this.countLimit=countLimit;
}

Fixed version (ground truth):
/** 
 * Set the limit for the number of deferred operations. May not be called after the transaction has started.
 * @param countLimit the new limit
 */
public void setCountLimit(int countLimit){
  if (this.state != State.New) {
    throw new IllegalStateException("String_Node_Str");
  }
  this.countLimit=countLimit;
}
Program: 7932
Project: 7932
Buggy source:
/** 
 * return the number of operations that failed in this transaction
 * @return the number of operations
 */
public int getFailedCount();

Fixed version (ground truth):
/** 
 * return the number of operations that failed in this transaction.
 * @return the number of operations
 */
public int getFailedCount();
Program: 7933
Project: 7933
Buggy source:
/** 
 * return the number of operations performed successfully in this transaction
 * @return the number of operations
 */
public int getSucceededCount();

Fixed version (ground truth):
/** 
 * return the number of operations performed successfully in this transaction.
 * @return the number of operations
 */
public int getSucceededCount();
Program: 7934
Project: 7934
Buggy source:
/** 
 * Returns the write version
 * @return write version
 */
long getWriteVersion();

Fixed version (ground truth):
/** 
 * Returns the write version.
 * @return write version
 */
long getWriteVersion();
Program: 7935
Project: 7935
Buggy source:
/** 
 * Get an instance of the named data set
 * @param name the name of the data set
 * @param < T > the type of the data set
 * @return a new instance of the named data set
 * @throws DataSetInstantiationException if for any reason, the data setcannot be instantiated, for instance, its class cannot be loaded, its class is missing the runtime constructor (@see Dataset#DataSet(DataSetSpecification)), or the constructor throws an exception. Also if a data set cannot be opened, for instance, if we fail to access one of the underlying Tables in the data fabric.
 */
public <T extends DataSet>T getDataSet(String name) throws DataSetInstantiationException ;

Fixed version (ground truth):
/** 
 * Get an instance of the named data set.
 * @param name the name of the data set
 * @param < T > the type of the data set
 * @return a new instance of the named data set
 * @throws DataSetInstantiationException if for any reason, the data setcannot be instantiated, for instance, its class cannot be loaded, its class is missing the runtime constructor (@see Dataset#DataSet(DataSetSpecification)), or the constructor throws an exception. Also if a data set cannot be opened, for instance, if we fail to access one of the underlying Tables in the data fabric.
 */
public <T extends DataSet>T getDataSet(String name) throws DataSetInstantiationException ;
Program: 7936
Project: 7936
Buggy source:
/** 
 * whether this is a read-only instantiation
 */
public boolean isReadOnly(){
  return readOnly;
}

Fixed version (ground truth):
/** 
 * Whether this is a read-only instantiation.
 */
public boolean isReadOnly(){
  return readOnly;
}
Program: 7937
Project: 7937
Buggy source:
/** 
 * Find out whether the instantiator has a spec for a named data set
 * @param name the name of the data set
 * @return whether the instantiator knows the spec for the data set
 */
public boolean hasDataSet(String name){
  return this.datasets.containsKey(name);
}

Fixed version (ground truth):
/** 
 * Find out whether the instantiator has a spec for a named data set.
 * @param name the name of the data set
 * @return whether the instantiator knows the spec for the data set
 */
public boolean hasDataSet(String name){
  return this.datasets.containsKey(name);
}
Program: 7938
Project: 7938
Buggy source:
/** 
 * helper method to cast the created data set object to its correct class. This method is to isolate the unchecked cast (it has to be unchecked because T is a type parameter, we cannot do instanceof or isAssignableFrom on type parameters...) into a small method, that we can annotate with a SuppressWarnings of small scope.
 * @param o The object to be cast
 * @param className the name of the class of that object, for error messages
 * @param < T > The type to cast to
 * @return The cast object of type T
 * @throws DataSetInstantiationException if the cast fails.
 */
@SuppressWarnings("String_Node_Str") private <T extends DataSet>T convert(Object o,String className) throws DataSetInstantiationException {
  try {
    return (T)o;
  }
 catch (  ClassCastException e) {
    throw logAndException(e,"String_Node_Str",className);
  }
}

Fixed version (ground truth):
/** 
 * Helper method to cast the created data set object to its correct class. This method is to isolate the unchecked cast (it has to be unchecked because T is a type parameter, we cannot do instanceof or isAssignableFrom on type parameters...) into a small method, that we can annotate with a SuppressWarnings of small scope.
 * @param o The object to be cast
 * @param className the name of the class of that object, for error messages
 * @param < T > The type to cast to
 * @return The cast object of type T
 * @throws DataSetInstantiationException if the cast fails.
 */
@SuppressWarnings("String_Node_Str") private <T extends DataSet>T convert(Object o,String className) throws DataSetInstantiationException {
  try {
    return (T)o;
  }
 catch (  ClassCastException e) {
    throw logAndException(e,"String_Node_Str",className);
  }
}
Program: 7939
Project: 7939
Buggy source:
/** 
 * a constructor from data fabric and transaction proxy
 * @param fabric the data fabric
 * @param transactionProxy the transaction proxy to use for all data sets
 * @param classLoader the class loader to use for loading data set classes.If null, then the default class loader is used
 */
public DataSetInstantiator(DataFabric fabric,TransactionProxy transactionProxy,ClassLoader classLoader){
  super(classLoader);
  this.fabric=fabric;
  this.transactionProxy=transactionProxy;
}

Fixed version (ground truth):
/** 
 * Constructor from data fabric and transaction proxy.
 * @param fabric the data fabric
 * @param transactionProxy the transaction proxy to use for all data sets
 * @param classLoader the class loader to use for loading data set classes.If null, then the default class loader is used
 */
public DataSetInstantiator(DataFabric fabric,TransactionProxy transactionProxy,ClassLoader classLoader){
  super(classLoader);
  this.fabric=fabric;
  this.transactionProxy=transactionProxy;
}
Program: 7940
Project: 7940
Buggy source:
/** 
 * package-protected constructor, only to be called from @see #setReadOnlyTable() and @see ReadWriteTable constructor
 * @param table the original table
 * @param proxy transaction proxy for all operations
 * @param fabric the data fabric
 */
ReadOnlyTable(Table table,DataFabric fabric,TransactionProxy proxy){
  super(table,fabric,proxy);
}

Fixed version (ground truth):
/** 
 * Package-protected constructor, only to be called from @see #setReadOnlyTable() and @see ReadWriteTable constructor.
 * @param table the original table
 * @param proxy transaction proxy for all operations
 * @param fabric the data fabric
 */
ReadOnlyTable(Table table,DataFabric fabric,TransactionProxy proxy){
  super(table,fabric,proxy);
}
Program: 7941
Project: 7941
Buggy source:
/** 
 * package-protected constructor, only to be called from @see #setReadOnlyTable() and @see ReadWriteTable constructor
 * @param table the original table
 * @param fabric the data fabric
 */
RuntimeTable(Table table,DataFabric fabric,TransactionProxy proxy){
  super(table.getName());
  this.dataFabric=fabric;
  this.proxy=proxy;
}

Fixed version (ground truth):
/** 
 * package-protected constructor, only to be called from @see #setReadOnlyTable() and @see ReadWriteTable constructor.
 * @param table the original table
 * @param fabric the data fabric
 */
RuntimeTable(Table table,DataFabric fabric,TransactionProxy proxy){
  super(table.getName());
  this.dataFabric=fabric;
  this.proxy=proxy;
}
Program: 7942
Project: 7942
Buggy source:
/** 
 * set the name to use for metrics
 * @param metricName the name to use for emitting metrics
 */
protected void setMetricName(String metricName){
  this.metricName=metricName;
}

Fixed version (ground truth):
/** 
 * Set the name to use for metrics.
 * @param metricName the name to use for emitting metrics
 */
protected void setMetricName(String metricName){
  this.metricName=metricName;
}