nus-yam/ex-repair huggingface dataset:
Program: 6649
Project: 6649
Buggy source:
@Override public synchronized void deleteDatasets(Id.Namespace namespaceId) throws NamespaceNotFoundException, NamespaceCannotBeDeletedException {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  if (checkProgramsRunning(namespaceId)) {
    throw new NamespaceCannotBeDeletedException(namespaceId,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",namespaceId));
  }
  try {
    dsFramework.deleteAllInstances(namespaceId);
  }
 catch (  DatasetManagementException|IOException|ServiceUnavailableException 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 NamespaceNotFoundException, NamespaceCannotBeDeletedException {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  if (checkProgramsRunning(namespaceId)) {
    throw new NamespaceCannotBeDeletedException(namespaceId,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",namespaceId));
  }
  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: 6650
Project: 6650
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
 */
public synchronized void create(NamespaceMeta metadata) throws NamespaceCannotBeCreatedException, NamespaceAlreadyExistsException {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  Id.Namespace namespace=Id.Namespace.from(metadata.getName());
  if (exists(Id.Namespace.from(metadata.getName()))) {
    throw new NamespaceAlreadyExistsException(namespace);
  }
  try {
    dsFramework.createNamespace(Id.Namespace.from(metadata.getName()));
  }
 catch (  DatasetManagementException|ServiceUnavailableException e) {
    throw new NamespaceCannotBeCreatedException(namespace,e);
  }
  store.createNamespace(metadata);
}

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
 */
public synchronized void create(NamespaceMeta metadata) throws NamespaceCannotBeCreatedException, NamespaceAlreadyExistsException {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  Id.Namespace namespace=Id.Namespace.from(metadata.getName());
  if (exists(Id.Namespace.from(metadata.getName()))) {
    throw new NamespaceAlreadyExistsException(namespace);
  }
  try {
    dsFramework.createNamespace(Id.Namespace.from(metadata.getName()));
  }
 catch (  DatasetManagementException e) {
    throw new NamespaceCannotBeCreatedException(namespace,e);
  }
  store.createNamespace(metadata);
}
Program: 6651
Project: 6651
Buggy source:
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by artifact store.
 * @param framework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework framework) throws IOException, DatasetManagementException, ServiceUnavailableException {
  framework.addInstance(Table.class.getName(),META_ID,META_PROPERTIES);
}

Fixed version (ground truth):
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by artifact store.
 * @param framework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework framework) throws IOException, DatasetManagementException {
  framework.addInstance(Table.class.getName(),META_ID,META_PROPERTIES);
}
Program: 6652
Project: 6652
Buggy source:
/** 
 * Initialize this persistent store.
 */
public void initialize() throws IOException, DatasetManagementException, ServiceUnavailableException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
}

Fixed version (ground truth):
/** 
 * Initialize this persistent store.
 */
public void initialize() throws IOException, DatasetManagementException {
  table=tableUtil.getMetaTable();
  Preconditions.checkNotNull(table,"String_Node_Str",ScheduleStoreTableUtil.SCHEDULE_STORE_DATASET_NAME);
}
Program: 6653
Project: 6653
Buggy source:
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by schedule mds.
 * @param datasetFramework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework datasetFramework) throws IOException, DatasetManagementException, ServiceUnavailableException {
  Id.DatasetInstance scheduleStoreDatasetInstance=Id.DatasetInstance.from(Id.Namespace.SYSTEM,SCHEDULE_STORE_DATASET_NAME);
  datasetFramework.addInstance(Table.class.getName(),scheduleStoreDatasetInstance,DatasetProperties.EMPTY);
}

Fixed version (ground truth):
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by schedule mds.
 * @param datasetFramework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework datasetFramework) throws IOException, DatasetManagementException {
  Id.DatasetInstance scheduleStoreDatasetInstance=Id.DatasetInstance.from(Id.Namespace.SYSTEM,SCHEDULE_STORE_DATASET_NAME);
  datasetFramework.addInstance(Table.class.getName(),scheduleStoreDatasetInstance,DatasetProperties.EMPTY);
}
Program: 6654
Project: 6654
Buggy source:
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by app mds.
 * @param framework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework framework) throws IOException, DatasetManagementException, ServiceUnavailableException {
  framework.addInstance(Table.class.getName(),APP_META_INSTANCE_ID,DatasetProperties.EMPTY);
  framework.addInstance(Table.class.getName(),WORKFLOW_STATS_INSTANCE_ID,DatasetProperties.EMPTY);
}

Fixed version (ground truth):
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by app mds.
 * @param framework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework framework) throws IOException, DatasetManagementException {
  framework.addInstance(Table.class.getName(),APP_META_INSTANCE_ID,DatasetProperties.EMPTY);
  framework.addInstance(Table.class.getName(),WORKFLOW_STATS_INSTANCE_ID,DatasetProperties.EMPTY);
}
Program: 6655
Project: 6655
Buggy source:
@Nullable public <T extends DatasetAdmin>T getDatasetAdmin(Id.DatasetInstance datasetId) throws DatasetManagementException, IOException, ServiceUnavailableException {
  return datasetFramework.getAdmin(datasetId,parentClassLoader,classLoaderProvider);
}

Fixed version (ground truth):
@Nullable public <T extends DatasetAdmin>T getDatasetAdmin(Id.DatasetInstance datasetId) throws DatasetManagementException, IOException {
  return datasetFramework.getAdmin(datasetId,parentClassLoader,classLoaderProvider);
}
Program: 6656
Project: 6656
Buggy source:
public DatasetTypeMDS getTypeMetaTable() throws DatasetManagementException, IOException, ServiceUnavailableException {
  return (DatasetTypeMDS)DatasetsUtil.getOrCreateDataset(framework,META_TABLE_INSTANCE_ID,DatasetTypeMDS.class.getName(),DatasetProperties.EMPTY,null,null);
}

Fixed version (ground truth):
public DatasetTypeMDS getTypeMetaTable() throws DatasetManagementException, IOException {
  return (DatasetTypeMDS)DatasetsUtil.getOrCreateDataset(framework,META_TABLE_INSTANCE_ID,DatasetTypeMDS.class.getName(),DatasetProperties.EMPTY,null,null);
}
Program: 6657
Project: 6657
Buggy source:
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by dataset service mds.
 * @param datasetFramework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework datasetFramework) throws IOException, DatasetManagementException, ServiceUnavailableException {
  for (  Map.Entry<String,? extends DatasetModule> entry : getModules().entrySet()) {
    Id.DatasetModule moduleId=Id.DatasetModule.from(Id.Namespace.SYSTEM,entry.getKey());
    datasetFramework.addModule(moduleId,entry.getValue());
  }
  datasetFramework.addInstance(DatasetTypeMDS.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,META_TABLE_NAME),DatasetProperties.EMPTY);
  datasetFramework.addInstance(DatasetInstanceMDS.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,INSTANCE_TABLE_NAME),DatasetProperties.EMPTY);
}

Fixed version (ground truth):
/** 
 * Adds datasets and types to the given   {@link DatasetFramework} used by dataset service mds.
 * @param datasetFramework framework to add types and datasets to
 */
public static void setupDatasets(DatasetFramework datasetFramework) throws IOException, DatasetManagementException {
  for (  Map.Entry<String,? extends DatasetModule> entry : getModules().entrySet()) {
    Id.DatasetModule moduleId=Id.DatasetModule.from(Id.Namespace.SYSTEM,entry.getKey());
    datasetFramework.addModule(moduleId,entry.getValue());
  }
  datasetFramework.addInstance(DatasetTypeMDS.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,META_TABLE_NAME),DatasetProperties.EMPTY);
  datasetFramework.addInstance(DatasetInstanceMDS.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,INSTANCE_TABLE_NAME),DatasetProperties.EMPTY);
}
Program: 6658
Project: 6658
Buggy source:
public DatasetInstanceMDS getInstanceMetaTable() throws DatasetManagementException, IOException, ServiceUnavailableException {
  return (DatasetInstanceMDS)DatasetsUtil.getOrCreateDataset(framework,INSTANCE_TABLE_INSTANCE_ID,DatasetInstanceMDS.class.getName(),DatasetProperties.EMPTY,null,null);
}

Fixed version (ground truth):
public DatasetInstanceMDS getInstanceMetaTable() throws DatasetManagementException, IOException {
  return (DatasetInstanceMDS)DatasetsUtil.getOrCreateDataset(framework,INSTANCE_TABLE_INSTANCE_ID,DatasetInstanceMDS.class.getName(),DatasetProperties.EMPTY,null,null);
}
Program: 6659
Project: 6659
Buggy source:
private HttpResponse doRequest(HttpMethod method,String url) throws DatasetManagementException, ServiceUnavailableException {
  return doRequest(method,url,null,(InputSupplier<? extends InputStream>)null);
}

Fixed version (ground truth):
private HttpResponse doRequest(HttpMethod method,String url) throws DatasetManagementException {
  return doRequest(method,url,null,(InputSupplier<? extends InputStream>)null);
}
Program: 6660
Project: 6660
Buggy source:
private HttpResponse doDelete(String resource) throws DatasetManagementException, ServiceUnavailableException {
  return doRequest(HttpMethod.DELETE,resource);
}

Fixed version (ground truth):
private HttpResponse doDelete(String resource) throws DatasetManagementException {
  return doRequest(HttpMethod.DELETE,resource);
}
Program: 6661
Project: 6661
Buggy source:
private String resolve(String resource) throws DatasetManagementException, ServiceUnavailableException {
  Discoverable discoverable=endpointStrategySupplier.get().pick(1,TimeUnit.SECONDS);
  if (discoverable == null) {
    throw new ServiceUnavailableException("String_Node_Str");
  }
  InetSocketAddress addr=discoverable.getSocketAddress();
  return String.format("String_Node_Str",addr.getHostName(),addr.getPort(),Constants.Gateway.API_VERSION_3,namespaceId.getId(),resource);
}

Fixed version (ground truth):
private String resolve(String resource) throws DatasetManagementException {
  Discoverable discoverable=endpointStrategySupplier.get().pick(1,TimeUnit.SECONDS);
  if (discoverable == null) {
    throw new ServiceUnavailableException("String_Node_Str");
  }
  InetSocketAddress addr=discoverable.getSocketAddress();
  return String.format("String_Node_Str",addr.getHostName(),addr.getPort(),Constants.Gateway.API_VERSION_3,namespaceId.getId(),resource);
}
Program: 6662
Project: 6662
Buggy source:
public Collection<DatasetModuleMeta> getAllModules() throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doGet("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
  return GSON.fromJson(response.getResponseBodyAsString(),MODULE_META_LIST_TYPE);
}

Fixed version (ground truth):
public Collection<DatasetModuleMeta> getAllModules() throws DatasetManagementException {
  HttpResponse response=doGet("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
  return GSON.fromJson(response.getResponseBodyAsString(),MODULE_META_LIST_TYPE);
}
Program: 6663
Project: 6663
Buggy source:
public void deleteModules() throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doDelete("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
}

Fixed version (ground truth):
public void deleteModules() throws DatasetManagementException {
  HttpResponse response=doDelete("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
}
Program: 6664
Project: 6664
Buggy source:
public void updateInstance(String datasetInstanceName,DatasetProperties props) throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doPut("String_Node_Str" + datasetInstanceName + "String_Node_Str",GSON.toJson(props.getProperties()));
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new InstanceConflictException(String.format("String_Node_Str",datasetInstanceName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",datasetInstanceName,response));
  }
}

Fixed version (ground truth):
public void updateInstance(String datasetInstanceName,DatasetProperties props) throws DatasetManagementException {
  HttpResponse response=doPut("String_Node_Str" + datasetInstanceName + "String_Node_Str",GSON.toJson(props.getProperties()));
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new InstanceConflictException(String.format("String_Node_Str",datasetInstanceName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",datasetInstanceName,response));
  }
}
Program: 6665
Project: 6665
Buggy source:
public void addModule(String moduleName,String className,Location jarLocation) throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doRequest(HttpMethod.PUT,"String_Node_Str" + moduleName,ImmutableMultimap.of("String_Node_Str",className),Locations.newInputSupplier(jarLocation));
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new ModuleConflictException(String.format("String_Node_Str",moduleName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",moduleName,response));
  }
}

Fixed version (ground truth):
public void addModule(String moduleName,String className,Location jarLocation) throws DatasetManagementException {
  HttpResponse response=doRequest(HttpMethod.PUT,"String_Node_Str" + moduleName,ImmutableMultimap.of("String_Node_Str",className),Locations.newInputSupplier(jarLocation));
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new ModuleConflictException(String.format("String_Node_Str",moduleName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",moduleName,response));
  }
}
Program: 6666
Project: 6666
Buggy source:
public void createNamespace() throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doPut("String_Node_Str",GSON.toJson(namespaceId));
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
}

Fixed version (ground truth):
public void createNamespace() throws DatasetManagementException {
  HttpResponse response=doPut("String_Node_Str",GSON.toJson(namespaceId));
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
}
Program: 6667
Project: 6667
Buggy source:
private HttpResponse doPut(String resource,String body) throws DatasetManagementException, ServiceUnavailableException {
  return doRequest(HttpMethod.PUT,resource,null,body);
}

Fixed version (ground truth):
private HttpResponse doPut(String resource,String body) throws DatasetManagementException {
  return doRequest(HttpMethod.PUT,resource,null,body);
}
Program: 6668
Project: 6668
Buggy source:
public void addInstance(String datasetInstanceName,String datasetType,DatasetProperties props) throws DatasetManagementException, ServiceUnavailableException {
  DatasetInstanceConfiguration creationProperties=new DatasetInstanceConfiguration(datasetType,props.getProperties());
  HttpResponse response=doPut("String_Node_Str" + datasetInstanceName,GSON.toJson(creationProperties));
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new InstanceConflictException(String.format("String_Node_Str",datasetInstanceName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",datasetInstanceName,response));
  }
}

Fixed version (ground truth):
public void addInstance(String datasetInstanceName,String datasetType,DatasetProperties props) throws DatasetManagementException {
  DatasetInstanceConfiguration creationProperties=new DatasetInstanceConfiguration(datasetType,props.getProperties());
  HttpResponse response=doPut("String_Node_Str" + datasetInstanceName,GSON.toJson(creationProperties));
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new InstanceConflictException(String.format("String_Node_Str",datasetInstanceName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",datasetInstanceName,response));
  }
}
Program: 6669
Project: 6669
Buggy source:
public void deleteNamespace() throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doDelete("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
}

Fixed version (ground truth):
public void deleteNamespace() throws DatasetManagementException {
  HttpResponse response=doDelete("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
}
Program: 6670
Project: 6670
Buggy source:
public Collection<DatasetSpecificationSummary> getAllInstances() throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doGet("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
  return GSON.fromJson(response.getResponseBodyAsString(),SUMMARY_LIST_TYPE);
}

Fixed version (ground truth):
public Collection<DatasetSpecificationSummary> getAllInstances() throws DatasetManagementException {
  HttpResponse response=doGet("String_Node_Str");
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",response));
  }
  return GSON.fromJson(response.getResponseBodyAsString(),SUMMARY_LIST_TYPE);
}
Program: 6671
Project: 6671
Buggy source:
public DatasetTypeMeta getType(String typeName) throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doGet("String_Node_Str" + typeName);
  if (HttpResponseStatus.NOT_FOUND.getCode() == response.getResponseCode()) {
    return null;
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",typeName,response));
  }
  return GSON.fromJson(response.getResponseBodyAsString(),DatasetTypeMeta.class);
}

Fixed version (ground truth):
public DatasetTypeMeta getType(String typeName) throws DatasetManagementException {
  HttpResponse response=doGet("String_Node_Str" + typeName);
  if (HttpResponseStatus.NOT_FOUND.getCode() == response.getResponseCode()) {
    return null;
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",typeName,response));
  }
  return GSON.fromJson(response.getResponseBodyAsString(),DatasetTypeMeta.class);
}
Program: 6672
Project: 6672
Buggy source:
public void deleteInstance(String datasetInstanceName) throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doDelete("String_Node_Str" + datasetInstanceName);
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new InstanceConflictException(String.format("String_Node_Str",datasetInstanceName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",datasetInstanceName,response));
  }
}

Fixed version (ground truth):
public void deleteInstance(String datasetInstanceName) throws DatasetManagementException {
  HttpResponse response=doDelete("String_Node_Str" + datasetInstanceName);
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new InstanceConflictException(String.format("String_Node_Str",datasetInstanceName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",datasetInstanceName,response));
  }
}
Program: 6673
Project: 6673
Buggy source:
@Nullable public DatasetMeta getInstance(String instanceName) throws DatasetManagementException, ServiceUnavailableException {
  return getInstance(instanceName,null);
}

Fixed version (ground truth):
@Nullable public DatasetMeta getInstance(String instanceName) throws DatasetManagementException {
  return getInstance(instanceName,null);
}
Program: 6674
Project: 6674
Buggy source:
public void deleteModule(String moduleName) throws DatasetManagementException, ServiceUnavailableException {
  HttpResponse response=doDelete("String_Node_Str" + moduleName);
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new ModuleConflictException(String.format("String_Node_Str",moduleName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",moduleName,response));
  }
}

Fixed version (ground truth):
public void deleteModule(String moduleName) throws DatasetManagementException {
  HttpResponse response=doDelete("String_Node_Str" + moduleName);
  if (HttpResponseStatus.CONFLICT.getCode() == response.getResponseCode()) {
    throw new ModuleConflictException(String.format("String_Node_Str",moduleName,response));
  }
  if (HttpResponseStatus.OK.getCode() != response.getResponseCode()) {
    throw new DatasetManagementException(String.format("String_Node_Str",moduleName,response));
  }
}
Program: 6675
Project: 6675
Buggy source:
private HttpResponse doGet(String resource,Multimap<String,String> headers) throws DatasetManagementException, ServiceUnavailableException {
  return doRequest(HttpMethod.GET,resource,headers,(InputSupplier<? extends InputStream>)null);
}

Fixed version (ground truth):
private HttpResponse doGet(String resource,Multimap<String,String> headers) throws DatasetManagementException {
  return doRequest(HttpMethod.GET,resource,headers,(InputSupplier<? extends InputStream>)null);
}
Program: 6676
Project: 6676
Buggy source:
@Override public boolean apply(RunRecordMeta record){
  boolean normalCheck=record.getStatus().equals(state.getRunStatus());
  return normalCheck;
}

Fixed version (ground truth):
@Override public RunId apply(RunRecordMeta runRecordMeta){
  return RunIds.fromString(runRecordMeta.getPid());
}
Program: 6677
Project: 6677
Buggy source:
@Override public WorkflowToken apply(AppMds mds) throws Exception {
  return mds.apps.getWorkflowToken(workflowId,workflowRunId);
}

Fixed version (ground truth):
@Override public Set<RunId> apply(AppMds input) throws Exception {
  return input.apps.getRunningInRange(startTimeInSecs,endTimeInSecs);
}
Program: 6678
Project: 6678
Buggy source:
@Inject LineageHandler(LineageService lineageService,LineageStore lineageStore){
  this.lineageService=lineageService;
  this.lineageStore=lineageStore;
}

Fixed version (ground truth):
@Inject LineageHandler(LineageGenerator lineageGenerator,LineageStore lineageStore){
  this.lineageGenerator=lineageGenerator;
  this.lineageStore=lineageStore;
}
Program: 6679
Project: 6679
Buggy source:
@GET @Path("String_Node_Str") public void streamLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String stream,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long start,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long end,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkArguments(start,end,levels);
  Id.Stream streamId=Id.Stream.from(namespaceId,stream);
  Lineage lineage=lineageService.computeLineage(streamId,start,end,levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(start,end,lineage.getRelations()),LineageRecord.class,GSON);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void streamLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String stream,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long start,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long end,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkArguments(start,end,levels);
  Id.Stream streamId=Id.Stream.from(namespaceId,stream);
  Lineage lineage=lineageGenerator.computeLineage(streamId,start,end,levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(start,end,lineage.getRelations()),LineageRecord.class,GSON);
}
Program: 6680
Project: 6680
Buggy source:
@GET @Path("String_Node_Str") public void datasetLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String datasetId,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long start,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long end,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkArguments(start,end,levels);
  Id.DatasetInstance datasetInstance=Id.DatasetInstance.from(namespaceId,datasetId);
  Lineage lineage=lineageService.computeLineage(datasetInstance,start,end,levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(start,end,lineage.getRelations()),LineageRecord.class,GSON);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void datasetLineage(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String datasetId,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long start,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") long end,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") int levels) throws Exception {
  checkArguments(start,end,levels);
  Id.DatasetInstance datasetInstance=Id.DatasetInstance.from(namespaceId,datasetId);
  Lineage lineage=lineageGenerator.computeLineage(datasetInstance,start,end,levels);
  responder.sendJson(HttpResponseStatus.OK,new LineageRecord(start,end,lineage.getRelations()),LineageRecord.class,GSON);
}
Program: 6681
Project: 6681
Buggy source:
private void addRelations(Set<Relation> lineageRelations){
  for (  Relation relation : lineageRelations) {
    String dataKey=makeDataKey(relation.getData());
    String programKey=makeProgramKey(relation.getProgram());
    RelationRecord relationRecord=new RelationRecord(dataKey,programKey,relation.getAccess().toString().toLowerCase(),convertRuns(relation.getRuns()),convertComponents(relation.getComponents()));
    relations.add(relationRecord);
    programs.put(programKey,ImmutableMap.of("String_Node_Str",toProgramRecord(relation.getProgram())));
    data.put(dataKey,ImmutableMap.of("String_Node_Str",toDataRecord(relation.getData())));
  }
}

Fixed version (ground truth):
private void addRelations(Set<Relation> lineageRelations){
  for (  Relation relation : lineageRelations) {
    String dataKey=makeDataKey(relation.getData());
    String programKey=makeProgramKey(relation.getProgram());
    RelationRecord relationRecord=new RelationRecord(dataKey,programKey,relation.getAccess().toString().toLowerCase(),convertRuns(relation.getRun()),convertComponents(relation.getComponents()));
    relations.add(relationRecord);
    programs.put(programKey,ImmutableMap.of("String_Node_Str",toProgramRecord(relation.getProgram())));
    data.put(dataKey,ImmutableMap.of("String_Node_Str",toDataRecord(relation.getData())));
  }
}
Program: 6682
Project: 6682
Buggy source:
private Set<String> convertRuns(Set<RunId> runIds){
  return Sets.newHashSet(Iterables.transform(runIds,RUN_ID_STRING_FUNCTION));
}

Fixed version (ground truth):
private Set<String> convertRuns(RunId runId){
  return ImmutableSet.of(runId.getId());
}
Program: 6683
Project: 6683
Buggy source:
private static Injector getInjector(){
  return dsFrameworkUtil.getInjector().createChildInjector(new AbstractModule(){
    @Override protected void configure(){
      install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class,DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
      bind(DatasetFramework.class).annotatedWith(Names.named(DataSetsModules.BASIC_DATASET_FRAMEWORK)).to(InMemoryDatasetFramework.class);
      bind(MetadataChangePublisher.class).to(NoOpMetadataChangePublisher.class);
      bind(BusinessMetadataStore.class).to(InMemoryBusinessMetadataStore.class);
    }
  }
);
}

Fixed version (ground truth):
private static Injector getInjector(){
  return dsFrameworkUtil.getInjector().createChildInjector(new AbstractModule(){
    @Override protected void configure(){
      install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class,DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
      bind(DatasetFramework.class).annotatedWith(Names.named(DataSetsModules.BASIC_DATASET_FRAMEWORK)).to(InMemoryDatasetFramework.class);
      bind(MetadataChangePublisher.class).to(NoOpMetadataChangePublisher.class);
      bind(BusinessMetadataStore.class).to(DefaultBusinessMetadataStore.class);
    }
  }
);
}
Program: 6684
Project: 6684
Buggy source:
@Override protected void configure(){
  install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class,DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
  bind(DatasetFramework.class).annotatedWith(Names.named(DataSetsModules.BASIC_DATASET_FRAMEWORK)).to(InMemoryDatasetFramework.class);
  bind(MetadataChangePublisher.class).to(NoOpMetadataChangePublisher.class);
  bind(BusinessMetadataStore.class).to(InMemoryBusinessMetadataStore.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class,DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
  bind(DatasetFramework.class).annotatedWith(Names.named(DataSetsModules.BASIC_DATASET_FRAMEWORK)).to(InMemoryDatasetFramework.class);
  bind(MetadataChangePublisher.class).to(NoOpMetadataChangePublisher.class);
  bind(BusinessMetadataStore.class).to(DefaultBusinessMetadataStore.class);
}
Program: 6686
Project: 6686
Buggy source:
@Test public void testMetadataPath(){
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testMetadataPath(){
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
  assertMetadataRouting("String_Node_Str");
}
Program: 6687
Project: 6687
Buggy source:
@GET @Path("String_Node_Str") public void getAccessesForRun(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String programType,@PathParam("String_Node_Str") String programId,@PathParam("String_Node_Str") String runId) throws Exception {
  Id.Run run=new Id.Run(Id.Program.from(namespaceId,appId,ProgramType.valueOfCategoryName(programType),programId),runId);
  responder.sendJson(HttpResponseStatus.OK,lineageStore.getAccesses(run),SET_METADATA_RECORD_TYPE,GSON);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void getAccessesForRun(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String programType,@PathParam("String_Node_Str") String programId,@PathParam("String_Node_Str") String runId) throws Exception {
  Id.Run run=new Id.Run(Id.Program.from(namespaceId,appId,ProgramType.valueOfCategoryName(programType),programId),runId);
  responder.sendJson(HttpResponseStatus.OK,lineageStore.getRunMetadata(run),SET_METADATA_RECORD_TYPE,GSON);
}
Program: 6690
Project: 6690
Buggy source:
@Test public void testOneRelation() throws Exception {
  LineageDataset lineageDataset=getLineageDataset("String_Node_Str");
  Assert.assertNotNull(lineageDataset);
  RunId runId=RunIds.generate(10000);
  Id.DatasetInstance datasetInstance=Id.DatasetInstance.from("String_Node_Str","String_Node_Str");
  Id.Program program=Id.Program.from("String_Node_Str","String_Node_Str",ProgramType.FLOW,"String_Node_Str");
  Id.Flow.Flowlet flowlet=Id.Flow.Flowlet.from(program.getApplication(),program.getId(),"String_Node_Str");
  Id.Run run=new Id.Run(program,runId.getId());
  MetadataRecord programMeta=new MetadataRecord(program,toMap("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),toSet("String_Node_Str","String_Node_Str"));
  MetadataRecord dataMeta=new MetadataRecord(datasetInstance,toMap("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),toSet("String_Node_Str","String_Node_Str"));
  Set<MetadataRecord> metadataRecords=toSet(programMeta,dataMeta);
  lineageDataset.addAccess(run,datasetInstance,AccessType.READ,metadataRecords,flowlet);
  Relation expected=new Relation(datasetInstance,program,AccessType.READ,ImmutableSet.of(runId),ImmutableSet.of(flowlet));
  Set<Relation> relations=lineageDataset.getRelations(datasetInstance,0,100000);
  Assert.assertEquals(1,relations.size());
  Assert.assertEquals(expected,relations.iterator().next());
  System.out.println(lineageDataset.getAccesses(run));
  Assert.assertEquals(metadataRecords,lineageDataset.getAccesses(run));
}

Fixed version (ground truth):
@Test public void testOneRelation() throws Exception {
  LineageDataset lineageDataset=getLineageDataset("String_Node_Str");
  Assert.assertNotNull(lineageDataset);
  RunId runId=RunIds.generate(10000);
  Id.DatasetInstance datasetInstance=Id.DatasetInstance.from("String_Node_Str","String_Node_Str");
  Id.Program program=Id.Program.from("String_Node_Str","String_Node_Str",ProgramType.FLOW,"String_Node_Str");
  Id.Flow.Flowlet flowlet=Id.Flow.Flowlet.from(program.getApplication(),program.getId(),"String_Node_Str");
  Id.Run run=new Id.Run(program,runId.getId());
  MetadataRecord programMeta=new MetadataRecord(program,toMap("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),toSet("String_Node_Str","String_Node_Str"));
  MetadataRecord dataMeta=new MetadataRecord(datasetInstance,toMap("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),toSet("String_Node_Str","String_Node_Str"));
  Set<MetadataRecord> metadataRecords=toSet(programMeta,dataMeta);
  lineageDataset.addAccess(run,datasetInstance,AccessType.READ,metadataRecords,flowlet);
  Relation expected=new Relation(datasetInstance,program,AccessType.READ,ImmutableSet.of(runId),ImmutableSet.of(flowlet));
  Set<Relation> relations=lineageDataset.getRelations(datasetInstance,0,100000);
  Assert.assertEquals(1,relations.size());
  Assert.assertEquals(expected,relations.iterator().next());
  Assert.assertEquals(metadataRecords,lineageDataset.getRunMetadata(run));
}
Program: 6696
Project: 6696
Buggy source:
@BeforeClass public static void beforeClass() throws Exception {
  HBaseTestingUtility hBaseTestingUtility=new HBaseTestingUtility();
  hBaseTestingUtility.startMiniDFSCluster(1);
  Configuration hConf=hBaseTestingUtility.getConfiguration();
  hConf.setBoolean("String_Node_Str",true);
  zkServer=InMemoryZKServer.builder().build();
  zkServer.startAndWait();
  cConf=CConfiguration.create();
  cConf.set(Constants.CFG_HDFS_USER,System.getProperty("String_Node_Str"));
  cConf.set(Constants.Zookeeper.QUORUM,zkServer.getConnectionStr());
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder().getAbsolutePath());
  cConf.setBoolean(TxConstants.Manager.CFG_DO_PERSIST,true);
  server=TransactionServiceTest.createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
  server.startAndWait();
  injector=Guice.createInjector(new ConfigModule(cConf,hConf),new ZKClientModule(),new LocationRuntimeModule().getInMemoryModules(),new DiscoveryRuntimeModule().getDistributedModules(),new TransactionMetricsModule(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(false));
  zkClient=injector.getInstance(ZKClientService.class);
  zkClient.startAndWait();
  txStateStorage=injector.getInstance(TransactionStateStorage.class);
  txStateStorage.startAndWait();
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws Exception {
  HBaseTestingUtility hBaseTestingUtility=new HBaseTestingUtility();
  hBaseTestingUtility.startMiniDFSCluster(1);
  Configuration hConf=hBaseTestingUtility.getConfiguration();
  hConf.setBoolean("String_Node_Str",true);
  zkServer=InMemoryZKServer.builder().build();
  zkServer.startAndWait();
  cConf=CConfiguration.create();
  cConf.set(Constants.CFG_HDFS_USER,System.getProperty("String_Node_Str"));
  cConf.set(Constants.Zookeeper.QUORUM,zkServer.getConnectionStr());
  cConf.set(Constants.CFG_LOCAL_DATA_DIR,tmpFolder.newFolder().getAbsolutePath());
  cConf.setBoolean(TxConstants.Manager.CFG_DO_PERSIST,true);
  server=TransactionServiceTest.createTxService(zkServer.getConnectionStr(),Networks.getRandomPort(),hConf,tmpFolder.newFolder());
  server.startAndWait();
  injector=Guice.createInjector(new ConfigModule(cConf,hConf),new ZKClientModule(),new LocationRuntimeModule().getInMemoryModules(),new DiscoveryRuntimeModule().getDistributedModules(),new TransactionMetricsModule(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules());
  zkClient=injector.getInstance(ZKClientService.class);
  zkClient.startAndWait();
  txStateStorage=injector.getInstance(TransactionStateStorage.class);
  txStateStorage.startAndWait();
}
Program: 6698
Project: 6698
Buggy source:
@Override protected void doInit(TwillContext context){
  this.user=DEFAULT_USER;
  CConfiguration cConf=getCConfiguration();
  Configuration hConf=getConfiguration();
  cConf.set(Constants.Dataset.Executor.ADDRESS,context.getHost().getHostName());
  injector=Guice.createInjector(new ConfigModule(cConf,hConf),new IOModule(),new ZKClientModule(),new KafkaClientModule(),new MetricsClientRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(),new DataSetServiceModules().getDistributedModules(),new LoggingModules().getDistributedModules(),new ExploreClientModule(),new NamespaceClientRuntimeModule().getDistributedModules(),new MetadataServiceModule());
  injector.getInstance(LogAppenderInitializer.class).initialize();
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(),Constants.Logging.COMPONENT_NAME,Constants.Service.DATASET_EXECUTOR));
}

Fixed version (ground truth):
@Override protected void doInit(TwillContext context){
  this.user=DEFAULT_USER;
  CConfiguration cConf=getCConfiguration();
  Configuration hConf=getConfiguration();
  cConf.set(Constants.Dataset.Executor.ADDRESS,context.getHost().getHostName());
  injector=Guice.createInjector(new ConfigModule(cConf,hConf),new IOModule(),new ZKClientModule(),new KafkaClientModule(),new MetricsClientRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(true),new DataSetServiceModules().getDistributedModules(),new LoggingModules().getDistributedModules(),new ExploreClientModule(),new NamespaceClientRuntimeModule().getDistributedModules(),new MetadataServiceModule());
  injector.getInstance(LogAppenderInitializer.class).initialize();
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(),Constants.Logging.COMPONENT_NAME,Constants.Service.DATASET_EXECUTOR));
}
Program: 6699
Project: 6699
Buggy source:
@Override public void reportResources(){
  for (  TwillRunner.LiveInfo info : twillRunner.lookupLive()) {
    Map<String,String> metricContext=getMetricContext(info);
    if (metricContext == null) {
      continue;
    }
    for (    TwillController controller : info.getControllers()) {
      ResourceReport report=controller.getResourceReport();
      if (report == null) {
        continue;
      }
      int memory=report.getAppMasterResources().getMemoryMB();
      int vcores=report.getAppMasterResources().getVirtualCores();
      Map<String,String> runContext=ImmutableMap.<String,String>builder().putAll(metricContext).put(Constants.Metrics.Tag.RUN_ID,controller.getRunId().getId()).build();
      sendMetrics(runContext,1,memory,vcores);
    }
  }
  reportClusterStorage();
  boolean reported=false;
  for (  URL url : rmUrls) {
    if (reportClusterMemory(url)) {
      reported=true;
      break;
    }
  }
  if (!reported) {
    LOG.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void reportResources(){
  for (  TwillRunner.LiveInfo info : twillRunner.lookupLive()) {
    Map<String,String> metricContext=getMetricContext(info);
    if (metricContext == null) {
      continue;
    }
    for (    TwillController controller : info.getControllers()) {
      ResourceReport report=controller.getResourceReport();
      if (report == null) {
        continue;
      }
      int memory=report.getAppMasterResources().getMemoryMB();
      int vcores=report.getAppMasterResources().getVirtualCores();
      Map<String,String> runContext=ImmutableMap.<String,String>builder().putAll(metricContext).put(Constants.Metrics.Tag.RUN_ID,controller.getRunId().getId()).build();
      sendMetrics(runContext,1,memory,vcores);
    }
  }
  boolean reported=false;
  for (  URL url : rmUrls) {
    if (reportClusterMemory(url)) {
      reported=true;
      break;
    }
  }
  if (!reported) {
    LOG.warn("String_Node_Str");
  }
}
Program: 6700
Project: 6700
Buggy source:
private boolean reportClusterMemory(URL url){
  Reader reader=null;
  HttpURLConnection conn=null;
  LOG.trace("String_Node_Str",url);
  try {
    conn=(HttpURLConnection)url.openConnection();
    conn.setRequestMethod("String_Node_Str");
    reader=new InputStreamReader(conn.getInputStream(),Charsets.UTF_8);
    JsonObject response;
    try {
      response=new Gson().fromJson(reader,JsonObject.class);
    }
 catch (    JsonParseException e) {
      return false;
    }
    if (response != null) {
      JsonObject clusterMetrics=response.getAsJsonObject("String_Node_Str");
      long totalMemory=clusterMetrics.get("String_Node_Str").getAsLong();
      long availableMemory=clusterMetrics.get("String_Node_Str").getAsLong();
      MetricsContext collector=getCollector();
      LOG.trace("String_Node_Str" + totalMemory + "String_Node_Str"+ availableMemory);
      collector.gauge("String_Node_Str",totalMemory);
      collector.gauge("String_Node_Str",availableMemory);
      return true;
    }
    return false;
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    return false;
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
    }
    if (conn != null) {
      conn.disconnect();
    }
  }
}

Fixed version (ground truth):
private boolean reportClusterMemory(URL url){
  Reader reader=null;
  HttpURLConnection conn=null;
  LOG.trace("String_Node_Str",url);
  try {
    conn=(HttpURLConnection)url.openConnection();
    conn.setRequestMethod("String_Node_Str");
    reader=new InputStreamReader(conn.getInputStream(),Charsets.UTF_8);
    JsonObject response;
    try {
      response=new Gson().fromJson(reader,JsonObject.class);
    }
 catch (    JsonParseException e) {
      return false;
    }
    if (response != null) {
      JsonObject clusterMetrics=response.getAsJsonObject("String_Node_Str");
      long totalMemory=clusterMetrics.get("String_Node_Str").getAsLong();
      long availableMemory=clusterMetrics.get("String_Node_Str").getAsLong();
      MetricsContext collector=getCollector();
      LOG.trace("String_Node_Str" + totalMemory + "String_Node_Str"+ availableMemory);
      collector.gauge("String_Node_Str",totalMemory);
      collector.gauge("String_Node_Str",availableMemory);
      return true;
    }
    return false;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    return false;
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",e);
      }
    }
    if (conn != null) {
      conn.disconnect();
    }
  }
}