Program: 6977
Project: 6977
Buggy source:
@Override public synchronized Map<RunId,RuntimeInfo> list(ProgramType type){
  Map<RunId,RuntimeInfo> result=Maps.newHashMap();
  result.putAll(super.list(type));
  Table<Id.Program,RunId,TwillController> twillProgramInfo=HashBasedTable.create();
  for (  TwillRunner.LiveInfo liveInfo : twillRunner.lookupLive()) {
    String appName=liveInfo.getApplicationName();
    Matcher matcher=APP_NAME_PATTERN.matcher(appName);
    if (!matcher.matches()) {
      continue;
    }
    if (!type.equals(getType(matcher.group(1)))) {
      continue;
    }
    for (    TwillController controller : liveInfo.getControllers()) {
      RunId twillRunId=controller.getRunId();
      if (isTwillRunIdCached(twillRunId)) {
        continue;
      }
      Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),type,matcher.group(4));
      twillProgramInfo.put(programId,twillRunId,controller);
    }
  }
  if (twillProgramInfo.isEmpty()) {
    return ImmutableMap.copyOf(result);
  }
  final Set<RunId> twillRunIds=twillProgramInfo.columnKeySet();
  List<RunRecord> activeRunRecords=store.getRuns(ProgramRunStatus.RUNNING,new Predicate<RunRecord>(){
    @Override public boolean apply(    RunRecord record){
      if (record.getTwillRunId() == null) {
        return false;
      }
      return twillRunIds.contains(record.getTwillRunId());
    }
  }
);
  for (  RunRecord record : activeRunRecords) {
    RunId twillRunIdFromRecord=org.apache.twill.internal.RunIds.fromString(record.getTwillRunId());
    RunId runId=RunIds.fromString(record.getPid());
    Map<Id.Program,TwillController> mapForTwillId=twillProgramInfo.columnMap().get(twillRunIdFromRecord);
    Map.Entry<Id.Program,TwillController> entry=mapForTwillId.entrySet().iterator().next();
    RuntimeInfo runtimeInfo=createRuntimeInfo(type,entry.getKey(),entry.getValue(),runId);
    if (runtimeInfo != null) {
      result.put(runId,runtimeInfo);
      updateRuntimeInfo(type,runId,runtimeInfo);
    }
 else {
      LOG.warn("String_Node_Str",type,entry.getKey());
    }
  }
  return ImmutableMap.copyOf(result);
}

Fixed version (ground truth):
@Override public synchronized Map<RunId,RuntimeInfo> list(ProgramType type){
  Map<RunId,RuntimeInfo> result=Maps.newHashMap();
  result.putAll(super.list(type));
  Table<Id.Program,RunId,TwillController> twillProgramInfo=HashBasedTable.create();
  for (  TwillRunner.LiveInfo liveInfo : twillRunner.lookupLive()) {
    String appName=liveInfo.getApplicationName();
    Matcher matcher=APP_NAME_PATTERN.matcher(appName);
    if (!matcher.matches()) {
      continue;
    }
    if (!type.equals(getType(matcher.group(1)))) {
      continue;
    }
    for (    TwillController controller : liveInfo.getControllers()) {
      RunId twillRunId=controller.getRunId();
      if (isTwillRunIdCached(twillRunId)) {
        continue;
      }
      Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),type,matcher.group(4));
      twillProgramInfo.put(programId,twillRunId,controller);
    }
  }
  if (twillProgramInfo.isEmpty()) {
    return ImmutableMap.copyOf(result);
  }
  final Set<RunId> twillRunIds=twillProgramInfo.columnKeySet();
  List<RunRecord> activeRunRecords=store.getRuns(ProgramRunStatus.RUNNING,new Predicate<RunRecord>(){
    @Override public boolean apply(    RunRecord record){
      return record.getTwillRunId() != null && twillRunIds.contains(org.apache.twill.internal.RunIds.fromString(record.getTwillRunId()));
    }
  }
);
  for (  RunRecord record : activeRunRecords) {
    RunId twillRunIdFromRecord=org.apache.twill.internal.RunIds.fromString(record.getTwillRunId());
    RunId runId=RunIds.fromString(record.getPid());
    Map<Id.Program,TwillController> mapForTwillId=twillProgramInfo.columnMap().get(twillRunIdFromRecord);
    Map.Entry<Id.Program,TwillController> entry=mapForTwillId.entrySet().iterator().next();
    RuntimeInfo runtimeInfo=createRuntimeInfo(type,entry.getKey(),entry.getValue(),runId);
    if (runtimeInfo != null) {
      result.put(runId,runtimeInfo);
      updateRuntimeInfo(type,runId,runtimeInfo);
    }
 else {
      LOG.warn("String_Node_Str",type,entry.getKey());
    }
  }
  return ImmutableMap.copyOf(result);
}