Program: 54003
Project: 54003
Buggy source:
/** 
 * makes call tree of  main view
 */
@Override public ServerCallTree selectServerCallTree(Set<TraceId> traceIds,String applicationName,long from,long to){
  final Map<String,ServiceType> terminalQueryParams=new HashMap<String,ServiceType>();
  final ServerCallTree tree=new ServerCallTree();
  StopWatch watch=new StopWatch();
  watch.start("String_Node_Str");
  List<List<SpanBo>> traces=this.traceDao.selectSpans(traceIds);
  watch.stop();
  int totalNonTerminalSpansCount=0;
  Set<String> endPoints=new HashSet<String>();
  for (  List<SpanBo> transaction : traces) {
    totalNonTerminalSpansCount+=transaction.size();
    markRecursiveCall(transaction);
    for (    SpanBo eachTransaction : transaction) {
      tree.addSpan(eachTransaction);
      terminalQueryParams.put(eachTransaction.getServiceName(),eachTransaction.getServiceType());
      endPoints.add(eachTransaction.getEndPoint());
    }
  }
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str",new Object[]{watch.getLastTaskTimeMillis(),traces.size(),totalNonTerminalSpansCount});
  }
  watch.start("String_Node_Str");
  for (  Entry<String,ServiceType> param : terminalQueryParams.entrySet()) {
    ServiceType svcType=param.getValue();
    if (!svcType.isRpcClient() && !svcType.isUnknown() && !svcType.isTerminal()) {
      long start=System.currentTimeMillis();
      List<List<TerminalRequest>> terminals=terminalStatisticsDao.selectTerminal(param.getKey(),from,to);
      logger.info("String_Node_Str",param.getKey(),System.currentTimeMillis() - start);
      for (      List<TerminalRequest> terminal : terminals) {
        for (        TerminalRequest t : terminal) {
          if (!endPoints.contains(t.getTo())) {
            t.setToServiceType(ServiceType.UNKNOWN_CLOUD.getCode());
            tree.addTerminal(t);
          }
 else {
          }
        }
      }
    }
  }
  watch.stop();
  logger.info("String_Node_Str",watch.getLastTaskTimeMillis());
  return tree.build();
}

Fixed version (ground truth):
/** 
 * makes call tree of  main view
 */
@Override public ServerCallTree selectServerCallTree(Set<TraceId> traceIds,String applicationName,long from,long to){
  final Map<String,ServiceType> terminalQueryParams=new HashMap<String,ServiceType>();
  final ServerCallTree tree=new ServerCallTree();
  StopWatch watch=new StopWatch();
  watch.start("String_Node_Str");
  List<List<SpanBo>> traces=this.traceDao.selectSpans(traceIds);
  watch.stop();
  int totalNonTerminalSpansCount=0;
  Set<String> endPoints=new HashSet<String>();
  for (  List<SpanBo> transaction : traces) {
    totalNonTerminalSpansCount+=transaction.size();
    markRecursiveCall(transaction);
    for (    SpanBo eachTransaction : transaction) {
      tree.addSpan(eachTransaction);
      terminalQueryParams.put(eachTransaction.getServiceName(),eachTransaction.getServiceType());
      endPoints.add(eachTransaction.getEndPoint());
    }
  }
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str",new Object[]{watch.getLastTaskTimeMillis(),traces.size(),totalNonTerminalSpansCount});
  }
  watch.start("String_Node_Str");
  for (  Entry<String,ServiceType> param : terminalQueryParams.entrySet()) {
    ServiceType svcType=param.getValue();
    if (!svcType.isRpcClient() && !svcType.isUnknown() && !svcType.isTerminal()) {
      long start=System.currentTimeMillis();
      List<List<TerminalRequest>> terminals=terminalStatisticsDao.selectTerminal(param.getKey(),from,to);
      logger.info("String_Node_Str",param.getKey(),System.currentTimeMillis() - start);
      for (      List<TerminalRequest> terminal : terminals) {
        for (        TerminalRequest t : terminal) {
          if (!endPoints.contains(t.getTo())) {
            if (ServiceType.parse(t.getToServiceType()).isRpcClient()) {
              t.setToServiceType(ServiceType.UNKNOWN_CLOUD.getCode());
            }
            tree.addTerminal(t);
          }
        }
      }
    }
  }
  watch.stop();
  logger.info("String_Node_Str",watch.getLastTaskTimeMillis());
  return tree.build();
}