nus-yam/ex-repair huggingface dataset:
Program: 6148
Project: 6148
Buggy source:
@Inject AuthorizationHandler(AuthorizerInstantiatorService authorizerInstantiatorService,CConfiguration cConf,EntityExistenceVerifier entityExistenceVerifier){
  this.authorizerInstantiatorService=authorizerInstantiatorService;
  this.authenticationEnabled=cConf.getBoolean(Constants.Security.ENABLED);
  this.authorizationEnabled=cConf.getBoolean(Constants.Security.Authorization.ENABLED);
  this.entityExistenceVerifier=entityExistenceVerifier;
}

Fixed version (ground truth):
@Inject AuthorizationHandler(AuthorizerInstantiator authorizerInstantiator,CConfiguration cConf,EntityExistenceVerifier entityExistenceVerifier){
  this.authorizerInstantiator=authorizerInstantiator;
  this.authenticationEnabled=cConf.getBoolean(Constants.Security.ENABLED);
  this.authorizationEnabled=cConf.getBoolean(Constants.Security.Authorization.ENABLED);
  this.entityExistenceVerifier=entityExistenceVerifier;
}
Program: 6149
Project: 6149
Buggy source:
@Path("String_Node_Str") @PUT public void addRoleToPrincipal(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiatorService.get().addRoleToPrincipal(new Role(roleName),new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase())));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @PUT public void addRoleToPrincipal(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiator.get().addRoleToPrincipal(new Role(roleName),new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase())));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6150
Project: 6150
Buggy source:
@Path("String_Node_Str") @POST public void revoke(HttpRequest httpRequest,HttpResponder httpResponder) throws Exception {
  ensureSecurityEnabled();
  RevokeRequest request=parseBody(httpRequest,RevokeRequest.class);
  verifyAuthRequest(request);
  authorizerInstantiatorService.get().enforce(request.getEntity(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  if (request.getPrincipal() == null && request.getActions() == null) {
    authorizerInstantiatorService.get().revoke(request.getEntity());
  }
 else {
    Set<Action> actions=request.getActions() == null ? EnumSet.allOf(Action.class) : request.getActions();
    authorizerInstantiatorService.get().revoke(request.getEntity(),request.getPrincipal(),actions);
  }
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,request,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @POST public void revoke(HttpRequest httpRequest,HttpResponder httpResponder) throws Exception {
  ensureSecurityEnabled();
  RevokeRequest request=parseBody(httpRequest,RevokeRequest.class);
  verifyAuthRequest(request);
  authorizerInstantiator.get().enforce(request.getEntity(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  if (request.getPrincipal() == null && request.getActions() == null) {
    authorizerInstantiator.get().revoke(request.getEntity());
  }
 else {
    Set<Action> actions=request.getActions() == null ? EnumSet.allOf(Action.class) : request.getActions();
    authorizerInstantiator.get().revoke(request.getEntity(),request.getPrincipal(),actions);
  }
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,request,HttpResponseStatus.OK);
}
Program: 6151
Project: 6151
Buggy source:
/** 
 * Role Management : For Role Based Access Control
 */
@Path("String_Node_Str") @PUT public void createRole(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiatorService.get().createRole(new Role(roleName));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
/** 
 * Role Management : For Role Based Access Control
 */
@Path("String_Node_Str") @PUT public void createRole(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiator.get().createRole(new Role(roleName));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6152
Project: 6152
Buggy source:
@Path("String_Node_Str") @DELETE public void removeRoleFromPrincipal(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiatorService.get().removeRoleFromPrincipal(new Role(roleName),new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase())));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @DELETE public void removeRoleFromPrincipal(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiator.get().removeRoleFromPrincipal(new Role(roleName),new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase())));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6153
Project: 6153
Buggy source:
@Path("String_Node_Str") @GET public void listRoles(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName) throws Exception {
  ensureSecurityEnabled();
  Principal principal=new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase()));
  httpResponder.sendJson(HttpResponseStatus.OK,authorizerInstantiatorService.get().listRoles(principal));
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void listRoles(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName) throws Exception {
  ensureSecurityEnabled();
  Principal principal=new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase()));
  httpResponder.sendJson(HttpResponseStatus.OK,authorizerInstantiator.get().listRoles(principal));
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6154
Project: 6154
Buggy source:
@Path("String_Node_Str") @GET public void listPrivileges(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName) throws Exception {
  ensureSecurityEnabled();
  Principal principal=new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase()));
  httpResponder.sendJson(HttpResponseStatus.OK,authorizerInstantiatorService.get().listPrivileges(principal),PRIVILEGE_SET_TYPE,GSON);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void listPrivileges(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String principalType,@PathParam("String_Node_Str") String principalName) throws Exception {
  ensureSecurityEnabled();
  Principal principal=new Principal(principalName,Principal.PrincipalType.valueOf(principalType.toUpperCase()));
  httpResponder.sendJson(HttpResponseStatus.OK,authorizerInstantiator.get().listPrivileges(principal),PRIVILEGE_SET_TYPE,GSON);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6155
Project: 6155
Buggy source:
@Path("String_Node_Str") @DELETE public void dropRole(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiatorService.get().dropRole(new Role(roleName));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @DELETE public void dropRole(HttpRequest httpRequest,HttpResponder httpResponder,@PathParam("String_Node_Str") String roleName) throws Exception {
  ensureSecurityEnabled();
  authorizerInstantiator.get().dropRole(new Role(roleName));
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6156
Project: 6156
Buggy source:
@Path("String_Node_Str") @GET public void listAllRoles(HttpRequest httpRequest,HttpResponder httpResponder) throws Exception {
  ensureSecurityEnabled();
  httpResponder.sendJson(HttpResponseStatus.OK,authorizerInstantiatorService.get().listAllRoles());
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @GET public void listAllRoles(HttpRequest httpRequest,HttpResponder httpResponder) throws Exception {
  ensureSecurityEnabled();
  httpResponder.sendJson(HttpResponseStatus.OK,authorizerInstantiator.get().listAllRoles());
  createLogEntry(httpRequest,null,HttpResponseStatus.OK);
}
Program: 6157
Project: 6157
Buggy source:
@Path("String_Node_Str") @POST public void grant(HttpRequest httpRequest,HttpResponder httpResponder) throws Exception {
  ensureSecurityEnabled();
  GrantRequest request=parseBody(httpRequest,GrantRequest.class);
  verifyAuthRequest(request);
  Set<Action> actions=request.getActions() == null ? EnumSet.allOf(Action.class) : request.getActions();
  authorizerInstantiatorService.get().enforce(request.getEntity(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  authorizerInstantiatorService.get().grant(request.getEntity(),request.getPrincipal(),actions);
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,request,HttpResponseStatus.OK);
}

Fixed version (ground truth):
@Path("String_Node_Str") @POST public void grant(HttpRequest httpRequest,HttpResponder httpResponder) throws Exception {
  ensureSecurityEnabled();
  GrantRequest request=parseBody(httpRequest,GrantRequest.class);
  verifyAuthRequest(request);
  Set<Action> actions=request.getActions() == null ? EnumSet.allOf(Action.class) : request.getActions();
  authorizerInstantiator.get().enforce(request.getEntity(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  authorizerInstantiator.get().grant(request.getEntity(),request.getPrincipal(),actions);
  httpResponder.sendStatus(HttpResponseStatus.OK);
  createLogEntry(httpRequest,request,HttpResponseStatus.OK);
}
Program: 6158
Project: 6158
Buggy source:
@Inject LocalApplicationManager(CConfiguration configuration,PipelineFactory pipelineFactory,NamespacedLocationFactory namespacedLocationFactory,Store store,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DatasetFramework datasetFramework,@Named("String_Node_Str") DatasetFramework inMemoryDatasetFramework,StreamAdmin streamAdmin,Scheduler scheduler,@Assisted ProgramTerminator programTerminator,MetricStore metricStore,UsageRegistry usageRegistry,ArtifactRepository artifactRepository,MetadataStore metadataStore,AuthorizerInstantiatorService authorizerInstantiatorService){
  this.configuration=configuration;
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.pipelineFactory=pipelineFactory;
  this.store=store;
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.programTerminator=programTerminator;
  this.datasetFramework=datasetFramework;
  this.inMemoryDatasetFramework=inMemoryDatasetFramework;
  this.streamAdmin=streamAdmin;
  this.scheduler=scheduler;
  this.metricStore=metricStore;
  this.usageRegistry=usageRegistry;
  this.artifactRepository=artifactRepository;
  this.metadataStore=metadataStore;
  this.authorizerInstantiatorService=authorizerInstantiatorService;
}

Fixed version (ground truth):
@Inject LocalApplicationManager(CConfiguration configuration,PipelineFactory pipelineFactory,NamespacedLocationFactory namespacedLocationFactory,Store store,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DatasetFramework datasetFramework,@Named("String_Node_Str") DatasetFramework inMemoryDatasetFramework,StreamAdmin streamAdmin,Scheduler scheduler,@Assisted ProgramTerminator programTerminator,MetricStore metricStore,UsageRegistry usageRegistry,ArtifactRepository artifactRepository,MetadataStore metadataStore,AuthorizerInstantiator authorizerInstantiator){
  this.configuration=configuration;
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.pipelineFactory=pipelineFactory;
  this.store=store;
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.programTerminator=programTerminator;
  this.datasetFramework=datasetFramework;
  this.inMemoryDatasetFramework=inMemoryDatasetFramework;
  this.streamAdmin=streamAdmin;
  this.scheduler=scheduler;
  this.metricStore=metricStore;
  this.usageRegistry=usageRegistry;
  this.artifactRepository=artifactRepository;
  this.metadataStore=metadataStore;
  this.authorizerInstantiator=authorizerInstantiator;
}
Program: 6159
Project: 6159
Buggy source:
@Override public ListenableFuture<O> deploy(Id.Namespace namespace,@Nullable String appId,I input) throws Exception {
  Pipeline<O> pipeline=pipelineFactory.getPipeline();
  pipeline.addLast(new LocalArtifactLoaderStage(configuration,store,namespace,appId,artifactRepository));
  pipeline.addLast(new ApplicationVerificationStage(store,datasetFramework));
  pipeline.addLast(new DeployDatasetModulesStage(configuration,namespace,datasetFramework,inMemoryDatasetFramework));
  pipeline.addLast(new CreateDatasetInstancesStage(configuration,datasetFramework,namespace));
  pipeline.addLast(new CreateStreamsStage(namespace,streamAdmin));
  pipeline.addLast(new DeletedProgramHandlerStage(store,programTerminator,streamConsumerFactory,queueAdmin,metricStore,metadataStore,authorizerInstantiatorService.get()));
  pipeline.addLast(new ProgramGenerationStage(configuration,namespacedLocationFactory,authorizerInstantiatorService.get()));
  pipeline.addLast(new ApplicationRegistrationStage(store,usageRegistry));
  pipeline.addLast(new CreateSchedulesStage(scheduler));
  pipeline.addLast(new SystemMetadataWriterStage(metadataStore));
  return pipeline.execute(input);
}

Fixed version (ground truth):
@Override public ListenableFuture<O> deploy(Id.Namespace namespace,@Nullable String appId,I input) throws Exception {
  Pipeline<O> pipeline=pipelineFactory.getPipeline();
  pipeline.addLast(new LocalArtifactLoaderStage(configuration,store,namespace,appId,artifactRepository));
  pipeline.addLast(new ApplicationVerificationStage(store,datasetFramework));
  pipeline.addLast(new DeployDatasetModulesStage(configuration,namespace,datasetFramework,inMemoryDatasetFramework));
  pipeline.addLast(new CreateDatasetInstancesStage(configuration,datasetFramework,namespace));
  pipeline.addLast(new CreateStreamsStage(namespace,streamAdmin));
  pipeline.addLast(new DeletedProgramHandlerStage(store,programTerminator,streamConsumerFactory,queueAdmin,metricStore,metadataStore,authorizerInstantiator.get()));
  pipeline.addLast(new ProgramGenerationStage(configuration,namespacedLocationFactory,authorizerInstantiator.get()));
  pipeline.addLast(new ApplicationRegistrationStage(store,usageRegistry));
  pipeline.addLast(new CreateSchedulesStage(scheduler));
  pipeline.addLast(new SystemMetadataWriterStage(metadataStore));
  return pipeline.execute(input);
}
Program: 6160
Project: 6160
Buggy source:
@Override public synchronized void deleteDatasets(Id.Namespace namespaceId) throws Exception {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  if (checkProgramsRunning(namespaceId.toEntityId())) {
    throw new NamespaceCannotBeDeletedException(namespaceId,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",namespaceId));
  }
  authorizerInstantiatorService.get().enforce(namespaceId.toEntityId(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  try {
    dsFramework.deleteAllInstances(namespaceId);
  }
 catch (  DatasetManagementException|IOException e) {
    LOG.warn("String_Node_Str",namespaceId,e);
    throw new NamespaceCannotBeDeletedException(namespaceId,e);
  }
  LOG.debug("String_Node_Str",namespaceId);
}

Fixed version (ground truth):
@Override public synchronized void deleteDatasets(Id.Namespace namespaceId) throws Exception {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  if (checkProgramsRunning(namespaceId.toEntityId())) {
    throw new NamespaceCannotBeDeletedException(namespaceId,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",namespaceId));
  }
  authorizerInstantiator.get().enforce(namespaceId.toEntityId(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  try {
    dsFramework.deleteAllInstances(namespaceId);
  }
 catch (  DatasetManagementException|IOException e) {
    LOG.warn("String_Node_Str",namespaceId,e);
    throw new NamespaceCannotBeDeletedException(namespaceId,e);
  }
  LOG.debug("String_Node_Str",namespaceId);
}
Program: 6161
Project: 6161
Buggy source:
@Override public synchronized void updateProperties(Id.Namespace namespaceId,NamespaceMeta namespaceMeta) throws Exception {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  authorizerInstantiatorService.get().enforce(namespaceId.toEntityId(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  NamespaceMeta metadata=nsStore.get(namespaceId);
  NamespaceMeta.Builder builder=new NamespaceMeta.Builder(metadata);
  if (namespaceMeta.getDescription() != null) {
    builder.setDescription(namespaceMeta.getDescription());
  }
  NamespaceConfig config=namespaceMeta.getConfig();
  if (config != null && !Strings.isNullOrEmpty(config.getSchedulerQueueName())) {
    builder.setSchedulerQueueName(config.getSchedulerQueueName());
  }
  nsStore.update(builder.build());
}

Fixed version (ground truth):
@Override public synchronized void updateProperties(Id.Namespace namespaceId,NamespaceMeta namespaceMeta) throws Exception {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  authorizerInstantiator.get().enforce(namespaceId.toEntityId(),SecurityRequestContext.toPrincipal(),Action.ADMIN);
  NamespaceMeta metadata=nsStore.get(namespaceId);
  NamespaceMeta.Builder builder=new NamespaceMeta.Builder(metadata);
  if (namespaceMeta.getDescription() != null) {
    builder.setDescription(namespaceMeta.getDescription());
  }
  NamespaceConfig config=namespaceMeta.getConfig();
  if (config != null && !Strings.isNullOrEmpty(config.getSchedulerQueueName())) {
    builder.setSchedulerQueueName(config.getSchedulerQueueName());
  }
  nsStore.update(builder.build());
}
Program: 6162
Project: 6162
Buggy source:
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 */
@Override public synchronized void create(NamespaceMeta metadata) throws Exception {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  NamespaceId namespace=new NamespaceId(metadata.getName());
  if (exists(namespace.toId())) {
    throw new NamespaceAlreadyExistsException(namespace.toId());
  }
  Principal principal=SecurityRequestContext.toPrincipal();
  if (!(Principal.SYSTEM.equals(principal) && NamespaceId.DEFAULT.equals(namespace))) {
    authorizerInstantiatorService.get().enforce(instanceId,principal,Action.ADMIN);
  }
  try {
    dsFramework.createNamespace(namespace.toId());
  }
 catch (  DatasetManagementException e) {
    throw new NamespaceCannotBeCreatedException(namespace.toId(),e);
  }
  nsStore.create(metadata);
  if (!(Principal.SYSTEM.equals(principal) && NamespaceId.DEFAULT.equals(namespace))) {
    authorizerInstantiatorService.get().grant(namespace,principal,ImmutableSet.of(Action.ALL));
  }
}

Fixed version (ground truth):
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 */
@Override public synchronized void create(NamespaceMeta metadata) throws Exception {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  NamespaceId namespace=new NamespaceId(metadata.getName());
  if (exists(namespace.toId())) {
    throw new NamespaceAlreadyExistsException(namespace.toId());
  }
  Principal principal=SecurityRequestContext.toPrincipal();
  if (!(Principal.SYSTEM.equals(principal) && NamespaceId.DEFAULT.equals(namespace))) {
    authorizerInstantiator.get().enforce(instanceId,principal,Action.ADMIN);
  }
  try {
    dsFramework.createNamespace(namespace.toId());
  }
 catch (  DatasetManagementException e) {
    throw new NamespaceCannotBeCreatedException(namespace.toId(),e);
  }
  nsStore.create(metadata);
  if (!(Principal.SYSTEM.equals(principal) && NamespaceId.DEFAULT.equals(namespace))) {
    authorizerInstantiator.get().grant(namespace,principal,ImmutableSet.of(Action.ALL));
  }
}
Program: 6163
Project: 6163
Buggy source:
@Inject DefaultNamespaceAdmin(Store store,NamespaceStore nsStore,PreferencesStore preferencesStore,DashboardStore dashboardStore,DatasetFramework dsFramework,ProgramRuntimeService runtimeService,QueueAdmin queueAdmin,StreamAdmin streamAdmin,MetricStore metricStore,Scheduler scheduler,ApplicationLifecycleService applicationLifecycleService,ArtifactRepository artifactRepository,AuthorizerInstantiatorService authorizerInstantiatorService,CConfiguration cConf){
  this.queueAdmin=queueAdmin;
  this.streamAdmin=streamAdmin;
  this.store=store;
  this.nsStore=nsStore;
  this.preferencesStore=preferencesStore;
  this.dashboardStore=dashboardStore;
  this.dsFramework=dsFramework;
  this.runtimeService=runtimeService;
  this.scheduler=scheduler;
  this.metricStore=metricStore;
  this.applicationLifecycleService=applicationLifecycleService;
  this.artifactRepository=artifactRepository;
  this.authorizerInstantiatorService=authorizerInstantiatorService;
  this.instanceId=createInstanceId(cConf);
}

Fixed version (ground truth):
@Inject DefaultNamespaceAdmin(Store store,NamespaceStore nsStore,PreferencesStore preferencesStore,DashboardStore dashboardStore,DatasetFramework dsFramework,ProgramRuntimeService runtimeService,QueueAdmin queueAdmin,StreamAdmin streamAdmin,MetricStore metricStore,Scheduler scheduler,ApplicationLifecycleService applicationLifecycleService,ArtifactRepository artifactRepository,AuthorizerInstantiator authorizerInstantiator,CConfiguration cConf){
  this.queueAdmin=queueAdmin;
  this.streamAdmin=streamAdmin;
  this.store=store;
  this.nsStore=nsStore;
  this.preferencesStore=preferencesStore;
  this.dashboardStore=dashboardStore;
  this.dsFramework=dsFramework;
  this.runtimeService=runtimeService;
  this.scheduler=scheduler;
  this.metricStore=metricStore;
  this.applicationLifecycleService=applicationLifecycleService;
  this.artifactRepository=artifactRepository;
  this.authorizerInstantiator=authorizerInstantiator;
  this.instanceId=createInstanceId(cConf);
}
Program: 6166
Project: 6166
Buggy source:
@Test public void testCompatibleType() throws SerDeException, IOException {
  TextStringMapHolder o1=new TextStringMapHolder();
  StructObjectInspector oi1=(StructObjectInspector)ObjectInspectorFactory.getReflectionObjectInspector(TextStringMapHolder.class);
  LazySimpleSerDe serde=new LazySimpleSerDe();
  Configuration conf=new Configuration();
  Properties tbl=new Properties();
  tbl.setProperty(serdeConstants.LIST_COLUMNS,ObjectInspectorUtils.getFieldNames(oi1));
  tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES,ObjectInspectorUtils.getFieldTypes(oi1));
  SerDeParameters serdeParams=LazySimpleSerDe.initSerdeParams(conf,tbl,LazySimpleSerDe.class.getName());
  serde.initialize(conf,tbl);
  ObjectInspector oi2=serde.getObjectInspector();
  Object o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  int rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertEquals(0,rc);
  o1.mMap.put(new Text("String_Node_Str"),"String_Node_Str");
  o1.mMap.put(new Text("String_Node_Str"),"String_Node_Str");
  o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertEquals(0,rc);
  o1.mMap.put(new Text("String_Node_Str"),"String_Node_Str");
  rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertFalse(0 == rc);
}

Fixed version (ground truth):
@Test public void testCompatibleType() throws SerDeException, IOException {
  TextStringMapHolder o1=new TextStringMapHolder();
  StructObjectInspector oi1=(StructObjectInspector)ObjectInspectorFactory.getReflectionObjectInspector(TextStringMapHolder.class);
  LazySimpleSerDe serde=new LazySimpleSerDe();
  Configuration conf=new Configuration();
  Properties tbl=new Properties();
  tbl.setProperty(serdeConstants.LIST_COLUMNS,ObjectInspectorUtils.getFieldNames(oi1));
  tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES,ObjectInspectorUtils.getFieldTypes(oi1));
  LazySerDeParameters serdeParams=new LazySerDeParameters(conf,tbl,LazySimpleSerDe.class.getName());
  serde.initialize(conf,tbl);
  ObjectInspector oi2=serde.getObjectInspector();
  Object o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  int rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertEquals(0,rc);
  o1.mMap.put(new Text("String_Node_Str"),"String_Node_Str");
  o1.mMap.put(new Text("String_Node_Str"),"String_Node_Str");
  o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertEquals(0,rc);
  o1.mMap.put(new Text("String_Node_Str"),"String_Node_Str");
  rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertFalse(0 == rc);
}
Program: 6167
Project: 6167
Buggy source:
Object serializeAndDeserialize(StringTextMapHolder o1,StructObjectInspector oi1,LazySimpleSerDe serde,SerDeParameters serdeParams) throws IOException, SerDeException {
  ByteStream.Output serializeStream=new ByteStream.Output();
  LazySimpleSerDe.serialize(serializeStream,o1,oi1,serdeParams.getSeparators(),0,serdeParams.getNullSequence(),serdeParams.isEscaped(),serdeParams.getEscapeChar(),serdeParams.getNeedsEscape());
  Text t=new Text(serializeStream.toByteArray());
  return serde.deserialize(t);
}

Fixed version (ground truth):
Object serializeAndDeserialize(StringTextMapHolder o1,StructObjectInspector oi1,LazySimpleSerDe serde,LazySerDeParameters serdeParams) throws IOException, SerDeException {
  ByteStream.Output serializeStream=new ByteStream.Output();
  LazySimpleSerDe.serialize(serializeStream,o1,oi1,serdeParams.getSeparators(),0,serdeParams.getNullSequence(),serdeParams.isEscaped(),serdeParams.getEscapeChar(),serdeParams.getNeedsEscape());
  Text t=new Text(serializeStream.toByteArray());
  return serde.deserialize(t);
}
Program: 6168
Project: 6168
Buggy source:
@Test public void testIncompatibleType() throws SerDeException, IOException {
  StringTextMapHolder o1=new StringTextMapHolder();
  StructObjectInspector oi1=(StructObjectInspector)ObjectInspectorFactory.getReflectionObjectInspector(StringTextMapHolder.class);
  LazySimpleSerDe serde=new LazySimpleSerDe();
  Configuration conf=new Configuration();
  Properties tbl=new Properties();
  tbl.setProperty(serdeConstants.LIST_COLUMNS,ObjectInspectorUtils.getFieldNames(oi1));
  tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES,ObjectInspectorUtils.getFieldTypes(oi1));
  SerDeParameters serdeParams=LazySimpleSerDe.initSerdeParams(conf,tbl,LazySimpleSerDe.class.getName());
  serde.initialize(conf,tbl);
  ObjectInspector oi2=serde.getObjectInspector();
  Object o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  int rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertEquals(0,rc);
  o1.mMap.put("String_Node_Str",new Text("String_Node_Str"));
  o1.mMap.put("String_Node_Str",new Text("String_Node_Str"));
  o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertFalse(0 == rc);
}

Fixed version (ground truth):
@Test public void testIncompatibleType() throws SerDeException, IOException {
  StringTextMapHolder o1=new StringTextMapHolder();
  StructObjectInspector oi1=(StructObjectInspector)ObjectInspectorFactory.getReflectionObjectInspector(StringTextMapHolder.class);
  LazySimpleSerDe serde=new LazySimpleSerDe();
  Configuration conf=new Configuration();
  Properties tbl=new Properties();
  tbl.setProperty(serdeConstants.LIST_COLUMNS,ObjectInspectorUtils.getFieldNames(oi1));
  tbl.setProperty(serdeConstants.LIST_COLUMN_TYPES,ObjectInspectorUtils.getFieldTypes(oi1));
  LazySerDeParameters serdeParams=new LazySerDeParameters(conf,tbl,LazySimpleSerDe.class.getName());
  serde.initialize(conf,tbl);
  ObjectInspector oi2=serde.getObjectInspector();
  Object o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  int rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertEquals(0,rc);
  o1.mMap.put("String_Node_Str",new Text("String_Node_Str"));
  o1.mMap.put("String_Node_Str",new Text("String_Node_Str"));
  o2=serializeAndDeserialize(o1,oi1,serde,serdeParams);
  rc=ObjectInspectorUtils.compare(o1,oi1,o2,oi2,new SimpleMapEqualComparer());
  Assert.assertFalse(0 == rc);
}
Program: 6169
Project: 6169
Buggy source:
@Override protected void before() throws Throwable {
  tmpFolder.create();
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder().getAbsolutePath());
  cConf.set(Constants.Router.ADDRESS,getLocalHostname());
  cConf.setInt(Constants.Router.ROUTER_PORT,Networks.getRandomPort());
  cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET,true);
  cConf.setBoolean(Constants.Explore.EXPLORE_ENABLED,true);
  cConf.setBoolean(Constants.Explore.START_ON_DEMAND,true);
  cConf.setBoolean(StandaloneMain.DISABLE_UI,true);
  for (int i=0; i < configs.length; i+=2) {
    cConf.set(configs[i].toString(),configs[i + 1].toString());
  }
  this.cConf=cConf;
  standaloneMain=StandaloneMain.create(cConf,new Configuration());
  standaloneMain.startUp();
  try {
    waitForStandalone();
  }
 catch (  Throwable t) {
    standaloneMain.shutDown();
    throw t;
  }
}

Fixed version (ground truth):
@Override protected void before() throws Throwable {
  tmpFolder.create();
  CConfiguration cConf=CConfiguration.create();
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder().getAbsolutePath());
  cConf.set(Constants.Router.ADDRESS,getLocalHostname());
  cConf.setInt(Constants.Router.ROUTER_PORT,Networks.getRandomPort());
  cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET,true);
  cConf.setBoolean(Constants.Explore.EXPLORE_ENABLED,true);
  cConf.setBoolean(Constants.Explore.START_ON_DEMAND,true);
  cConf.setBoolean(StandaloneMain.DISABLE_UI,true);
  cConf.setBoolean(Constants.Audit.ENABLED,false);
  for (int i=0; i < configs.length; i+=2) {
    cConf.set(configs[i].toString(),configs[i + 1].toString());
  }
  this.cConf=cConf;
  standaloneMain=StandaloneMain.create(cConf,new Configuration());
  standaloneMain.startUp();
  try {
    waitForStandalone();
  }
 catch (  Throwable t) {
    standaloneMain.shutDown();
    throw t;
  }
}
Program: 6170
Project: 6170
Buggy source:
@Override protected void runOneIteration() throws Exception {
  for (  Map.Entry<Id.Namespace,StreamSpecification> streamSpecEntry : streamMetaStore.listStreams().entries()) {
    Id.Stream streamId=Id.Stream.from(streamSpecEntry.getKey(),streamSpecEntry.getValue().getName());
    StreamSizeAggregator streamSizeAggregator=aggregators.get(streamId);
    try {
      if (streamSizeAggregator == null) {
        StreamConfig config=streamAdmin.getConfig(streamId);
        streamSizeAggregator=createSizeAggregator(streamId,0,config.getNotificationThresholdMB());
      }
      streamSizeAggregator.checkAggregatedSize();
    }
 catch (    Exception e) {
      LOG.warn("String_Node_Str",streamId,e);
    }
  }
}

Fixed version (ground truth):
@Override protected void runOneIteration() throws Exception {
  for (  Map.Entry<Id.Namespace,StreamSpecification> streamSpecEntry : streamMetaStore.listStreams().entries()) {
    Id.Stream streamId=Id.Stream.from(streamSpecEntry.getKey(),streamSpecEntry.getValue().getName());
    StreamSizeAggregator streamSizeAggregator=aggregators.get(streamId);
    try {
      if (streamSizeAggregator == null) {
        StreamConfig config;
        try {
          config=streamAdmin.getConfig(streamId);
        }
 catch (        FileNotFoundException e) {
          continue;
        }
        streamSizeAggregator=createSizeAggregator(streamId,0,config.getNotificationThresholdMB());
      }
      streamSizeAggregator.checkAggregatedSize();
    }
 catch (    Exception e) {
      LOG.warn("String_Node_Str",streamId,e);
    }
  }
}
Program: 6171
Project: 6171
Buggy source:
@Override protected void initialize() throws Exception {
  for (  Map.Entry<Id.Namespace,StreamSpecification> streamSpecEntry : streamMetaStore.listStreams().entries()) {
    Id.Stream streamId=Id.Stream.from(streamSpecEntry.getKey(),streamSpecEntry.getValue().getName());
    StreamConfig config=streamAdmin.getConfig(streamId);
    long eventsSizes=getStreamEventsSize(streamId);
    createSizeAggregator(streamId,eventsSizes,config.getNotificationThresholdMB());
  }
}

Fixed version (ground truth):
@Override protected void initialize() throws Exception {
  for (  Map.Entry<Id.Namespace,StreamSpecification> streamSpecEntry : streamMetaStore.listStreams().entries()) {
    Id.Stream streamId=Id.Stream.from(streamSpecEntry.getKey(),streamSpecEntry.getValue().getName());
    StreamConfig config;
    try {
      config=streamAdmin.getConfig(streamId);
    }
 catch (    FileNotFoundException e) {
      LOG.warn("String_Node_Str" + "String_Node_Str",streamId);
      continue;
    }
catch (    Exception e) {
      LOG.warn("String_Node_Str" + "String_Node_Str",streamId,e);
      continue;
    }
    long eventsSizes=getStreamEventsSize(streamId);
    createSizeAggregator(streamId,eventsSizes,config.getNotificationThresholdMB());
  }
}
Program: 6172
Project: 6172
Buggy source:
@DELETE @Path("String_Node_Str") public void delete(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String stream) throws Exception {
  Id.Stream streamId=Id.Stream.from(namespaceId,stream);
  checkStreamExists(streamId);
  streamAdmin.drop(streamId);
  responder.sendStatus(HttpResponseStatus.OK);
}

Fixed version (ground truth):
@DELETE @Path("String_Node_Str") public void delete(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String stream) throws Exception {
  Id.Stream streamId=Id.Stream.from(namespaceId,stream);
  checkStreamExists(streamId);
  streamWriter.close(streamId);
  streamAdmin.drop(streamId);
  responder.sendStatus(HttpResponseStatus.OK);
}
Program: 6173
Project: 6173
Buggy source:
@Override public StreamConfig getConfig(Id.Stream streamId) throws IOException {
  Location configLocation=getConfigLocation(streamId);
  Preconditions.checkArgument(configLocation.exists(),"String_Node_Str",streamId);
  StreamConfig config=GSON.fromJson(CharStreams.toString(CharStreams.newReaderSupplier(Locations.newInputSupplier(configLocation),Charsets.UTF_8)),StreamConfig.class);
  int threshold=config.getNotificationThresholdMB();
  if (threshold <= 0) {
    threshold=cConf.getInt(Constants.Stream.NOTIFICATION_THRESHOLD);
  }
  return new StreamConfig(streamId,config.getPartitionDuration(),config.getIndexInterval(),config.getTTL(),getStreamLocation(streamId),config.getFormat(),threshold);
}

Fixed version (ground truth):
@Override public StreamConfig getConfig(Id.Stream streamId) throws IOException {
  Location configLocation=getConfigLocation(streamId);
  if (!configLocation.exists()) {
    throw new FileNotFoundException(String.format("String_Node_Str",configLocation.toURI().getPath(),streamId));
  }
  StreamConfig config=GSON.fromJson(CharStreams.toString(CharStreams.newReaderSupplier(Locations.newInputSupplier(configLocation),Charsets.UTF_8)),StreamConfig.class);
  int threshold=config.getNotificationThresholdMB();
  if (threshold <= 0) {
    threshold=cConf.getInt(Constants.Stream.NOTIFICATION_THRESHOLD);
  }
  return new StreamConfig(streamId,config.getPartitionDuration(),config.getIndexInterval(),config.getTTL(),getStreamLocation(streamId),config.getFormat(),threshold);
}
Program: 6174
Project: 6174
Buggy source:
private static MetricsContext createMetricsContext(Program program,String runId,MetricsCollectionService service,@Nullable WorkflowProgramInfo workflowProgramInfo){
  Map<String,String> tags=Maps.newHashMap();
  tags.putAll(getMetricsContext(program,runId));
  MetricsContext programMetricsContext=service.getContext(tags);
  if (workflowProgramInfo == null) {
    return programMetricsContext;
  }
  tags=Maps.newHashMap();
  tags.put(Constants.Metrics.Tag.NAMESPACE,program.getNamespaceId());
  tags.put(Constants.Metrics.Tag.APP,program.getApplicationId());
  tags.put(Constants.Metrics.Tag.WORKFLOW,workflowProgramInfo.getName());
  tags.put(Constants.Metrics.Tag.RUN_ID,workflowProgramInfo.getRunId().getId());
  tags.put(Constants.Metrics.Tag.NODE,workflowProgramInfo.getNodeId());
  return new MultiMetricsContext(programMetricsContext,service.getContext(tags));
}

Fixed version (ground truth):
private static MetricsContext createMetricsContext(Program program,String runId,MetricsCollectionService service,@Nullable WorkflowProgramInfo workflowProgramInfo){
  Map<String,String> tags=Maps.newHashMap();
  tags.putAll(getMetricsContext(program,runId));
  if (workflowProgramInfo != null) {
    tags.put(Constants.Metrics.Tag.WORKFLOW,workflowProgramInfo.getName());
    tags.put(Constants.Metrics.Tag.WORKFLOW_RUN_ID,workflowProgramInfo.getRunId().getId());
    tags.put(Constants.Metrics.Tag.NODE,workflowProgramInfo.getNodeId());
  }
  return service.getContext(tags);
}
Program: 6175
Project: 6175
Buggy source:
private static MetricsContext createMetricsContext(Program program,String runId,MetricsCollectionService service,String taskId,@Nullable MapReduceMetrics.TaskType type,@Nullable WorkflowProgramInfo workflowProgramInfo){
  Map<String,String> tags=Maps.newHashMap();
  tags.putAll(getMetricsContext(program,runId));
  if (type != null) {
    tags.put(Constants.Metrics.Tag.MR_TASK_TYPE,type.getId());
    tags.put(Constants.Metrics.Tag.INSTANCE_ID,taskId);
  }
  MetricsContext programMetricsContext=service.getContext(tags);
  if (workflowProgramInfo == null) {
    return programMetricsContext;
  }
  tags=Maps.newHashMap();
  tags.put(Constants.Metrics.Tag.NAMESPACE,program.getNamespaceId());
  tags.put(Constants.Metrics.Tag.APP,program.getApplicationId());
  tags.put(Constants.Metrics.Tag.WORKFLOW,workflowProgramInfo.getName());
  tags.put(Constants.Metrics.Tag.RUN_ID,workflowProgramInfo.getRunId().getId());
  tags.put(Constants.Metrics.Tag.NODE,workflowProgramInfo.getNodeId());
  return new MultiMetricsContext(programMetricsContext,service.getContext(tags));
}

Fixed version (ground truth):
private static MetricsContext createMetricsContext(Program program,String runId,MetricsCollectionService service,String taskId,@Nullable MapReduceMetrics.TaskType type,@Nullable WorkflowProgramInfo workflowProgramInfo){
  Map<String,String> tags=Maps.newHashMap();
  tags.putAll(getMetricsContext(program,runId));
  if (type != null) {
    tags.put(Constants.Metrics.Tag.MR_TASK_TYPE,type.getId());
    tags.put(Constants.Metrics.Tag.INSTANCE_ID,taskId);
  }
  if (workflowProgramInfo != null) {
    tags.put(Constants.Metrics.Tag.WORKFLOW,workflowProgramInfo.getName());
    tags.put(Constants.Metrics.Tag.WORKFLOW_RUN_ID,workflowProgramInfo.getRunId().getId());
    tags.put(Constants.Metrics.Tag.NODE,workflowProgramInfo.getNodeId());
  }
  return service.getContext(tags);
}
Program: 6176
Project: 6176
Buggy source:
@Nullable private static MetricsContext getMetricCollector(Program program,String runId,@Nullable MetricsCollectionService service){
  if (service == null) {
    return null;
  }
  Map<String,String> tags=Maps.newHashMap(getMetricsContext(program,runId));
  return service.getContext(tags);
}

Fixed version (ground truth):
@Nullable private static MetricsContext getMetricCollector(Program program,String runId,@Nullable MetricsCollectionService service){
  if (service == null) {
    return null;
  }
  Map<String,String> tags=Maps.newHashMap();
  tags.put(Constants.Metrics.Tag.NAMESPACE,program.getNamespaceId());
  tags.put(Constants.Metrics.Tag.APP,program.getApplicationId());
  tags.put(ProgramTypeMetricTag.getTagName(program.getType()),program.getName());
  tags.put(Constants.Metrics.Tag.WORKFLOW_RUN_ID,runId);
  return service.getContext(tags);
}
Program: 6177
Project: 6177
Buggy source:
public CubeDataset(String name,MetricsTable entityTable,Map<Integer,Table> resolutionTables,Map<String,? extends Aggregation> aggregations){
  super(name,entityTable,resolutionTables.values().toArray(new Dataset[resolutionTables.values().size()]));
  this.entityTable=entityTable;
  this.resolutionTables=resolutionTables;
  int[] resolutions=new int[resolutionTables.keySet().size()];
  int index=0;
  for (  Integer resolution : resolutionTables.keySet()) {
    resolutions[index++]=resolution;
  }
  this.cube=new DefaultCube(resolutions,new FactTableSupplierImpl(entityTable,resolutionTables),aggregations);
}

Fixed version (ground truth):
public CubeDataset(String name,MetricsTable entityTable,Map<Integer,Table> resolutionTables,Map<String,? extends Aggregation> aggregations){
  super(name,entityTable,resolutionTables.values().toArray(new Dataset[resolutionTables.values().size()]));
  this.entityTable=entityTable;
  this.resolutionTables=resolutionTables;
  int[] resolutions=new int[resolutionTables.keySet().size()];
  int index=0;
  for (  Integer resolution : resolutionTables.keySet()) {
    resolutions[index++]=resolution;
  }
  this.cube=new DefaultCube(resolutions,new FactTableSupplierImpl(entityTable,resolutionTables),aggregations,ImmutableMap.<String,AggregationAlias>of());
}
Program: 6178
Project: 6178
Buggy source:
public DefaultCube(int[] resolutions,FactTableSupplier factTableSupplier,Map<String,? extends Aggregation> aggregations){
  this.aggregations=aggregations;
  this.resolutionToFactTable=Maps.newHashMap();
  for (  int resolution : resolutions) {
    resolutionToFactTable.put(resolution,factTableSupplier.get(resolution,3600));
  }
}

Fixed version (ground truth):
public DefaultCube(int[] resolutions,FactTableSupplier factTableSupplier,Map<String,? extends Aggregation> aggregations,Map<String,AggregationAlias> aggregationAliasMap){
  this.aggregations=aggregations;
  this.resolutionToFactTable=Maps.newHashMap();
  for (  int resolution : resolutions) {
    resolutionToFactTable.put(resolution,factTableSupplier.get(resolution,3600));
  }
  this.aggregationAliasMap=aggregationAliasMap;
}
Program: 6179
Project: 6179
Buggy source:
@Override public void add(Collection<? extends CubeFact> facts){
  List<Fact> toWrite=Lists.newArrayList();
  int dimValuesCount=0;
  for (  CubeFact fact : facts) {
    for (    Aggregation agg : aggregations.values()) {
      if (agg.accept(fact)) {
        List<DimensionValue> dimensionValues=Lists.newArrayList();
        for (        String dimensionName : agg.getDimensionNames()) {
          dimensionValues.add(new DimensionValue(dimensionName,fact.getDimensionValues().get(dimensionName)));
          dimValuesCount++;
        }
        toWrite.add(new Fact(fact.getTimestamp(),dimensionValues,fact.getMeasurements()));
      }
    }
  }
  for (  FactTable table : resolutionToFactTable.values()) {
    table.add(toWrite);
  }
  incrementMetric("String_Node_Str",1);
  incrementMetric("String_Node_Str",facts.size());
  incrementMetric("String_Node_Str",toWrite.size());
  incrementMetric("String_Node_Str",dimValuesCount);
  incrementMetric("String_Node_Str",toWrite.size() * resolutionToFactTable.size());
}

Fixed version (ground truth):
@Override public void add(Collection<? extends CubeFact> facts){
  List<Fact> toWrite=Lists.newArrayList();
  int dimValuesCount=0;
  for (  CubeFact fact : facts) {
    for (    Map.Entry<String,? extends Aggregation> aggEntry : aggregations.entrySet()) {
      Aggregation agg=aggEntry.getValue();
      AggregationAlias aggregationAlias=null;
      if (aggregationAliasMap.containsKey(aggEntry.getKey())) {
        aggregationAlias=aggregationAliasMap.get(aggEntry.getKey());
      }
      if (agg.accept(fact)) {
        List<DimensionValue> dimensionValues=Lists.newArrayList();
        for (        String dimensionName : agg.getDimensionNames()) {
          String dimensionValueKey=aggregationAlias == null ? dimensionName : aggregationAlias.getAlias(dimensionName);
          dimensionValues.add(new DimensionValue(dimensionName,fact.getDimensionValues().get(dimensionValueKey)));
          dimValuesCount++;
        }
        toWrite.add(new Fact(fact.getTimestamp(),dimensionValues,fact.getMeasurements()));
      }
    }
  }
  for (  FactTable table : resolutionToFactTable.values()) {
    table.add(toWrite);
  }
  incrementMetric("String_Node_Str",1);
  incrementMetric("String_Node_Str",facts.size());
  incrementMetric("String_Node_Str",toWrite.size());
  incrementMetric("String_Node_Str",dimValuesCount);
  incrementMetric("String_Node_Str",toWrite.size() * resolutionToFactTable.size());
}
Program: 6180
Project: 6180
Buggy source:
@Override protected Cube getCube(final String name,int[] resolutions,Map<String,? extends Aggregation> aggregations){
  FactTableSupplier supplier=new FactTableSupplier(){
    @Override public FactTable get(    int resolution,    int rollTime){
      String entityTableName="String_Node_Str" + name;
      InMemoryTableService.create(entityTableName);
      String dataTableName="String_Node_Str" + name + "String_Node_Str"+ resolution;
      InMemoryTableService.create(dataTableName);
      return new FactTable(new InMemoryMetricsTable(dataTableName),new EntityTable(new InMemoryMetricsTable(entityTableName)),resolution,rollTime);
    }
  }
;
  return new DefaultCube(resolutions,supplier,aggregations);
}

Fixed version (ground truth):
@Override protected Cube getCube(final String name,int[] resolutions,Map<String,? extends Aggregation> aggregations){
  FactTableSupplier supplier=new FactTableSupplier(){
    @Override public FactTable get(    int resolution,    int rollTime){
      String entityTableName="String_Node_Str" + name;
      InMemoryTableService.create(entityTableName);
      String dataTableName="String_Node_Str" + name + "String_Node_Str"+ resolution;
      InMemoryTableService.create(dataTableName);
      return new FactTable(new InMemoryMetricsTable(dataTableName),new EntityTable(new InMemoryMetricsTable(entityTableName)),resolution,rollTime);
    }
  }
;
  return new DefaultCube(resolutions,supplier,aggregations,ImmutableMap.<String,AggregationAlias>of());
}