nus-yam/ex-repair huggingface dataset:
Program: 5059
Project: 5059
Buggy source:
@Test public void testReset(){
  LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(OLD_NS,OLD_APP,OLD_ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
  final Cancellable cancellable=LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(NS,APP,ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      cancellable.cancel();
    }
  }
);
  thread.start();
  try {
    thread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    Assert.fail();
  }
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  cancellable.cancel();
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
}

Fixed version (ground truth):
@Test public void testReset(){
  Cancellable cancellable=LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(OLD_NS,OLD_APP,OLD_ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
  final Cancellable cancellable2=LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(NS,APP,ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      cancellable2.cancel();
    }
  }
);
  thread.start();
  try {
    thread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    Assert.fail();
  }
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  cancellable2.cancel();
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
  cancellable.cancel();
  Assert.assertTrue(MDC.getCopyOfContextMap().isEmpty());
}
Program: 5060
Project: 5060
Buggy source:
@Override public void run(){
  cancellable.cancel();
}

Fixed version (ground truth):
@Override public void run(){
  cancellable2.cancel();
}
Program: 5061
Project: 5061
Buggy source:
@Override public void cancel(){
  if (Thread.currentThread() == saveCurrentThread && !cancelled) {
    MDC.setContextMap(saveContextMap);
    loggingContext.set(saveLoggingContext);
    cancelled=true;
  }
}

Fixed version (ground truth):
@Override public void cancel(){
  if (Thread.currentThread() == saveCurrentThread && !cancelled) {
    MDC.setContextMap(saveContextMap == null ? Collections.emptyMap() : saveContextMap);
    loggingContext.set(saveLoggingContext);
    cancelled=true;
  }
}
Program: 5062
Project: 5062
Buggy source:
/** 
 * Sets the logging context. <p> NOTE: in work execution frameworks where threads are shared between workers (like Akka) we would have to init context very frequently (before every chunk of work is started). In that case we really want to re-use logging context object instance. </p>
 * @param context context to set
 * @return Cancellable that can be used to revert the logging context and MDC Map to its original value
 */
public static Cancellable setLoggingContext(LoggingContext context){
  final LoggingContext saveLoggingContext=loggingContext.get();
  final Map saveContextMap=MDC.getCopyOfContextMap();
  final Thread saveCurrentThread=Thread.currentThread();
  loggingContext.set(context);
  try {
    MDC.setContextMap(context.getSystemTagsAsString());
  }
 catch (  IllegalStateException e) {
  }
  return new Cancellable(){
    private boolean cancelled;
    @Override public void cancel(){
      if (Thread.currentThread() == saveCurrentThread && !cancelled) {
        MDC.setContextMap(saveContextMap);
        loggingContext.set(saveLoggingContext);
        cancelled=true;
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Sets the logging context. <p> NOTE: in work execution frameworks where threads are shared between workers (like Akka) we would have to init context very frequently (before every chunk of work is started). In that case we really want to re-use logging context object instance. </p>
 * @param context context to set
 * @return Cancellable that can be used to revert the logging context and MDC Map to its original value
 */
public static Cancellable setLoggingContext(LoggingContext context){
  final LoggingContext saveLoggingContext=loggingContext.get();
  final Map saveContextMap=MDC.getCopyOfContextMap();
  final Thread saveCurrentThread=Thread.currentThread();
  loggingContext.set(context);
  try {
    MDC.setContextMap(context.getSystemTagsAsString());
  }
 catch (  IllegalStateException e) {
  }
  return new Cancellable(){
    private boolean cancelled;
    @Override public void cancel(){
      if (Thread.currentThread() == saveCurrentThread && !cancelled) {
        MDC.setContextMap(saveContextMap == null ? Collections.emptyMap() : saveContextMap);
        loggingContext.set(saveLoggingContext);
        cancelled=true;
      }
    }
  }
;
}
Program: 5063
Project: 5063
Buggy source:
@Test public void testReset(){
  LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(OLD_NS,OLD_APP,OLD_ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
  final Cancellable cancellable=LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(NS,APP,ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      cancellable.cancel();
    }
  }
);
  thread.start();
  try {
    thread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    Assert.fail();
  }
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  cancellable.cancel();
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
}

Fixed version (ground truth):
@Test public void testReset(){
  Cancellable cancellable=LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(OLD_NS,OLD_APP,OLD_ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
  final Cancellable cancellable2=LoggingContextAccessor.setLoggingContext(new GenericLoggingContext(NS,APP,ENTITY));
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      cancellable2.cancel();
    }
  }
);
  thread.start();
  try {
    thread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    Assert.fail();
  }
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),ENTITY);
  cancellable2.cancel();
  Assert.assertEquals(MDC.get(NamespaceLoggingContext.TAG_NAMESPACE_ID),OLD_NS);
  Assert.assertEquals(MDC.get(ApplicationLoggingContext.TAG_APPLICATION_ID),OLD_APP);
  Assert.assertEquals(MDC.get(GenericLoggingContext.TAG_ENTITY_ID),OLD_ENTITY);
  cancellable.cancel();
  Assert.assertTrue(MDC.getCopyOfContextMap().isEmpty());
}
Program: 5064
Project: 5064
Buggy source:
@Override public void run(){
  cancellable.cancel();
}

Fixed version (ground truth):
@Override public void run(){
  cancellable2.cancel();
}
Program: 5065
Project: 5065
Buggy source:
/** 
 * Save program runtime args.
 */
@PUT @Path("String_Node_Str") @AuditPolicy(AuditDetail.REQUEST_BODY) public void saveProgramRuntimeArgs(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appName,@PathParam("String_Node_Str") String type,@PathParam("String_Node_Str") String programName) throws Exception {
  ProgramType programType=getProgramType(type);
  if (programType == null || programType == ProgramType.WEBAPP) {
    throw new NotFoundException(String.format("String_Node_Str" + "String_Node_Str",programType));
  }
  lifecycleService.saveRuntimeArgs(new ProgramId(namespaceId,appName,programType,programName),decodeArguments(request));
  responder.sendStatus(HttpResponseStatus.OK);
}

Fixed version (ground truth):
/** 
 * Save runtime args of program with app version.
 */
@PUT @Path("String_Node_Str") @AuditPolicy(AuditDetail.REQUEST_BODY) public void saveProgramRuntimeArgs(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appName,@PathParam("String_Node_Str") String appVersion,@PathParam("String_Node_Str") String type,@PathParam("String_Node_Str") String programName) throws Exception {
  ProgramType programType=getProgramType(type);
  ProgramId programId=new ApplicationId(namespaceId,appName,appVersion).program(programType,programName);
  saveProgramIdRuntimeArgs(programId,request,responder);
}
Program: 5066
Project: 5066
Buggy source:
/** 
 * Get program runtime args.
 */
@GET @Path("String_Node_Str") public void getProgramRuntimeArgs(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appName,@PathParam("String_Node_Str") String type,@PathParam("String_Node_Str") String programName) throws BadRequestException, NotImplementedException, NotFoundException, UnauthorizedException {
  ProgramType programType=getProgramType(type);
  if (programType == null || programType == ProgramType.WEBAPP) {
    throw new NotFoundException(String.format("String_Node_Str" + "String_Node_Str",type));
  }
  responder.sendJson(HttpResponseStatus.OK,lifecycleService.getRuntimeArgs(new ProgramId(namespaceId,appName,programType,programName)));
}

Fixed version (ground truth):
/** 
 * Get runtime args of a program with app version.
 */
@GET @Path("String_Node_Str") public void getProgramRuntimeArgs(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appName,@PathParam("String_Node_Str") String appVersion,@PathParam("String_Node_Str") String type,@PathParam("String_Node_Str") String programName) throws BadRequestException, NotImplementedException, NotFoundException, UnauthorizedException {
  ProgramType programType=getProgramType(type);
  ProgramId programId=new ApplicationId(namespaceId,appName,appVersion).program(programType,programName);
  getProgramIdRuntimeArgs(programId,responder);
}
Program: 5067
Project: 5067
Buggy source:
private void testRuntimeArgs(Class<?> app,String namespace,String appId,String programType,String programId) throws Exception {
  deploy(app,Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  Map<String,String> args=Maps.newHashMap();
  args.put("String_Node_Str","String_Node_Str");
  args.put("String_Node_Str","String_Node_Str");
  args.put("String_Node_Str","String_Node_Str");
  HttpResponse response;
  String argString=GSON.toJson(args,new TypeToken<Map<String,String>>(){
  }
.getType());
  String versionedRuntimeArgsUrl=getVersionedAPIPath("String_Node_Str" + appId + "String_Node_Str"+ programType+ "String_Node_Str"+ programId+ "String_Node_Str",Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  response=doPut(versionedRuntimeArgsUrl,argString);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=doGet(versionedRuntimeArgsUrl);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Map<String,String> argsRead=GSON.fromJson(EntityUtils.toString(response.getEntity()),new TypeToken<Map<String,String>>(){
  }
.getType());
  Assert.assertEquals(args.size(),argsRead.size());
  for (  Map.Entry<String,String> entry : args.entrySet()) {
    Assert.assertEquals(entry.getValue(),argsRead.get(entry.getKey()));
  }
  response=doPut(versionedRuntimeArgsUrl,"String_Node_Str");
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=doGet(versionedRuntimeArgsUrl);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  argsRead=GSON.fromJson(EntityUtils.toString(response.getEntity()),new TypeToken<Map<String,String>>(){
  }
.getType());
  Assert.assertEquals(0,argsRead.size());
  response=doPut(versionedRuntimeArgsUrl,null);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=doGet(versionedRuntimeArgsUrl);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  argsRead=GSON.fromJson(EntityUtils.toString(response.getEntity()),new TypeToken<Map<String,String>>(){
  }
.getType());
  Assert.assertEquals(0,argsRead.size());
}

Fixed version (ground truth):
private void testRuntimeArgs(Class<?> app,String namespace,String appId,String programType,String programId) throws Exception {
  deploy(app,Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  String versionedRuntimeArgsUrl=getVersionedAPIPath("String_Node_Str" + appId + "String_Node_Str"+ programType+ "String_Node_Str"+ programId+ "String_Node_Str",Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  verifyRuntimeArgs(versionedRuntimeArgsUrl);
  String versionedRuntimeArgsAppVersionUrl=getVersionedAPIPath("String_Node_Str" + appId + "String_Node_Str"+ ApplicationId.DEFAULT_VERSION+ "String_Node_Str"+ programType+ "String_Node_Str"+ programId+ "String_Node_Str",Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  verifyRuntimeArgs(versionedRuntimeArgsAppVersionUrl);
}
Program: 5069
Project: 5069
Buggy source:
@Test public void testRuntimeArgs() throws Exception {
  String qualifiedServiceId=String.format("String_Node_Str",FakeApp.NAME,PrefixedEchoHandler.NAME);
  ServiceId service=NamespaceId.DEFAULT.app(FakeApp.NAME).service(PrefixedEchoHandler.NAME);
  Map<String,String> runtimeArgs=ImmutableMap.of("String_Node_Str","String_Node_Str");
  String runtimeArgsKV=Joiner.on("String_Node_Str").withKeyValueSeparator("String_Node_Str").join(runtimeArgs);
  testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId + "String_Node_Str"+ runtimeArgsKV+ "String_Node_Str","String_Node_Str");
  try {
    assertProgramStatus(programClient,service,"String_Node_Str");
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId + "String_Node_Str","String_Node_Str");
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId,"String_Node_Str");
    assertProgramStatus(programClient,service,"String_Node_Str");
    Map<String,String> runtimeArgs2=ImmutableMap.of("String_Node_Str","String_Node_Str");
    String runtimeArgs2Json=GSON.toJson(runtimeArgs2);
    String runtimeArgs2KV=Joiner.on("String_Node_Str").withKeyValueSeparator("String_Node_Str").join(runtimeArgs2);
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId + "String_Node_Str"+ runtimeArgs2KV+ "String_Node_Str","String_Node_Str");
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId,"String_Node_Str");
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId,runtimeArgs2Json);
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId + "String_Node_Str","String_Node_Str");
  }
  finally {
    testCommandOutputContains(cli,"String_Node_Str" + qualifiedServiceId,"String_Node_Str");
    assertProgramStatus(programClient,service,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void testRuntimeArgs() throws Exception {
  String qualifiedServiceId=String.format("String_Node_Str",FakeApp.NAME,PrefixedEchoHandler.NAME);
  ServiceId service=NamespaceId.DEFAULT.app(FakeApp.NAME).service(PrefixedEchoHandler.NAME);
  testServiceRuntimeArgs(qualifiedServiceId,service);
}
Program: 5070
Project: 5070
Buggy source:
@Override public String getPattern(){
  return String.format("String_Node_Str",elementType.getShortName(),elementType.getArgumentName());
}

Fixed version (ground truth):
@Override public String getPattern(){
  return String.format("String_Node_Str",elementType.getShortName(),elementType.getArgumentName(),ArgumentName.APP_VERSION);
}
Program: 5071
Project: 5071
Buggy source:
@Override public String getPattern(){
  return String.format("String_Node_Str",elementType.getShortName(),elementType.getArgumentName(),ArgumentName.RUNTIME_ARGS);
}

Fixed version (ground truth):
@Override public String getPattern(){
  return String.format("String_Node_Str",elementType.getShortName(),elementType.getArgumentName(),ArgumentName.APP_VERSION,ArgumentName.RUNTIME_ARGS);
}
Program: 5072
Project: 5072
Buggy source:
/** 
 * Sets the runtime args of a program.
 * @param program the program
 * @param runtimeArgs args of the program
 * @throws IOException if a network error occurred
 * @throws ProgramNotFoundException if the application or program could not be found
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 */
public void setRuntimeArgs(ProgramId program,Map<String,String> runtimeArgs) throws IOException, UnauthenticatedException, ProgramNotFoundException, UnauthorizedException {
  String path=String.format("String_Node_Str",program.getApplication(),program.getType().getCategoryName(),program.getProgram());
  URL url=config.resolveNamespacedURLV3(program.getNamespaceId(),path);
  HttpRequest request=HttpRequest.put(url).withBody(GSON.toJson(runtimeArgs)).build();
  HttpResponse response=restClient.execute(request,config.getAccessToken(),HttpURLConnection.HTTP_NOT_FOUND);
  if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
    throw new ProgramNotFoundException(program);
  }
}

Fixed version (ground truth):
/** 
 * Sets the runtime args of a program.
 * @param program the program
 * @param runtimeArgs args of the program
 * @throws IOException if a network error occurred
 * @throws ProgramNotFoundException if the application or program could not be found
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 */
public void setRuntimeArgs(ProgramId program,Map<String,String> runtimeArgs) throws IOException, UnauthenticatedException, ProgramNotFoundException, UnauthorizedException {
  String path=String.format("String_Node_Str",program.getApplication(),program.getVersion(),program.getType().getCategoryName(),program.getProgram());
  URL url=config.resolveNamespacedURLV3(program.getNamespaceId(),path);
  HttpRequest request=HttpRequest.put(url).withBody(GSON.toJson(runtimeArgs)).build();
  HttpResponse response=restClient.execute(request,config.getAccessToken(),HttpURLConnection.HTTP_NOT_FOUND);
  if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
    throw new ProgramNotFoundException(program);
  }
}
Program: 5073
Project: 5073
Buggy source:
/** 
 * Gets the runtime args of a program.
 * @param program the program
 * @return runtime args of the program
 * @throws IOException if a network error occurred
 * @throws ProgramNotFoundException if the application or program could not be found
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 */
public Map<String,String> getRuntimeArgs(ProgramId program) throws IOException, UnauthenticatedException, ProgramNotFoundException, UnauthorizedException {
  String path=String.format("String_Node_Str",program.getApplication(),program.getType().getCategoryName(),program.getProgram());
  URL url=config.resolveNamespacedURLV3(program.getNamespaceId(),path);
  HttpResponse response=restClient.execute(HttpMethod.GET,url,config.getAccessToken(),HttpURLConnection.HTTP_NOT_FOUND);
  if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
    throw new ProgramNotFoundException(program);
  }
  return ObjectResponse.fromJsonBody(response,new TypeToken<Map<String,String>>(){
  }
).getResponseObject();
}

Fixed version (ground truth):
/** 
 * Gets the runtime args of a program.
 * @param program the program
 * @return runtime args of the program
 * @throws IOException if a network error occurred
 * @throws ProgramNotFoundException if the application or program could not be found
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 */
public Map<String,String> getRuntimeArgs(ProgramId program) throws IOException, UnauthenticatedException, ProgramNotFoundException, UnauthorizedException {
  String path=String.format("String_Node_Str",program.getApplication(),program.getVersion(),program.getType().getCategoryName(),program.getProgram());
  URL url=config.resolveNamespacedURLV3(program.getNamespaceId(),path);
  HttpResponse response=restClient.execute(HttpMethod.GET,url,config.getAccessToken(),HttpURLConnection.HTTP_NOT_FOUND);
  if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
    throw new ProgramNotFoundException(program);
  }
  return ObjectResponse.fromJsonBody(response,new TypeToken<Map<String,String>>(){
  }
).getResponseObject();
}
Program: 5074
Project: 5074
Buggy source:
@VisibleForTesting static Injector createInjector(CConfiguration cConf,Configuration hConf){
  return Guice.createInjector(new ConfigModule(cConf,hConf),new ZKClientModule(),new IOModule(),new KafkaClientModule(),new DiscoveryRuntimeModule().getDistributedModules(),new AbstractModule(){
    @Override protected void configure(){
      bind(FileContext.class).toProvider(FileContextProvider.class).in(Scopes.SINGLETON);
    }
    @Provides @Singleton private LocationFactory providesLocationFactory(    Configuration hConf,    CConfiguration cConf,    FileContext fc){
      String namespace=cConf.get(Constants.CFG_HDFS_NAMESPACE);
      return new FileContextLocationFactory(hConf,fc,namespace);
    }
  }
);
}

Fixed version (ground truth):
@VisibleForTesting static Injector createInjector(CConfiguration cConf,Configuration hConf){
  return Guice.createInjector(new ConfigModule(cConf,hConf),new ZKClientModule(),new IOModule(),new KafkaClientModule(),new DiscoveryRuntimeModule().getDistributedModules(),new AbstractModule(){
    @Override protected void configure(){
      bind(FileContext.class).toProvider(FileContextProvider.class).in(Scopes.SINGLETON);
    }
    @Provides @Singleton private LocationFactory providesLocationFactory(    Configuration hConf,    CConfiguration cConf,    FileContext fc){
      final String namespace=cConf.get(Constants.CFG_HDFS_NAMESPACE);
      if (UserGroupInformation.isSecurityEnabled()) {
        return new FileContextLocationFactory(hConf,namespace);
      }
      return new InsecureFileContextLocationFactory(hConf,namespace,fc);
    }
  }
);
}
Program: 5075
Project: 5075
Buggy source:
@Provides @Singleton private LocationFactory providesLocationFactory(Configuration hConf,CConfiguration cConf,FileContext fc){
  String namespace=cConf.get(Constants.CFG_HDFS_NAMESPACE);
  return new FileContextLocationFactory(hConf,fc,namespace);
}

Fixed version (ground truth):
@Provides @Singleton private LocationFactory providesLocationFactory(Configuration hConf,CConfiguration cConf,FileContext fc){
  final String namespace=cConf.get(Constants.CFG_HDFS_NAMESPACE);
  if (UserGroupInformation.isSecurityEnabled()) {
    return new FileContextLocationFactory(hConf,namespace);
  }
  return new InsecureFileContextLocationFactory(hConf,namespace,fc);
}
Program: 5077
Project: 5077
Buggy source:
@Override public void apply(){
  if (upgradeVersionKeys(table,maxNumberUpdateRows.get())) {
    table.put(APP_VERSION_UPGRADE_KEY,COLUMN,Bytes.toBytes(ProjectInfo.getVersion().toString()));
  }
}

Fixed version (ground truth):
@Override public void apply() throws Exception {
  if (upgradeVersionKeys(finalMetaTable,maxNumberUpdateRows.get())) {
    finalMetaTable.put(APP_VERSION_UPGRADE_KEY,COLUMN,Bytes.toBytes(ProjectInfo.getVersion().toString()));
  }
}
Program: 5078
Project: 5078
Buggy source:
private Scanner getScannerWithPrefix(String keyPrefix){
  byte[] startKey=Bytes.toBytes(keyPrefix);
  byte[] endKey=Bytes.stopKeyForPrefix(startKey);
  return table.scan(startKey,endKey);
}

Fixed version (ground truth):
private Scanner getScannerWithPrefix(Table table,String keyPrefix){
  byte[] startKey=Bytes.toBytes(keyPrefix);
  byte[] endKey=Bytes.stopKeyForPrefix(startKey);
  return table.scan(startKey,endKey);
}
Program: 5080
Project: 5080
Buggy source:
private boolean upgradeVersionKeys(Table table,int maxNumberUpdateRows){
  int numRowsUpgraded=0;
  try (Scanner scan=getScannerWithPrefix(KEY_PREFIX)){
    Row next;
    while (((next=scan.next()) != null) && (numRowsUpgraded < maxNumberUpdateRows)) {
      if (isInvalidRow(next)) {
        LIMITED_LOG.debug("String_Node_Str",Bytes.toString(next.getRow()));
        continue;
      }
      byte[] oldRowKey=next.getRow();
      String oldRowKeyString=Bytes.toString(next.getRow());
      String[] splits=oldRowKeyString.split("String_Node_Str");
      if (splits.length != 6) {
        LIMITED_LOG.debug("String_Node_Str" + "String_Node_Str",oldRowKeyString);
        continue;
      }
      byte[] newRowKey=Bytes.toBytes(ScheduleUpgradeUtil.getNameWithDefaultVersion(splits,3));
      Row row=table.get(newRowKey);
      if (!row.isEmpty()) {
        table.delete(oldRowKey);
        numRowsUpgraded++;
        continue;
      }
      Put put=new Put(newRowKey);
      for (      Map.Entry<byte[],byte[]> colValEntry : next.getColumns().entrySet()) {
        put.add(colValEntry.getKey(),colValEntry.getValue());
      }
      table.put(put);
      table.delete(oldRowKey);
      numRowsUpgraded++;
    }
  }
   return (numRowsUpgraded == 0);
}

Fixed version (ground truth):
private boolean upgradeVersionKeys(Table table,int maxNumberUpdateRows){
  int numRowsUpgraded=0;
  try (Scanner scan=getScannerWithPrefix(table,KEY_PREFIX)){
    Row next;
    while (((next=scan.next()) != null) && (numRowsUpgraded < maxNumberUpdateRows)) {
      if (isInvalidRow(next)) {
        LIMITED_LOG.debug("String_Node_Str",Bytes.toString(next.getRow()));
        continue;
      }
      byte[] oldRowKey=next.getRow();
      String oldRowKeyString=Bytes.toString(next.getRow());
      String[] splits=oldRowKeyString.split("String_Node_Str");
      if (splits.length != 6) {
        LIMITED_LOG.debug("String_Node_Str" + "String_Node_Str",oldRowKeyString);
        continue;
      }
      byte[] newRowKey=Bytes.toBytes(ScheduleUpgradeUtil.getNameWithDefaultVersion(splits,3));
      Row row=table.get(newRowKey);
      if (!row.isEmpty()) {
        table.delete(oldRowKey);
        numRowsUpgraded++;
        continue;
      }
      Put put=new Put(newRowKey);
      for (      Map.Entry<byte[],byte[]> colValEntry : next.getColumns().entrySet()) {
        put.add(colValEntry.getKey(),colValEntry.getValue());
      }
      table.put(put);
      table.delete(oldRowKey);
      numRowsUpgraded++;
    }
  }
   return (numRowsUpgraded == 0);
}
Program: 5081
Project: 5081
Buggy source:
/** 
 * Initialize this persistent store.
 */
public synchronized void initialize() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
  upgradeCacheLoader=CacheBuilder.newBuilder().expireAfterWrite(1,TimeUnit.MINUTES).build(new UpgradeValueLoader(NAME,factory,table,storeInitialized));
  storeInitialized.set(true);
}

Fixed version (ground truth):
/** 
 * Initialize this persistent store.
 */
public synchronized void initialize() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
  upgradeCacheLoader=CacheBuilder.newBuilder().expireAfterWrite(1,TimeUnit.MINUTES).build(new UpgradeValueLoader(NAME,factory,tableUtil.getMetaTable(),storeInitialized));
  storeInitialized.set(true);
}
Program: 5082
Project: 5082
Buggy source:
private void initializeScheduleTable() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
  if (cacheLoaderInitialized.compareAndSet(false,true)) {
    upgradeCacheLoader=CacheBuilder.newBuilder().expireAfterWrite(1,TimeUnit.MINUTES).build(new UpgradeValueLoader(NAME,factory,table));
  }
}

Fixed version (ground truth):
private void initializeScheduleTable() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
  if (cacheLoaderInitialized.compareAndSet(false,true)) {
    upgradeCacheLoader=CacheBuilder.newBuilder().expireAfterWrite(1,TimeUnit.MINUTES).build(new UpgradeValueLoader(NAME,factory,tableUtil.getMetaTable()));
  }
}
Program: 5083
Project: 5083
Buggy source:
private void doAddSchedule(HttpRequest request,HttpResponder responder,String namespaceId,String appId,String appVersion,String scheduleName) throws IOException, BadRequestException, NotFoundException, SchedulerException, AlreadyExistsException {
  ApplicationId applicationId=new ApplicationId(namespaceId,appId,appVersion);
  ScheduleSpecification scheduleSpecFromRequest;
  try (Reader reader=new InputStreamReader(new ChannelBufferInputStream(request.getContent()),Charsets.UTF_8)){
    scheduleSpecFromRequest=GSON.fromJson(reader,ScheduleSpecification.class);
  }
 catch (  IOException e) {
    LOG.debug("String_Node_Str",e);
    throw new IOException("String_Node_Str");
  }
catch (  JsonSyntaxException e) {
    throw new BadRequestException("String_Node_Str" + e.getMessage());
  }
  if (scheduleSpecFromRequest.getSchedule().getName() != null && !scheduleName.equals(scheduleSpecFromRequest.getSchedule().getName())) {
    throw new BadRequestException(String.format("String_Node_Str",scheduleSpecFromRequest.getSchedule().getName(),scheduleName));
  }
  lifecycleService.addSchedule(applicationId,scheduleSpecFromRequest);
  responder.sendStatus(HttpResponseStatus.OK);
}

Fixed version (ground truth):
private void doAddSchedule(HttpRequest request,HttpResponder responder,String namespaceId,String appId,String appVersion,String scheduleName) throws IOException, BadRequestException, NotFoundException, SchedulerException, AlreadyExistsException {
  ApplicationId applicationId=new ApplicationId(namespaceId,appId,appVersion);
  ScheduleSpecification scheduleSpecFromRequest;
  try (Reader reader=new InputStreamReader(new ChannelBufferInputStream(request.getContent()),Charsets.UTF_8)){
    scheduleSpecFromRequest=GSON.fromJson(reader,ScheduleSpecification.class);
  }
 catch (  IOException e) {
    LOG.debug("String_Node_Str",e);
    throw new IOException("String_Node_Str");
  }
catch (  JsonSyntaxException e) {
    throw new BadRequestException("String_Node_Str" + e.getMessage());
  }
  if (scheduleSpecFromRequest.getSchedule().getName() != null && !scheduleName.equals(scheduleSpecFromRequest.getSchedule().getName())) {
    throw new BadRequestException(String.format("String_Node_Str",scheduleSpecFromRequest.getSchedule().getName(),scheduleName));
  }
  if (scheduleSpecFromRequest.getSchedule().getName() == null) {
    scheduleSpecFromRequest=addNameToSpec(scheduleSpecFromRequest,scheduleName);
  }
  lifecycleService.addSchedule(applicationId,scheduleSpecFromRequest);
  responder.sendStatus(HttpResponseStatus.OK);
}
Program: 5087
Project: 5087
Buggy source:
/** 
 * Method to add version in StreamSizeSchedule row key in SchedulerStore.
 * @throws Exception
 */
public void upgrade() throws InterruptedException, TransactionFailureException, IOException, DatasetManagementException {
  initialize();
  factory.createExecutor(ImmutableList.of((TransactionAware)table)).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      upgradeVersionKeys();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Method to add version in StreamSizeSchedule row key in SchedulerStore.
 * @throws InterruptedException
 * @throws IOException
 * @throws DatasetManagementException
 */
public void upgrade() throws InterruptedException, IOException, DatasetManagementException {
  while (!storeInitialized.get()) {
    TimeUnit.SECONDS.sleep(10);
  }
  if (isUpgradeComplete()) {
    LOG.info("String_Node_Str",NAME);
    return;
  }
  final AtomicInteger maxNumberUpdateRows=new AtomicInteger(1000);
  final AtomicInteger sleepTimeInSecs=new AtomicInteger(60);
  LOG.info("String_Node_Str",NAME);
  while (!isUpgradeComplete()) {
    sleepTimeInSecs.set(60);
    try {
      factory.createExecutor(ImmutableList.of((TransactionAware)table)).execute(new TransactionExecutor.Subroutine(){
        @Override public void apply(){
          if (upgradeVersionKeys(table,maxNumberUpdateRows.get())) {
            table.put(APP_VERSION_UPGRADE_KEY,COLUMN,Bytes.toBytes(ProjectInfo.getVersion().toString()));
          }
        }
      }
);
    }
 catch (    TransactionFailureException e) {
      if (e instanceof TransactionConflictException) {
        LOG.debug("String_Node_Str",e);
        sleepTimeInSecs.set(10);
      }
 else       if (e instanceof TransactionNotInProgressException) {
        int currMaxRows=maxNumberUpdateRows.get();
        if (currMaxRows > 500) {
          maxNumberUpdateRows.decrementAndGet();
        }
 else {
          LOG.warn("String_Node_Str",NAME);
          return;
        }
        sleepTimeInSecs.set(10);
        LOG.debug("String_Node_Str" + "String_Node_Str",maxNumberUpdateRows.get(),e);
      }
 else {
        LOG.error("String_Node_Str",e);
        sleepTimeInSecs.set(60);
      }
    }
    TimeUnit.SECONDS.sleep(sleepTimeInSecs.get());
  }
  LOG.info("String_Node_Str",NAME);
}
Program: 5088
Project: 5088
Buggy source:
@Override public void apply(){
  upgradeVersionKeys();
}

Fixed version (ground truth):
@Override public void apply(){
  if (upgradeVersionKeys(table,maxNumberUpdateRows.get())) {
    table.put(APP_VERSION_UPGRADE_KEY,COLUMN,Bytes.toBytes(ProjectInfo.getVersion().toString()));
  }
}
Program: 5089
Project: 5089
Buggy source:
/** 
 * Remove a schedule from the store.
 * @param programId program id the schedule is running for
 * @param programType program type the schedule is running for
 * @param scheduleName name of the schedule
 */
public synchronized void delete(final ProgramId programId,final SchedulableProgramType programType,final String scheduleName) throws InterruptedException, TransactionFailureException {
  factory.createExecutor(ImmutableList.of((TransactionAware)table)).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      String rowKey=getRowKey(programId,programType,scheduleName);
      String versionLessRowKey=removeAppVersion(rowKey);
      if (versionLessRowKey != null) {
        table.delete(Bytes.toBytes(versionLessRowKey));
      }
      table.delete(Bytes.toBytes(rowKey));
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Remove a schedule from the store.
 * @param programId program id the schedule is running for
 * @param programType program type the schedule is running for
 * @param scheduleName name of the schedule
 */
public synchronized void delete(final ProgramId programId,final SchedulableProgramType programType,final String scheduleName) throws InterruptedException, TransactionFailureException {
  final boolean needVersionLessDelete=!isUpgradeComplete();
  factory.createExecutor(ImmutableList.of((TransactionAware)table)).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      String rowKey=getRowKey(programId,programType,scheduleName);
      if (needVersionLessDelete) {
        String versionLessRowKey=removeAppVersion(rowKey);
        if (versionLessRowKey != null) {
          table.delete(Bytes.toBytes(versionLessRowKey));
        }
      }
      table.delete(Bytes.toBytes(rowKey));
    }
  }
);
}
Program: 5090
Project: 5090
Buggy source:
private void upgradeVersionKeys(){
  Joiner joiner=Joiner.on("String_Node_Str");
  try (Scanner scan=getScannerWithPrefix(KEY_PREFIX)){
    Row next;
    while ((next=scan.next()) != null) {
      if (isInvalidRow(next)) {
        LIMITED_LOG.debug("String_Node_Str",Bytes.toString(next.getRow()));
        continue;
      }
      byte[] oldRowKey=next.getRow();
      String oldRowKeyString=Bytes.toString(next.getRow());
      String[] splits=oldRowKeyString.split("String_Node_Str");
      if (splits.length != 6) {
        LOG.debug("String_Node_Str" + "String_Node_Str",oldRowKeyString);
        continue;
      }
      List<String> splitsList=new ArrayList<>(Arrays.asList(splits));
      splitsList.add(3,ApplicationId.DEFAULT_VERSION);
      String newRowKeyString=joiner.join(splitsList);
      byte[] newRowKey=Bytes.toBytes(newRowKeyString);
      Put put=new Put(newRowKey);
      for (      Map.Entry<byte[],byte[]> colValEntry : next.getColumns().entrySet()) {
        put.add(colValEntry.getKey(),colValEntry.getValue());
      }
      table.put(put);
      table.delete(oldRowKey);
    }
  }
 }

Fixed version (ground truth):
private boolean upgradeVersionKeys(Table table,int maxNumberUpdateRows){
  int numRowsUpgraded=0;
  try (Scanner scan=getScannerWithPrefix(KEY_PREFIX)){
    Row next;
    while (((next=scan.next()) != null) && (numRowsUpgraded < maxNumberUpdateRows)) {
      if (isInvalidRow(next)) {
        LIMITED_LOG.debug("String_Node_Str",Bytes.toString(next.getRow()));
        continue;
      }
      byte[] oldRowKey=next.getRow();
      String oldRowKeyString=Bytes.toString(next.getRow());
      String[] splits=oldRowKeyString.split("String_Node_Str");
      if (splits.length != 6) {
        LIMITED_LOG.debug("String_Node_Str" + "String_Node_Str",oldRowKeyString);
        continue;
      }
      byte[] newRowKey=Bytes.toBytes(ScheduleUpgradeUtil.getNameWithDefaultVersion(splits,3));
      Row row=table.get(newRowKey);
      if (!row.isEmpty()) {
        table.delete(oldRowKey);
        numRowsUpgraded++;
        continue;
      }
      Put put=new Put(newRowKey);
      for (      Map.Entry<byte[],byte[]> colValEntry : next.getColumns().entrySet()) {
        put.add(colValEntry.getKey(),colValEntry.getValue());
      }
      table.put(put);
      table.delete(oldRowKey);
      numRowsUpgraded++;
    }
  }
   return (numRowsUpgraded == 0);
}
Program: 5091
Project: 5091
Buggy source:
/** 
 * Initialize this persistent store.
 */
public synchronized void initialize() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
}

Fixed version (ground truth):
/** 
 * Initialize this persistent store.
 */
public synchronized void initialize() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
  upgradeCacheLoader=CacheBuilder.newBuilder().expireAfterWrite(1,TimeUnit.MINUTES).build(new UpgradeValueLoader(NAME,factory,table,storeInitialized));
  storeInitialized.set(true);
}
Program: 5092
Project: 5092
Buggy source:
@Inject public DatasetBasedStreamSizeScheduleStore(TransactionExecutorFactory factory,ScheduleStoreTableUtil tableUtil){
  this.tableUtil=tableUtil;
  this.factory=factory;
}

Fixed version (ground truth):
@Inject public DatasetBasedStreamSizeScheduleStore(TransactionExecutorFactory factory,ScheduleStoreTableUtil tableUtil){
  this.tableUtil=tableUtil;
  this.factory=factory;
  this.storeInitialized=new AtomicBoolean(false);
}
Program: 5095
Project: 5095
Buggy source:
/** 
 * Set the field to the given value.
 * @param fieldName Name of the field to set.
 * @param value Value for the field.
 * @return This builder.
 * @throws UnexpectedFormatException if the field is not in the schema, or the field is not nullable but a nullvalue is given.
 */
public Builder set(String fieldName,Object value){
  validateAndGetField(fieldName,value);
  fields.put(fieldName,value);
  return this;
}

Fixed version (ground truth):
/** 
 * Set the field to the given value.
 * @param fieldName Name of the field to set
 * @param value Value for the field
 * @return This builder
 * @throws UnexpectedFormatException if the field is not in the schema, or the field is not nullable but a nullvalue is given
 */
public Builder set(String fieldName,@Nullable Object value){
  validateAndGetField(fieldName,value);
  fields.put(fieldName,value);
  return this;
}
Program: 5096
Project: 5096
Buggy source:
/** 
 * Build a   {@link StructuredRecord} with the fields set by this builder.
 * @return A {@link StructuredRecord} with the fields set by this builder.
 * @throws UnexpectedFormatException if there is at least one non-nullable field without a value.
 */
public StructuredRecord build() throws UnexpectedFormatException {
  for (  Schema.Field field : schema.getFields()) {
    String fieldName=field.getName();
    if (!fields.containsKey(fieldName)) {
      if (!field.getSchema().isNullable()) {
        throw new UnexpectedFormatException("String_Node_Str" + fieldName + "String_Node_Str");
      }
 else {
        fields.put(fieldName,null);
      }
    }
  }
  return new StructuredRecord(schema,fields);
}

Fixed version (ground truth):
/** 
 * Build a   {@link StructuredRecord} with the fields set by this builder.
 * @return A {@link StructuredRecord} with the fields set by this builder
 * @throws UnexpectedFormatException if there is at least one non-nullable field without a value
 */
public StructuredRecord build() throws UnexpectedFormatException {
  for (  Schema.Field field : schema.getFields()) {
    String fieldName=field.getName();
    if (!fields.containsKey(fieldName)) {
      if (!field.getSchema().isNullable()) {
        throw new UnexpectedFormatException("String_Node_Str" + fieldName + "String_Node_Str");
      }
 else {
        fields.put(fieldName,null);
      }
    }
  }
  return new StructuredRecord(schema,fields);
}
Program: 5097
Project: 5097
Buggy source:
/** 
 * Convert the given string into the type of the given field, and set the value for that field. A String can be converted to a boolean, int, long, float, double, bytes, string, or null.
 * @param fieldName Name of the field to set.
 * @param strVal String value for the field.
 * @return This builder.
 * @throws UnexpectedFormatException if the field is not in the schema, or the field is not nullable but a nullvalue is given, or the string cannot be converted to the type for the field.
 */
public Builder convertAndSet(String fieldName,String strVal) throws UnexpectedFormatException {
  Schema.Field field=validateAndGetField(fieldName,strVal);
  fields.put(fieldName,convertString(field.getSchema(),strVal));
  return this;
}

Fixed version (ground truth):
/** 
 * Convert the given string into the type of the given field, and set the value for that field. A String can be converted to a boolean, int, long, float, double, bytes, string, or null.
 * @param fieldName Name of the field to set
 * @param strVal String value for the field
 * @return This builder
 * @throws UnexpectedFormatException if the field is not in the schema, or the field is not nullable but a nullvalue is given, or the string cannot be converted to the type for the field
 */
public Builder convertAndSet(String fieldName,@Nullable String strVal) throws UnexpectedFormatException {
  Schema.Field field=validateAndGetField(fieldName,strVal);
  fields.put(fieldName,convertString(field.getSchema(),strVal));
  return this;
}
Program: 5098
Project: 5098
Buggy source:
public WorkflowBackedActionContext(WorkflowContext workflowContext,Metrics metrics,LookupProvider lookup,long logicalStartTime,Map<String,String> runtimeArgs,StageInfo stageInfo){
  super(workflowContext,workflowContext,metrics,lookup,logicalStartTime,runtimeArgs,workflowContext.getAdmin(),stageInfo);
  this.workflowContext=workflowContext;
}

Fixed version (ground truth):
public WorkflowBackedActionContext(WorkflowContext workflowContext,Metrics metrics,LookupProvider lookup,long logicalStartTime,Map<String,String> runtimeArgs,StageInfo stageInfo){
  super(workflowContext,workflowContext,workflowContext,metrics,lookup,logicalStartTime,runtimeArgs,workflowContext.getAdmin(),stageInfo);
  this.workflowContext=workflowContext;
}
Program: 5099
Project: 5099
Buggy source:
public BasicActionContext(CustomActionContext context,Metrics metrics,String stageName){
  super(context,metrics,StageInfo.builder(stageName,Action.PLUGIN_TYPE).build());
  this.context=context;
  this.arguments=new BasicSettableArguments(context.getRuntimeArguments());
}

Fixed version (ground truth):
public BasicActionContext(CustomActionContext context,Metrics metrics,String stageName){
  super(context,context,metrics,StageInfo.builder(stageName,Action.PLUGIN_TYPE).build());
  this.context=context;
  this.arguments=new BasicSettableArguments(context.getRuntimeArguments());
}
Program: 5100
Project: 5100
Buggy source:
protected AbstractAggregatorContext(PluginContext pluginContext,DatasetContext datasetContext,Metrics metrics,LookupProvider lookup,long logicalStartTime,Map<String,String> runtimeArgs,Admin admin,StageInfo stageInfo){
  super(pluginContext,datasetContext,metrics,lookup,logicalStartTime,runtimeArgs,admin,stageInfo);
}

Fixed version (ground truth):
protected AbstractAggregatorContext(PluginContext pluginContext,ServiceDiscoverer serviceDiscoverer,DatasetContext datasetContext,Metrics metrics,LookupProvider lookup,long logicalStartTime,Map<String,String> runtimeArgs,Admin admin,StageInfo stageInfo){
  super(pluginContext,serviceDiscoverer,datasetContext,metrics,lookup,logicalStartTime,runtimeArgs,admin,stageInfo);
}
Program: 5101
Project: 5101
Buggy source:
protected <T extends PluginContext & DatasetContext>AbstractBatchContext(T context,Metrics metrics,LookupProvider lookup,long logicalStartTime,Map<String,String> runtimeArgs,Admin admin,StageInfo stageInfo){
  super(context,metrics,lookup,stageInfo);
  this.datasetContext=context;
  this.logicalStartTime=logicalStartTime;
  this.runtimeArgs=runtimeArgs;
  this.admin=admin;
}

Fixed version (ground truth):
protected <T extends PluginContext & DatasetContext>AbstractBatchContext(T context,ServiceDiscoverer serviceDiscoverer,Metrics metrics,LookupProvider lookup,long logicalStartTime,Map<String,String> runtimeArgs,Admin admin,StageInfo stageInfo){
  super(context,serviceDiscoverer,metrics,lookup,stageInfo);
  this.datasetContext=context;
  this.logicalStartTime=logicalStartTime;
  this.runtimeArgs=runtimeArgs;
  this.admin=admin;
}