nus-yam/ex-repair huggingface dataset:
Program: 6803
Project: 6803
Buggy source:
@Override public synchronized RuntimeInfo lookup(Id.Program programId,final RunId runId){
  RuntimeInfo runtimeInfo=super.lookup(programId,runId);
  if (runtimeInfo != null) {
    return runtimeInfo;
  }
  for (  TwillRunner.LiveInfo liveInfo : twillRunner.lookupLive()) {
    String appName=liveInfo.getApplicationName();
    Matcher matcher=APP_NAME_PATTERN.matcher(appName);
    if (!matcher.matches()) {
      continue;
    }
    ProgramType type=getType(matcher.group(1));
    Id.Program id=Id.Program.from(matcher.group(2),matcher.group(3),type,matcher.group(4));
    if (!id.equals(programId)) {
      continue;
    }
    RunRecord record=store.getRun(programId,runId.getId());
    if (record == null) {
      return null;
    }
    if (record.getTwillRunId() == null) {
      LOG.warn("String_Node_Str",programId,runId.getId());
      return null;
    }
    RunId twillRunIdFromRecord=org.apache.twill.internal.RunIds.fromString(record.getTwillRunId());
    for (    TwillController controller : liveInfo.getControllers()) {
      RunId twillRunId=controller.getRunId();
      if (!twillRunId.equals(twillRunIdFromRecord)) {
        continue;
      }
      runtimeInfo=createRuntimeInfo(programId,controller,runId);
      if (runtimeInfo != null) {
        updateRuntimeInfo(programId.getType(),runId,runtimeInfo);
      }
 else {
        LOG.warn("String_Node_Str",runId);
      }
      return runtimeInfo;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public synchronized RuntimeInfo lookup(Id.Program programId,final RunId runId){
  RuntimeInfo runtimeInfo=super.lookup(programId,runId);
  if (runtimeInfo != null) {
    return runtimeInfo;
  }
  for (  TwillRunner.LiveInfo liveInfo : twillRunner.lookupLive()) {
    String appName=liveInfo.getApplicationName();
    Matcher matcher=APP_NAME_PATTERN.matcher(appName);
    if (!matcher.matches()) {
      continue;
    }
    ProgramType type=getType(matcher.group(1));
    Id.Program id=Id.Program.from(matcher.group(2),matcher.group(3),type,matcher.group(4));
    if (!id.equals(programId)) {
      continue;
    }
    RunRecordMeta record=store.getRun(programId,runId.getId());
    if (record == null) {
      return null;
    }
    if (record.getTwillRunId() == null) {
      LOG.warn("String_Node_Str",programId,runId.getId());
      return null;
    }
    RunId twillRunIdFromRecord=org.apache.twill.internal.RunIds.fromString(record.getTwillRunId());
    for (    TwillController controller : liveInfo.getControllers()) {
      RunId twillRunId=controller.getRunId();
      if (!twillRunId.equals(twillRunIdFromRecord)) {
        continue;
      }
      runtimeInfo=createRuntimeInfo(programId,controller,runId);
      if (runtimeInfo != null) {
        updateRuntimeInfo(programId.getType(),runId,runtimeInfo);
      }
 else {
        LOG.warn("String_Node_Str",runId);
      }
      return runtimeInfo;
    }
  }
  return null;
}
Program: 6804
Project: 6804
Buggy source:
@Override public boolean apply(RunRecord record){
  return record.getTwillRunId() != null && twillRunIds.contains(org.apache.twill.internal.RunIds.fromString(record.getTwillRunId()));
}

Fixed version (ground truth):
@Override public boolean apply(RunRecordMeta record){
  return record.getTwillRunId() != null && twillRunIds.contains(org.apache.twill.internal.RunIds.fromString(record.getTwillRunId()));
}
Program: 6806
Project: 6806
Buggy source:
/** 
 * Helper method to get program id for a run record if it exists in the store.
 * @return instance of {@link Id.Program} if exist for the runId or null if does not.
 */
@Nullable private Id.Program validateProgramForRunRecord(String namespaceName,String appName,ProgramType programType,String programName,String runId){
  Id.Program programId=Id.Program.from(namespaceName,appName,programType,programName);
  RunRecord runRecord=store.getRun(programId,runId);
  if (runRecord != null) {
    return programId;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Helper method to get program id for a run record if it exists in the store.
 * @return instance of {@link Id.Program} if exist for the runId or null if does not.
 */
@Nullable private Id.Program validateProgramForRunRecord(String namespaceName,String appName,ProgramType programType,String programName,String runId){
  Id.Program programId=Id.Program.from(namespaceName,appName,programType,programName);
  RunRecordMeta runRecord=store.getRun(programId,runId);
  if (runRecord != null) {
    return programId;
  }
 else {
    return null;
  }
}
Program: 6807
Project: 6807
Buggy source:
@Override public boolean apply(@Nullable RunRecord input){
  if (input == null) {
    return false;
  }
  String runId=input.getPid();
  return !runIdToRuntimeInfo.containsKey(RunIds.fromString(runId));
}

Fixed version (ground truth):
@Override public boolean apply(@Nullable RunRecordMeta input){
  if (input == null) {
    return false;
  }
  String runId=input.getPid();
  return !runIdToRuntimeInfo.containsKey(RunIds.fromString(runId));
}
Program: 6808
Project: 6808
Buggy source:
/** 
 * Helper method to check if the run record is a child program of a Workflow
 * @param runRecord The target {@link RunRecord} to check
 * @param processedInvalidRunRecordIds the {@link Set} of processed invalid run record ids.
 * @return {@code true} of we should check and {@code false} otherwise
 */
private boolean shouldCorrectForWorkflowChildren(RunRecord runRecord,Set<String> processedInvalidRunRecordIds){
  if (runRecord.getProperties() != null && runRecord.getProperties().get("String_Node_Str") != null) {
    String workflowRunId=runRecord.getProperties().get("String_Node_Str");
    if (!processedInvalidRunRecordIds.contains(workflowRunId)) {
      Id.Program workflowProgramId=retrieveProgramIdForRunRecord(ProgramType.WORKFLOW,workflowRunId);
      if (workflowProgramId != null) {
        RunRecord wfRunRecord=store.getRun(workflowProgramId,workflowRunId);
        RuntimeInfo wfRuntimeInfo=runtimeService.lookup(workflowProgramId,RunIds.fromString(workflowRunId));
        if (wfRunRecord != null && wfRunRecord.getStatus() == ProgramRunStatus.RUNNING && wfRuntimeInfo != null) {
          return false;
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Helper method to check if the run record is a child program of a Workflow
 * @param runRecordMeta The target {@link RunRecordMeta} to check
 * @param processedInvalidRunRecordIds the {@link Set} of processed invalid run record ids.
 * @return {@code true} of we should check and {@code false} otherwise
 */
private boolean shouldCorrectForWorkflowChildren(RunRecordMeta runRecordMeta,Set<String> processedInvalidRunRecordIds){
  if (runRecordMeta.getProperties() != null && runRecordMeta.getProperties().get("String_Node_Str") != null) {
    String workflowRunId=runRecordMeta.getProperties().get("String_Node_Str");
    if (!processedInvalidRunRecordIds.contains(workflowRunId)) {
      Id.Program workflowProgramId=retrieveProgramIdForRunRecord(ProgramType.WORKFLOW,workflowRunId);
      if (workflowProgramId != null) {
        RunRecordMeta wfRunRecord=store.getRun(workflowProgramId,workflowRunId);
        RuntimeInfo wfRuntimeInfo=runtimeService.lookup(workflowProgramId,RunIds.fromString(workflowRunId));
        if (wfRunRecord != null && wfRunRecord.getStatus() == ProgramRunStatus.RUNNING && wfRuntimeInfo != null) {
          return false;
        }
      }
    }
  }
  return true;
}
Program: 6810
Project: 6810
Buggy source:
@Override public void process(ApplicationWithPrograms input) throws Exception {
  store.addApplication(input.getId(),input.getSpecification(),input.getLocation());
  ApplicationSpecification app=input.getSpecification();
  Id.Application appId=input.getId();
  Id.Namespace namespace=appId.getNamespace();
  for (  FlowSpecification flow : app.getFlows().values()) {
    Id.Flow programId=Id.Flow.from(appId,flow.getName());
    for (    FlowletConnection connection : flow.getConnections()) {
      if (connection.getSourceType().equals(FlowletConnection.Type.STREAM)) {
        usageRegistry.register(programId,Id.Stream.from(namespace,connection.getSourceName()));
      }
    }
    for (    FlowletDefinition flowlet : flow.getFlowlets().values()) {
      for (      String dataset : flowlet.getDatasets()) {
        usageRegistry.register(programId,Id.DatasetInstance.from(namespace,dataset));
      }
    }
  }
  for (  MapReduceSpecification program : app.getMapReduce().values()) {
    Id.Program programId=Id.Program.from(appId,ProgramType.MAPREDUCE,program.getName());
    for (    String dataset : program.getDataSets()) {
      if (!dataset.startsWith(Constants.Stream.URL_PREFIX)) {
        usageRegistry.register(programId,Id.DatasetInstance.from(namespace,dataset));
      }
    }
    String inputDatasetName=program.getInputDataSet();
    if (inputDatasetName != null && inputDatasetName.startsWith(Constants.Stream.URL_PREFIX)) {
      StreamBatchReadable stream=new StreamBatchReadable(URI.create(inputDatasetName));
      usageRegistry.register(programId,Id.Stream.from(namespace,stream.getStreamName()));
    }
  }
  emit(input);
}

Fixed version (ground truth):
@Override public void process(ApplicationWithPrograms input) throws Exception {
  store.addApplication(input.getId(),input.getSpecification(),input.getLocation());
  registerDatasets(input);
  emit(input);
}
Program: 6811
Project: 6811
Buggy source:
@Override public List<ProgramSpecification> getDeletedProgramSpecifications(final Id.Application id,ApplicationSpecification appSpec){
  ApplicationMeta existing=txnl.executeUnchecked(new TransactionExecutor.Function<AppMds,ApplicationMeta>(){
    @Override public ApplicationMeta apply(    AppMds mds) throws Exception {
      return mds.apps.getApplication(id.getNamespaceId(),id.getId());
    }
  }
);
  List<ProgramSpecification> deletedProgramSpecs=Lists.newArrayList();
  if (existing != null) {
    ApplicationSpecification existingAppSpec=existing.getSpec();
    ImmutableMap<String,ProgramSpecification> existingSpec=new ImmutableMap.Builder<String,ProgramSpecification>().putAll(existingAppSpec.getMapReduce()).putAll(existingAppSpec.getSpark()).putAll(existingAppSpec.getWorkflows()).putAll(existingAppSpec.getFlows()).putAll(existingAppSpec.getServices()).build();
    ImmutableMap<String,ProgramSpecification> newSpec=new ImmutableMap.Builder<String,ProgramSpecification>().putAll(appSpec.getMapReduce()).putAll(existingAppSpec.getSpark()).putAll(appSpec.getWorkflows()).putAll(appSpec.getFlows()).putAll(appSpec.getServices()).build();
    MapDifference<String,ProgramSpecification> mapDiff=Maps.difference(existingSpec,newSpec);
    deletedProgramSpecs.addAll(mapDiff.entriesOnlyOnLeft().values());
  }
  return deletedProgramSpecs;
}

Fixed version (ground truth):
@Override public List<ProgramSpecification> getDeletedProgramSpecifications(final Id.Application id,ApplicationSpecification appSpec){
  ApplicationMeta existing=txnl.executeUnchecked(new TransactionExecutor.Function<AppMds,ApplicationMeta>(){
    @Override public ApplicationMeta apply(    AppMds mds) throws Exception {
      return mds.apps.getApplication(id.getNamespaceId(),id.getId());
    }
  }
);
  List<ProgramSpecification> deletedProgramSpecs=Lists.newArrayList();
  if (existing != null) {
    ApplicationSpecification existingAppSpec=existing.getSpec();
    ImmutableMap<String,ProgramSpecification> existingSpec=new ImmutableMap.Builder<String,ProgramSpecification>().putAll(existingAppSpec.getMapReduce()).putAll(existingAppSpec.getSpark()).putAll(existingAppSpec.getWorkflows()).putAll(existingAppSpec.getFlows()).putAll(existingAppSpec.getServices()).putAll(existingAppSpec.getWorkers()).build();
    ImmutableMap<String,ProgramSpecification> newSpec=new ImmutableMap.Builder<String,ProgramSpecification>().putAll(appSpec.getMapReduce()).putAll(appSpec.getSpark()).putAll(appSpec.getWorkflows()).putAll(appSpec.getFlows()).putAll(appSpec.getServices()).putAll(appSpec.getWorkers()).build();
    MapDifference<String,ProgramSpecification> mapDiff=Maps.difference(existingSpec,newSpec);
    deletedProgramSpecs.addAll(mapDiff.entriesOnlyOnLeft().values());
  }
  return deletedProgramSpecs;
}
Program: 6812
Project: 6812
Buggy source:
@Override public void configure(){
  setName(NAME);
}

Fixed version (ground truth):
@Override protected void configure(){
  useDatasets(DATASET_NAME);
}
Program: 6813
Project: 6813
Buggy source:
@Override public void configure(){
  setName("String_Node_Str");
  setDescription("String_Node_Str");
  addStream(new Stream("String_Node_Str"));
  createDataset("String_Node_Str",KeyValueTable.class);
  addFlow(new AllProgramsApp.NoOpFlow());
  addMapReduce(new AllProgramsApp.NoOpMR());
}

Fixed version (ground truth):
@Override public void configure(){
  setName("String_Node_Str");
  setDescription("String_Node_Str");
  addStream(new Stream("String_Node_Str"));
  createDataset("String_Node_Str",KeyValueTable.class);
  addFlow(new AllProgramsApp.NoOpFlow());
  addMapReduce(new AllProgramsApp.NoOpMR());
  addService(new AllProgramsApp.NoOpService());
  addWorker(new AllProgramsApp.NoOpWorker());
  addSpark(new AllProgramsApp.NoOpSpark());
}
Program: 6816
Project: 6816
Buggy source:
@Test public void testFlowUsage() throws Exception {
  final Id.Application app=Id.Application.from("String_Node_Str",AllProgramsApp.NAME);
  final Id.Program program=Id.Program.from(app,ProgramType.FLOW,AllProgramsApp.NoOpFlow.NAME);
  final Id.Stream stream=Id.Stream.from("String_Node_Str",AllProgramsApp.STREAM_NAME);
  final Id.DatasetInstance dataset=Id.DatasetInstance.from("String_Node_Str",AllProgramsApp.DATASET_NAME);
  Assert.assertEquals(0,getAppStreamUsage(app).size());
  Assert.assertEquals(0,getProgramStreamUsage(program).size());
  Assert.assertEquals(0,getStreamProgramUsage(stream).size());
  Assert.assertEquals(0,getProgramDatasetUsage(program).size());
  Assert.assertEquals(0,getAppDatasetUsage(app).size());
  Assert.assertEquals(0,getDatasetProgramUsage(dataset).size());
  deploy(AllProgramsApp.class);
  try {
    Assert.assertTrue(getAppStreamUsage(app).contains(stream));
    Assert.assertTrue(getProgramStreamUsage(program).contains(stream));
    Assert.assertTrue(getStreamProgramUsage(stream).contains(program));
    Assert.assertTrue(getProgramDatasetUsage(program).contains(dataset));
    Assert.assertTrue(getProgramDatasetUsage(program).contains(dataset));
    Assert.assertTrue(getAppDatasetUsage(app).contains(dataset));
    Assert.assertTrue(getDatasetProgramUsage(dataset).contains(program));
  }
  finally {
    deleteApp(app,200);
    Assert.assertEquals(0,getAppStreamUsage(app).size());
    Assert.assertEquals(0,getProgramStreamUsage(program).size());
    Assert.assertEquals(0,getStreamProgramUsage(stream).size());
  }
}

Fixed version (ground truth):
@Test public void testFlowUsage() throws Exception {
  final Id.Application app=Id.Application.from("String_Node_Str",AllProgramsApp.NAME);
  final Id.Program program=Id.Program.from(app,ProgramType.FLOW,AllProgramsApp.NoOpFlow.NAME);
  final Id.Stream stream=Id.Stream.from("String_Node_Str",AllProgramsApp.STREAM_NAME);
  final Id.DatasetInstance dataset=Id.DatasetInstance.from("String_Node_Str",AllProgramsApp.DATASET_NAME);
  Assert.assertEquals(0,getAppStreamUsage(app).size());
  Assert.assertEquals(0,getProgramStreamUsage(program).size());
  Assert.assertEquals(0,getStreamProgramUsage(stream).size());
  Assert.assertEquals(0,getProgramDatasetUsage(program).size());
  Assert.assertEquals(0,getAppDatasetUsage(app).size());
  Assert.assertEquals(0,getDatasetProgramUsage(dataset).size());
  deploy(AllProgramsApp.class);
  try {
    Assert.assertTrue(getAppStreamUsage(app).contains(stream));
    Assert.assertTrue(getProgramStreamUsage(program).contains(stream));
    Assert.assertTrue(getStreamProgramUsage(stream).contains(program));
    Assert.assertTrue(getProgramDatasetUsage(program).contains(dataset));
    Assert.assertTrue(getAppDatasetUsage(app).contains(dataset));
    Assert.assertTrue(getDatasetProgramUsage(dataset).contains(program));
  }
  finally {
    deleteApp(app,200);
    Assert.assertEquals(0,getAppStreamUsage(app).size());
    Assert.assertEquals(0,getProgramStreamUsage(program).size());
    Assert.assertEquals(0,getStreamProgramUsage(stream).size());
  }
}
Program: 6818
Project: 6818
Buggy source:
@Test public void testCheckDeletedProgramSpecs() throws Exception {
  AppFabricTestHelper.deployApplication(AllProgramsApp.class);
  ApplicationSpecification spec=Specifications.from(new AllProgramsApp());
  Set<String> specsToBeVerified=Sets.newHashSet();
  specsToBeVerified.addAll(spec.getMapReduce().keySet());
  specsToBeVerified.addAll(spec.getWorkflows().keySet());
  specsToBeVerified.addAll(spec.getFlows().keySet());
  Assert.assertEquals(3,specsToBeVerified.size());
  Id.Application appId=Id.Application.from(DefaultId.NAMESPACE,"String_Node_Str");
  List<ProgramSpecification> deletedSpecs=store.getDeletedProgramSpecifications(appId,spec);
  Assert.assertEquals(0,deletedSpecs.size());
  spec=Specifications.from(new NoProgramsApp());
  deletedSpecs=store.getDeletedProgramSpecifications(appId,spec);
  Assert.assertEquals(3,deletedSpecs.size());
  for (  ProgramSpecification specification : deletedSpecs) {
    specsToBeVerified.remove(specification.getName());
  }
  Assert.assertEquals(0,specsToBeVerified.size());
}

Fixed version (ground truth):
@Test public void testCheckDeletedProgramSpecs() throws Exception {
  AppFabricTestHelper.deployApplication(AllProgramsApp.class);
  ApplicationSpecification spec=Specifications.from(new AllProgramsApp());
  Set<String> specsToBeVerified=Sets.newHashSet();
  specsToBeVerified.addAll(spec.getMapReduce().keySet());
  specsToBeVerified.addAll(spec.getWorkflows().keySet());
  specsToBeVerified.addAll(spec.getFlows().keySet());
  specsToBeVerified.addAll(spec.getServices().keySet());
  specsToBeVerified.addAll(spec.getWorkers().keySet());
  specsToBeVerified.addAll(spec.getSpark().keySet());
  Assert.assertEquals(6,specsToBeVerified.size());
  Id.Application appId=Id.Application.from(DefaultId.NAMESPACE,"String_Node_Str");
  List<ProgramSpecification> deletedSpecs=store.getDeletedProgramSpecifications(appId,spec);
  Assert.assertEquals(0,deletedSpecs.size());
  spec=Specifications.from(new NoProgramsApp());
  deletedSpecs=store.getDeletedProgramSpecifications(appId,spec);
  Assert.assertEquals(6,deletedSpecs.size());
  for (  ProgramSpecification specification : deletedSpecs) {
    specsToBeVerified.remove(specification.getName());
  }
  Assert.assertEquals(0,specsToBeVerified.size());
}
Program: 6820
Project: 6820
Buggy source:
/** 
 * Fetches column->value pairs for range of columns from persistent store. NOTE: persisted store can also be in-memory, it is called "persisted" to distinguish from in-memory buffer. NOTE: Using this method is generally always not efficient since it always hits the persisted store even if all needed data is in-memory buffer. Since columns set is not strictly defined the implementation always looks up for more columns in persistent store.
 * @param row row key defines the row to fetch columns from
 * @param startColumn first column in a range, inclusive
 * @param stopColumn last column in a range, exclusive
 * @param limit max number of columns to fetch
 * @return map of column->value pairs, never null.
 * @throws Exception
 */
protected abstract NavigableMap<byte[],byte[]> getPersisted(byte[] row,byte[] startColumn,byte[] stopColumn,int limit) throws Exception ;

Fixed version (ground truth):
/** 
 * Fetches a list of rows from persistent store. Subclasses should override this if they can batch multiple gets into a single request, as the default implementation simply loops through the gets and calls  {@link #getPersisted(byte[],byte[][])} on each get.NOTE: persisted store can also be in-memory, it is called "persisted" to distinguish from in-memory buffer.
 * @param gets list of gets to perform
 * @return list of rows, one for each get
 * @throws Exception
 */
protected List<Map<byte[],byte[]>> getPersisted(List<Get> gets) throws Exception {
  List<Map<byte[],byte[]>> results=Lists.newArrayListWithCapacity(gets.size());
  for (  Get get : gets) {
    List<byte[]> getColumns=get.getColumns();
    byte[][] columns=getColumns.isEmpty() ? null : getColumns.toArray(new byte[getColumns.size()][]);
    results.add(getPersisted(get.getRow(),columns));
  }
  return results;
}
Program: 6821
Project: 6821
Buggy source:
@Override public Row get(byte[] row,byte[] startColumn,byte[] stopColumn,int limit){
  reportRead(1);
  NavigableMap<byte[],Update> buffCols=buff.get(row);
  boolean rowDeleted=buffCols == null && buff.containsKey(row);
  if (rowDeleted) {
    return new Result(row,Collections.<byte[],byte[]>emptyMap());
  }
  try {
    Map<byte[],byte[]> persistedCols=getPersisted(row,startColumn,stopColumn,limit);
    NavigableMap<byte[],byte[]> result=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
    if (persistedCols != null) {
      result.putAll(persistedCols);
    }
    if (buffCols != null) {
      buffCols=getRange(buffCols,startColumn,stopColumn,limit);
      mergeToPersisted(result,buffCols,null);
    }
    return new Result(row,head(result,limit));
  }
 catch (  Exception e) {
    LOG.debug("String_Node_Str" + getTransactionAwareName() + "String_Node_Str"+ Bytes.toStringBinary(row),e);
    throw new DataSetException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public List<Row> get(List<Get> gets){
  try {
    List<Map<byte[],byte[]>> persistedRows=getPersisted(gets);
    Preconditions.checkArgument(gets.size() == persistedRows.size(),"String_Node_Str");
    List<Row> result=Lists.newArrayListWithCapacity(persistedRows.size());
    Iterator<Map<byte[],byte[]>> persistedRowsIter=persistedRows.iterator();
    Iterator<Get> getIter=gets.iterator();
    while (persistedRowsIter.hasNext() && getIter.hasNext()) {
      Get get=getIter.next();
      Map<byte[],byte[]> persistedRow=persistedRowsIter.next();
      NavigableMap<byte[],byte[]> rowColumns=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
      rowColumns.putAll(persistedRow);
      byte[] row=get.getRow();
      NavigableMap<byte[],Update> buffCols=buff.get(row);
      if (buffCols == null && buff.containsKey(row)) {
        result.add(new Result(row,Collections.<byte[],byte[]>emptyMap()));
        continue;
      }
      if (buffCols != null) {
        List<byte[]> getColumns=get.getColumns();
        byte[][] columns=getColumns.isEmpty() ? null : getColumns.toArray(new byte[getColumns.size()][]);
        mergeToPersisted(rowColumns,buffCols,columns);
      }
      result.add(new Result(row,unwrapDeletes(rowColumns)));
    }
    return result;
  }
 catch (  Exception e) {
    LOG.debug("String_Node_Str" + getTransactionAwareName(),e);
    throw new DataSetException("String_Node_Str",e);
  }
}
Program: 6822
Project: 6822
Buggy source:
@Nullable @Override public Row apply(Result result){
  Map<byte[],byte[]> familyMap=result.getFamilyMap(columnFamily);
  return new co.cask.cdap.api.dataset.table.Result(result.getRow(),familyMap != null ? familyMap : ImmutableMap.<byte[],byte[]>of());
}

Fixed version (ground truth):
@Nullable @Override public Map<byte[],byte[]> apply(Result result){
  Map<byte[],byte[]> familyMap=result.getFamilyMap(columnFamily);
  return familyMap != null ? familyMap : ImmutableMap.<byte[],byte[]>of();
}
Program: 6823
Project: 6823
Buggy source:
@GET @Path("String_Node_Str") public void getProfile(HttpServiceRequest request,HttpServiceResponder responder,@PathParam("String_Node_Str") String userId){
  Row row=profiles.get(new Get(userId));
  if (row.isEmpty()) {
    responder.sendError(404,"String_Node_Str");
    return;
  }
  String name=row.getString("String_Node_Str");
  String email=row.getString("String_Node_Str");
  Long lastLogin=row.getLong("String_Node_Str");
  Long lastActive=row.getLong("String_Node_Str");
  Profile profile=new Profile(userId,name,email,lastLogin,lastActive);
  responder.sendJson(200,profile);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void getProfile(HttpServiceRequest request,HttpServiceResponder responder,@PathParam("String_Node_Str") String userId){
  Row row=profiles.get(new Get(userId));
  if (row.isEmpty()) {
    responder.sendError(404,"String_Node_Str");
    return;
  }
  responder.sendJson(200,toProfile(row));
}
Program: 6824
Project: 6824
Buggy source:
@Override public void visit(Object instance,TypeToken<?> inspectType,TypeToken<?> declareType,Method method) throws Exception {
  Path classPathAnnotation=inspectType.getRawType().getAnnotation(Path.class);
  Path methodPathAnnotation=method.getAnnotation(Path.class);
  if (methodPathAnnotation == null && classPathAnnotation == null) {
    return;
  }
  Set<Class<? extends Annotation>> acceptedMethodTypes=ImmutableSet.of(GET.class,POST.class,DELETE.class,PUT.class,OPTIONS.class,HEAD.class);
  Set<Class<? extends Annotation>> methodAnnotations=Sets.newHashSet();
  for (  Annotation annotation : method.getAnnotations()) {
    Class<? extends Annotation> annotationClz=annotation.annotationType();
    if (acceptedMethodTypes.contains(annotationClz)) {
      methodAnnotations.add(annotationClz);
    }
  }
  for (  Class<? extends Annotation> methodTypeClz : methodAnnotations) {
    String methodType=methodTypeClz.getAnnotation(HttpMethod.class).value();
    String endpoint="String_Node_Str";
    endpoint=classPathAnnotation == null ? endpoint : endpoint + classPathAnnotation.value();
    endpoint=methodPathAnnotation == null ? endpoint : endpoint + "String_Node_Str" + methodPathAnnotation.value();
    endpoint=endpoint.replaceAll("String_Node_Str","String_Node_Str");
    endpoints.add(new ServiceHttpEndpoint(methodType,endpoint));
  }
}

Fixed version (ground truth):
@Override public void visit(Object instance,TypeToken<?> inspectType,TypeToken<?> declareType,Method method) throws Exception {
  if (!Modifier.isPublic(method.getModifiers())) {
    return;
  }
  Path classPathAnnotation=inspectType.getRawType().getAnnotation(Path.class);
  Path methodPathAnnotation=method.getAnnotation(Path.class);
  if (methodPathAnnotation == null && classPathAnnotation == null) {
    return;
  }
  Set<Class<? extends Annotation>> acceptedMethodTypes=ImmutableSet.of(GET.class,POST.class,DELETE.class,PUT.class,OPTIONS.class,HEAD.class);
  Set<Class<? extends Annotation>> methodAnnotations=Sets.newHashSet();
  for (  Annotation annotation : method.getAnnotations()) {
    Class<? extends Annotation> annotationClz=annotation.annotationType();
    if (acceptedMethodTypes.contains(annotationClz)) {
      methodAnnotations.add(annotationClz);
    }
  }
  for (  Class<? extends Annotation> methodTypeClz : methodAnnotations) {
    String methodType=methodTypeClz.getAnnotation(HttpMethod.class).value();
    String endpoint="String_Node_Str";
    endpoint=classPathAnnotation == null ? endpoint : endpoint + classPathAnnotation.value();
    endpoint=methodPathAnnotation == null ? endpoint : endpoint + "String_Node_Str" + methodPathAnnotation.value();
    endpoint=endpoint.replaceAll("String_Node_Str","String_Node_Str");
    endpoints.add(new ServiceHttpEndpoint(methodType,endpoint));
  }
}
Program: 6825
Project: 6825
Buggy source:
private int setServiceInstances(String namespace,String app,String service,int instances) throws Exception {
  String instanceUrl=String.format("String_Node_Str",app,service);
  String versionedInstanceUrl=getVersionedAPIPath(instanceUrl,Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  String instancesBody=GSON.toJson(new Instances(instances));
  return doPut(versionedInstanceUrl,instancesBody).getStatusLine().getStatusCode();
}

Fixed version (ground truth):
private int setServiceInstances(Id.Service serviceId,int instances) throws Exception {
  String instanceUrl=String.format("String_Node_Str",serviceId.getApplicationId(),serviceId.getId());
  String versionedInstanceUrl=getVersionedAPIPath(instanceUrl,Constants.Gateway.API_VERSION_3_TOKEN,serviceId.getNamespaceId());
  String instancesBody=GSON.toJson(new Instances(instances));
  return doPut(versionedInstanceUrl,instancesBody).getStatusLine().getStatusCode();
}
Program: 6828
Project: 6828
Buggy source:
private void verifyProgramList(String namespace,String appName,final String programType,int expected) throws Exception {
  HttpResponse response=requestAppDetail(namespace,appName);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  String json=EntityUtils.toString(response.getEntity());
  ApplicationDetail appDetail=GSON.fromJson(json,ApplicationDetail.class);
  Collection<ProgramRecord> programs=Collections2.filter(appDetail.getPrograms(),new Predicate<ProgramRecord>(){
    @Override public boolean apply(    @Nullable ProgramRecord record){
      return programType.equals(record.getType().getCategoryName());
    }
  }
);
  Assert.assertEquals(expected,programs.size());
}

Fixed version (ground truth):
private void verifyProgramList(String namespace,String appName,final ProgramType programType,int expected) throws Exception {
  HttpResponse response=requestAppDetail(namespace,appName);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  String json=EntityUtils.toString(response.getEntity());
  ApplicationDetail appDetail=GSON.fromJson(json,ApplicationDetail.class);
  Collection<ProgramRecord> programs=Collections2.filter(appDetail.getPrograms(),new Predicate<ProgramRecord>(){
    @Override public boolean apply(    @Nullable ProgramRecord record){
      return programType.getCategoryName().equals(record.getType().getCategoryName());
    }
  }
);
  Assert.assertEquals(expected,programs.size());
}
Program: 6829
Project: 6829
Buggy source:
@Override public boolean apply(@Nullable ProgramRecord record){
  return programType.equals(record.getType().getCategoryName());
}

Fixed version (ground truth):
@Override public boolean apply(@Nullable ProgramRecord record){
  return programType.getCategoryName().equals(record.getType().getCategoryName());
}
Program: 6830
Project: 6830
Buggy source:
private HttpResponse callService(String namespace,String app,String service,HttpMethod method,String endpoint) throws Exception {
  String serviceUrl=String.format("String_Node_Str",app,service,endpoint);
  String versionedServiceUrl=getVersionedAPIPath(serviceUrl,Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  HttpResponse response;
  if (HttpMethod.GET.equals(method)) {
    response=doGet(versionedServiceUrl);
  }
 else   if (HttpMethod.POST.equals(method)) {
    response=doPost(versionedServiceUrl);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return response;
}

Fixed version (ground truth):
private HttpResponse callService(Id.Service serviceId,HttpMethod method,String endpoint) throws Exception {
  String serviceUrl=String.format("String_Node_Str",serviceId.getApplicationId(),serviceId.getId(),endpoint);
  String versionedServiceUrl=getVersionedAPIPath(serviceUrl,Constants.Gateway.API_VERSION_3_TOKEN,serviceId.getNamespaceId());
  if (HttpMethod.GET.equals(method)) {
    return doGet(versionedServiceUrl);
  }
 else   if (HttpMethod.POST.equals(method)) {
    return doPost(versionedServiceUrl);
  }
  throw new IllegalArgumentException("String_Node_Str");
}
Program: 6831
Project: 6831
Buggy source:
private ServiceInstances getServiceInstances(String namespace,String app,String service) throws Exception {
  String instanceUrl=String.format("String_Node_Str",app,service);
  String versionedInstanceUrl=getVersionedAPIPath(instanceUrl,Constants.Gateway.API_VERSION_3_TOKEN,namespace);
  HttpResponse response=doGet(versionedInstanceUrl);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  ServiceInstances instances=readResponse(response,ServiceInstances.class);
  return instances;
}

Fixed version (ground truth):
private ServiceInstances getServiceInstances(Id.Service serviceId) throws Exception {
  String instanceUrl=String.format("String_Node_Str",serviceId.getApplicationId(),serviceId.getId());
  String versionedInstanceUrl=getVersionedAPIPath(instanceUrl,Constants.Gateway.API_VERSION_3_TOKEN,serviceId.getNamespaceId());
  HttpResponse response=doGet(versionedInstanceUrl);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  return readResponse(response,ServiceInstances.class);
}
Program: 6832
Project: 6832
Buggy source:
/** 
 * Tests for program list calls
 */
@Test public void testProgramList() throws Exception {
  testListInitialState(TEST_NAMESPACE1,ProgramType.FLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.MAPREDUCE);
  testListInitialState(TEST_NAMESPACE1,ProgramType.WORKFLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.SPARK);
  testListInitialState(TEST_NAMESPACE1,ProgramType.SERVICE);
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=deploy(AppWithServices.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  verifyProgramList(TEST_NAMESPACE1,ProgramType.FLOW.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,ProgramType.MAPREDUCE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE2,ProgramType.SERVICE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE.getCategoryName(),1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.WORKFLOW.getCategoryName(),0);
  verifyProgramList(TEST_NAMESPACE2,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName(),1);
  Assert.assertEquals(404,getAppFDetailResponseCode(TEST_NAMESPACE1,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName()));
  Assert.assertEquals(404,getAppFDetailResponseCode(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW.getCategoryName()));
}

Fixed version (ground truth):
/** 
 * Tests for program list calls
 */
@Test public void testProgramList() throws Exception {
  testListInitialState(TEST_NAMESPACE1,ProgramType.FLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.MAPREDUCE);
  testListInitialState(TEST_NAMESPACE1,ProgramType.WORKFLOW);
  testListInitialState(TEST_NAMESPACE2,ProgramType.SPARK);
  testListInitialState(TEST_NAMESPACE1,ProgramType.SERVICE);
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=deploy(AppWithServices.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  verifyProgramList(TEST_NAMESPACE1,ProgramType.FLOW,1);
  verifyProgramList(TEST_NAMESPACE1,ProgramType.MAPREDUCE,1);
  verifyProgramList(TEST_NAMESPACE2,ProgramType.SERVICE,1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE,1);
  verifyProgramList(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.WORKFLOW,0);
  verifyProgramList(TEST_NAMESPACE2,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE,1);
  Assert.assertEquals(404,getAppFDetailResponseCode(TEST_NAMESPACE1,APP_WITH_SERVICES_APP_ID,ProgramType.SERVICE.getCategoryName()));
  Assert.assertEquals(404,getAppFDetailResponseCode(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW.getCategoryName()));
}
Program: 6833
Project: 6833
Buggy source:
@Override public Location get(Id.Namespace namespaceId,@Nullable String subPath) throws IOException {
  String namespacesDir=cConf.get(Constants.Namespace.NAMESPACES_DIR);
  Location namespaceLocation=locationFactory.create(namespacesDir).append(namespaceId.getId());
  if (subPath != null) {
    namespaceLocation.append(subPath);
  }
  return namespaceLocation;
}

Fixed version (ground truth):
@Override public Location get(Id.Namespace namespaceId,@Nullable String subPath) throws IOException {
  String namespacesDir=cConf.get(Constants.Namespace.NAMESPACES_DIR);
  Location namespaceLocation=locationFactory.create(namespacesDir).append(namespaceId.getId());
  if (subPath != null) {
    namespaceLocation=namespaceLocation.append(subPath);
  }
  return namespaceLocation;
}
Program: 6834
Project: 6834
Buggy source:
public void restartAllServiceInstances(HttpRequest request,HttpResponder responder,String serviceName){
  restartInstances(responder,serviceName,-1);
}

Fixed version (ground truth):
public void restartAllServiceInstances(HttpRequest request,HttpResponder responder,String serviceName){
  restartInstances(responder,serviceName,-1,true);
}
Program: 6835
Project: 6835
Buggy source:
private void restartInstances(HttpResponder responder,String serviceName,int instanceId){
  long startTimeMs=System.currentTimeMillis();
  boolean isSuccess=true;
  try {
    if (!serviceManagementMap.containsKey(serviceName)) {
      responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",serviceName));
      return;
    }
    MasterServiceManager masterServiceManager=serviceManagementMap.get(serviceName);
    if (instanceId < 0) {
      masterServiceManager.restartAllInstances();
    }
 else {
      masterServiceManager.restartInstances(instanceId);
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  Exception ex) {
    LOG.warn(String.format("String_Node_Str",serviceName),ex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",instanceId,serviceName));
  }
 finally {
    long endTimeMs=System.currentTimeMillis();
    if (instanceId < 0) {
      serviceStore.setRestartAllInstancesRequest(serviceName,startTimeMs,endTimeMs,isSuccess);
    }
 else {
      serviceStore.setRestartInstanceRequest(serviceName,startTimeMs,endTimeMs,isSuccess,instanceId);
    }
  }
}

Fixed version (ground truth):
private void restartInstances(HttpResponder responder,String serviceName,int instanceId,boolean restartAll){
  long startTimeMs=System.currentTimeMillis();
  boolean isSuccess=true;
  if (!serviceManagementMap.containsKey(serviceName)) {
    responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",serviceName));
    return;
  }
  MasterServiceManager masterServiceManager=serviceManagementMap.get(serviceName);
  try {
    if (!masterServiceManager.isServiceEnabled()) {
      throw new IllegalStateException();
    }
    if (restartAll) {
      masterServiceManager.restartAllInstances();
    }
 else {
      if (instanceId < 0 || instanceId >= masterServiceManager.getInstances()) {
        throw new IllegalArgumentException();
      }
      masterServiceManager.restartInstances(instanceId);
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  IllegalStateException ise) {
    LOG.debug(String.format("String_Node_Str",serviceName));
    isSuccess=false;
    responder.sendString(HttpResponseStatus.FORBIDDEN,String.format("String_Node_Str" + "String_Node_Str",serviceName));
  }
catch (  IllegalArgumentException iex) {
    LOG.debug(String.format("String_Node_Str",serviceName),iex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.BAD_REQUEST,String.format("String_Node_Str",instanceId,serviceName));
  }
catch (  Exception ex) {
    LOG.warn(String.format("String_Node_Str",serviceName),ex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",instanceId,serviceName));
  }
 finally {
    long endTimeMs=System.currentTimeMillis();
    if (restartAll) {
      serviceStore.setRestartAllInstancesRequest(serviceName,startTimeMs,endTimeMs,isSuccess);
    }
 else {
      serviceStore.setRestartInstanceRequest(serviceName,startTimeMs,endTimeMs,isSuccess,instanceId);
    }
  }
}
Program: 6836
Project: 6836
Buggy source:
public void restartServiceInstance(HttpRequest request,HttpResponder responder,String serviceName,int instanceId){
  restartInstances(responder,serviceName,instanceId);
}

Fixed version (ground truth):
public void restartServiceInstance(HttpRequest request,HttpResponder responder,String serviceName,int instanceId){
  restartInstances(responder,serviceName,instanceId,false);
}
Program: 6837
Project: 6837
Buggy source:
@Override public void restartAllInstances(){
  try {
    Iterable<TwillController> twillControllers=twillRunnerService.lookup(Constants.Service.MASTER_SERVICES);
    for (    TwillController twillController : twillControllers) {
      twillController.restartAllInstances(serviceName).get();
    }
  }
 catch (  Throwable t) {
    throw new RuntimeException(String.format("String_Node_Str",serviceName),t);
  }
}

Fixed version (ground truth):
@Override public void restartAllInstances(){
  Iterable<TwillController> twillControllers=twillRunnerService.lookup(Constants.Service.MASTER_SERVICES);
  for (  TwillController twillController : twillControllers) {
    Futures.getUnchecked(twillController.restartAllInstances(serviceName));
  }
}
Program: 6838
Project: 6838
Buggy source:
@Override public void restartInstances(int instanceId,int... moreInstanceIds){
  try {
    Iterable<TwillController> twillControllers=twillRunnerService.lookup(Constants.Service.MASTER_SERVICES);
    for (    TwillController twillController : twillControllers) {
      twillController.restartInstances(serviceName,instanceId,moreInstanceIds).get();
    }
  }
 catch (  Throwable t) {
    throw new RuntimeException(String.format("String_Node_Str",serviceName),t);
  }
}

Fixed version (ground truth):
@Override public void restartInstances(int instanceId,int... moreInstanceIds){
  Iterable<TwillController> twillControllers=twillRunnerService.lookup(Constants.Service.MASTER_SERVICES);
  for (  TwillController twillController : twillControllers) {
    Futures.getUnchecked(twillController.restartInstances(serviceName,instanceId,moreInstanceIds));
  }
}
Program: 6839
Project: 6839
Buggy source:
@Override public void dropPartition(PartitionKey key){
  byte[] rowKey=generateRowKey(key,partitioning);
  Partition partition=getPartition(key);
  if (partition == null) {
    return;
  }
  if (!isExternal) {
    try {
      partition.getLocation().delete();
    }
 catch (    IOException e) {
      throw new DataSetException(String.format("String_Node_Str",key,partition.getLocation().toURI().getPath(),e.getMessage()),e);
    }
  }
  partitionsTable.delete(rowKey);
  dropPartitionFromExplore(key);
}

Fixed version (ground truth):
@Override public void dropPartition(PartitionKey key){
  byte[] rowKey=generateRowKey(key,partitioning);
  Partition partition=getPartition(key);
  if (partition == null) {
    return;
  }
  if (!isExternal) {
    try {
      if (partition.getLocation().exists()) {
        boolean deleteSuccess=partition.getLocation().delete(true);
        if (!deleteSuccess) {
          throw new DataSetException(String.format("String_Node_Str",key,partition.getLocation().toURI().getPath()));
        }
      }
    }
 catch (    IOException e) {
      throw new DataSetException(String.format("String_Node_Str",key,partition.getLocation().toURI().getPath(),e.getMessage()),e);
    }
  }
  partitionsTable.delete(rowKey);
  dropPartitionFromExplore(key);
}
Program: 6840
Project: 6840
Buggy source:
@Test public void testAddRemoveGetPartition() throws Exception {
  final PartitionedFileSet pfs=dsFrameworkUtil.getInstance(pfsInstance);
  dsFrameworkUtil.newTransactionExecutor((TransactionAware)pfs).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      PartitionOutput output=pfs.getPartitionOutput(PARTITION_KEY);
      Location outputLocation=output.getLocation();
      OutputStream out=outputLocation.getOutputStream();
      out.close();
      output.addPartition();
      Assert.assertTrue(outputLocation.exists());
      Assert.assertNotNull(pfs.getPartition(PARTITION_KEY));
      Assert.assertTrue(pfs.getPartition(PARTITION_KEY).getLocation().exists());
      pfs.dropPartition(PARTITION_KEY);
      Assert.assertFalse(outputLocation.exists());
      Assert.assertNull(pfs.getPartition(PARTITION_KEY));
      pfs.dropPartition(PARTITION_KEY);
    }
  }
);
}

Fixed version (ground truth):
@Test public void testAddRemoveGetPartition() throws Exception {
  final PartitionedFileSet pfs=dsFrameworkUtil.getInstance(pfsInstance);
  dsFrameworkUtil.newTransactionExecutor((TransactionAware)pfs).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      PartitionOutput output=pfs.getPartitionOutput(PARTITION_KEY);
      Location outputLocation=output.getLocation().append("String_Node_Str");
      OutputStream out=outputLocation.getOutputStream();
      out.close();
      output.addPartition();
      Assert.assertTrue(outputLocation.exists());
      Assert.assertNotNull(pfs.getPartition(PARTITION_KEY));
      Assert.assertTrue(pfs.getPartition(PARTITION_KEY).getLocation().exists());
      pfs.dropPartition(PARTITION_KEY);
      Assert.assertFalse(outputLocation.exists());
      Assert.assertNull(pfs.getPartition(PARTITION_KEY));
      pfs.dropPartition(PARTITION_KEY);
    }
  }
);
}
Program: 6841
Project: 6841
Buggy source:
@GET @Path("String_Node_Str") public void getWorkflowStatus(HttpRequest request,final HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String workflowName,@PathParam("String_Node_Str") String runId){
  try {
    workflowClient.getWorkflowStatus(namespaceId,appId,workflowName,runId,new WorkflowClient.Callback(){
      @Override public void handle(      WorkflowClient.Status status){
        if (status.getCode() == WorkflowClient.Status.Code.NOT_FOUND) {
          responder.sendStatus(HttpResponseStatus.NOT_FOUND);
        }
 else         if (status.getCode() == WorkflowClient.Status.Code.OK) {
          responder.sendByteArray(HttpResponseStatus.OK,status.getResult().getBytes(),ImmutableMultimap.of(HttpHeaders.Names.CONTENT_TYPE,"String_Node_Str"));
        }
 else {
          responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,status.getResult());
        }
      }
    }
);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void getWorkflowStatus(HttpRequest request,final HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String workflowName,@PathParam("String_Node_Str") String runId){
  try {
    workflowClient.getWorkflowStatus(namespaceId,appId,workflowName,runId,new WorkflowClient.Callback(){
      @Override public void handle(      WorkflowClient.Status status){
        if (status.getCode() == WorkflowClient.Status.Code.NOT_FOUND) {
          responder.sendStatus(HttpResponseStatus.NOT_FOUND);
        }
 else         if (status.getCode() == WorkflowClient.Status.Code.OK) {
          responder.sendByteArray(HttpResponseStatus.OK,Bytes.toBytes(status.getResult()),ImmutableMultimap.of(HttpHeaders.Names.CONTENT_TYPE,"String_Node_Str"));
        }
 else {
          responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,status.getResult());
        }
      }
    }
);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}