Program: 4750
Project: 4750
Buggy source:
/** 
 * Constructs a context. To have plugin support, the   {@code pluginInstantiator} must not be null.
 */
protected AbstractContext(Program program,ProgramOptions programOptions,CConfiguration cConf,Set<String> datasets,DatasetFramework dsFramework,TransactionSystemClient txClient,DiscoveryServiceClient discoveryServiceClient,boolean multiThreaded,@Nullable MetricsCollectionService metricsService,Map<String,String> metricsTags,SecureStore secureStore,SecureStoreManager secureStoreManager,MessagingService messagingService,@Nullable PluginInstantiator pluginInstantiator){
  super(program.getId());
  this.program=program;
  this.programOptions=programOptions;
  this.cConf=cConf;
  this.programRunId=program.getId().run(ProgramRunners.getRunId(programOptions));
  this.discoveryServiceClient=discoveryServiceClient;
  this.owners=createOwners(program.getId());
  this.programMetrics=createProgramMetrics(programRunId,cConf.getBoolean(Constants.Metrics.EMIT_PRGOGRAM_CONTAINER_METRICS) ? metricsService : new NoOpMetricsCollectionService(),metricsTags);
  this.userMetrics=new ProgramUserMetrics(programMetrics);
  this.retryStrategy=SystemArguments.getRetryStrategy(programOptions.getUserArguments().asMap(),program.getType(),cConf);
  Map<String,String> runtimeArgs=new HashMap<>(programOptions.getUserArguments().asMap());
  this.logicalStartTime=ProgramRunners.updateLogicalStartTime(runtimeArgs);
  this.runtimeArguments=Collections.unmodifiableMap(runtimeArgs);
  Map<String,Map<String,String>> staticDatasets=new HashMap<>();
  for (  String name : datasets) {
    staticDatasets.put(name,runtimeArguments);
  }
  SystemDatasetInstantiator instantiator=new SystemDatasetInstantiator(dsFramework,program.getClassLoader(),owners);
  this.messagingService=messagingService;
  this.messagingContext=new MultiThreadMessagingContext(messagingService);
  TransactionSystemClient retryingTxClient=new RetryingShortTransactionSystemClient(txClient,retryStrategy);
  this.datasetCache=multiThreaded ? new MultiThreadDatasetCache(instantiator,retryingTxClient,program.getId().getNamespaceId(),runtimeArguments,programMetrics,staticDatasets,messagingContext) : new SingleThreadDatasetCache(instantiator,retryingTxClient,program.getId().getNamespaceId(),runtimeArguments,programMetrics,staticDatasets);
  this.pluginInstantiator=pluginInstantiator;
  this.pluginContext=new DefaultPluginContext(pluginInstantiator,program.getId(),program.getApplicationSpecification().getPlugins());
  String appPrincipalExists=programOptions.getArguments().getOption(ProgramOptionConstants.APP_PRINCIPAL_EXISTS);
  KerberosPrincipalId principalId=null;
  if (appPrincipalExists != null && Boolean.parseBoolean(appPrincipalExists)) {
    principalId=new KerberosPrincipalId(programOptions.getArguments().getOption(ProgramOptionConstants.PRINCIPAL));
  }
  this.admin=new DefaultAdmin(dsFramework,program.getId().getNamespaceId(),secureStoreManager,new BasicMessagingAdmin(messagingService,program.getId().getNamespaceId()),retryStrategy,principalId);
  this.secureStore=secureStore;
  this.defaultTxTimeout=determineTransactionTimeout(cConf);
  this.transactional=Transactions.createTransactional(getDatasetCache(),defaultTxTimeout);
  if (!multiThreaded) {
    datasetCache.addExtraTransactionAware(messagingContext);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a context. To have plugin support, the   {@code pluginInstantiator} must not be null.
 */
protected AbstractContext(Program program,ProgramOptions programOptions,CConfiguration cConf,Set<String> datasets,DatasetFramework dsFramework,TransactionSystemClient txClient,DiscoveryServiceClient discoveryServiceClient,boolean multiThreaded,@Nullable MetricsCollectionService metricsService,Map<String,String> metricsTags,SecureStore secureStore,SecureStoreManager secureStoreManager,MessagingService messagingService,@Nullable PluginInstantiator pluginInstantiator){
  super(program.getId());
  this.program=program;
  this.programOptions=programOptions;
  this.cConf=cConf;
  this.programRunId=program.getId().run(ProgramRunners.getRunId(programOptions));
  this.discoveryServiceClient=discoveryServiceClient;
  this.owners=createOwners(program.getId());
  Map<String,String> runtimeArgs=new HashMap<>(programOptions.getUserArguments().asMap());
  this.logicalStartTime=ProgramRunners.updateLogicalStartTime(runtimeArgs);
  this.runtimeArguments=Collections.unmodifiableMap(runtimeArgs);
  this.programMetrics=createProgramMetrics(programRunId,getMetricsService(cConf,metricsService,runtimeArgs),metricsTags);
  this.userMetrics=new ProgramUserMetrics(programMetrics);
  this.retryStrategy=SystemArguments.getRetryStrategy(programOptions.getUserArguments().asMap(),program.getType(),cConf);
  Map<String,Map<String,String>> staticDatasets=new HashMap<>();
  for (  String name : datasets) {
    staticDatasets.put(name,runtimeArguments);
  }
  SystemDatasetInstantiator instantiator=new SystemDatasetInstantiator(dsFramework,program.getClassLoader(),owners);
  this.messagingService=messagingService;
  this.messagingContext=new MultiThreadMessagingContext(messagingService);
  TransactionSystemClient retryingTxClient=new RetryingShortTransactionSystemClient(txClient,retryStrategy);
  this.datasetCache=multiThreaded ? new MultiThreadDatasetCache(instantiator,retryingTxClient,program.getId().getNamespaceId(),runtimeArguments,programMetrics,staticDatasets,messagingContext) : new SingleThreadDatasetCache(instantiator,retryingTxClient,program.getId().getNamespaceId(),runtimeArguments,programMetrics,staticDatasets);
  this.pluginInstantiator=pluginInstantiator;
  this.pluginContext=new DefaultPluginContext(pluginInstantiator,program.getId(),program.getApplicationSpecification().getPlugins());
  String appPrincipalExists=programOptions.getArguments().getOption(ProgramOptionConstants.APP_PRINCIPAL_EXISTS);
  KerberosPrincipalId principalId=null;
  if (appPrincipalExists != null && Boolean.parseBoolean(appPrincipalExists)) {
    principalId=new KerberosPrincipalId(programOptions.getArguments().getOption(ProgramOptionConstants.PRINCIPAL));
  }
  this.admin=new DefaultAdmin(dsFramework,program.getId().getNamespaceId(),secureStoreManager,new BasicMessagingAdmin(messagingService,program.getId().getNamespaceId()),retryStrategy,principalId);
  this.secureStore=secureStore;
  this.defaultTxTimeout=determineTransactionTimeout(cConf);
  this.transactional=Transactions.createTransactional(getDatasetCache(),defaultTxTimeout);
  if (!multiThreaded) {
    datasetCache.addExtraTransactionAware(messagingContext);
  }
}