Program: 80230
Project: 80230
Buggy source:
/** 
 * Process return status for component instances
 * @param heartBeat
 * @param componentStatus
 */
protected void publishConfigAndExportGroups(HeartBeat heartBeat,ComponentInstanceState componentStatus,String componentGroup){
  List<ComponentStatus> statuses=heartBeat.getComponentStatus();
  if (statuses != null && !statuses.isEmpty()) {
    log.info("String_Node_Str",statuses.size());
    for (    ComponentStatus status : statuses) {
      log.info("String_Node_Str",status.toString());
      if (status.getConfigs() != null) {
        Application application=getMetaInfo(componentGroup).getApplication();
        if ((!canAnyMasterPublishConfig(componentGroup) || canPublishConfig(componentGroup)) && !getAmState().getAppConfSnapshot().getComponentOptBool(componentGroup,AgentKeys.AM_CONFIG_GENERATION,false)) {
          Set<String> exportedConfigs=new HashSet();
          String exportedConfigsStr=application.getExportedConfigs();
          boolean exportedAllConfigs=exportedConfigsStr == null || exportedConfigsStr.isEmpty();
          if (!exportedAllConfigs) {
            for (            String exportedConfig : exportedConfigsStr.split("String_Node_Str")) {
              if (exportedConfig.trim().length() > 0) {
                exportedConfigs.add(exportedConfig.trim());
              }
            }
          }
          for (          String key : status.getConfigs().keySet()) {
            if ((!exportedAllConfigs && exportedConfigs.contains(key)) || exportedAllConfigs) {
              Map<String,String> configs=status.getConfigs().get(key);
              publishApplicationInstanceData(key,key,configs.entrySet());
            }
          }
        }
        List<ExportGroup> appExportGroups=application.getExportGroups();
        boolean hasExportGroups=SliderUtils.isNotEmpty(appExportGroups);
        Set<String> appExports=new HashSet();
        String appExportsStr=getApplicationComponent(componentGroup).getAppExports();
        if (SliderUtils.isSet(appExportsStr)) {
          for (          String appExport : appExportsStr.split("String_Node_Str")) {
            if (!appExport.trim().isEmpty()) {
              appExports.add(appExport.trim());
            }
          }
        }
        if (hasExportGroups && !appExports.isEmpty()) {
          String configKeyFormat="String_Node_Str";
          String hostKeyFormat="String_Node_Str";
          Map<String,String> replaceTokens=new HashMap<String,String>();
          for (          Map.Entry<String,Map<String,ClusterNode>> entry : getRoleClusterNodeMapping().entrySet()) {
            String hostName=getHostsList(entry.getValue().values(),true).iterator().next();
            replaceTokens.put(String.format(hostKeyFormat,entry.getKey().toUpperCase(Locale.ENGLISH)),hostName);
          }
          for (          String key : status.getConfigs().keySet()) {
            Map<String,String> configs=status.getConfigs().get(key);
            for (            String configKey : configs.keySet()) {
              String lookupKey=String.format(configKeyFormat,key,configKey);
              replaceTokens.put(lookupKey,configs.get(configKey));
            }
          }
          Set<String> modifiedGroups=new HashSet<String>();
          for (          ExportGroup exportGroup : appExportGroups) {
            List<Export> exports=exportGroup.getExports();
            if (SliderUtils.isNotEmpty(exports)) {
              String exportGroupName=exportGroup.getName();
              ConcurrentHashMap<String,List<ExportEntry>> map=(ConcurrentHashMap<String,List<ExportEntry>>)getCurrentExports(exportGroupName);
              for (              Export export : exports) {
                if (canBeExported(exportGroupName,export.getName(),appExports)) {
                  String value=export.getValue();
                  for (                  String token : replaceTokens.keySet()) {
                    if (value.contains(token)) {
                      value=value.replace(token,replaceTokens.get(token));
                    }
                  }
                  ExportEntry entry=new ExportEntry();
                  entry.setLevel(APPLICATION_TAG);
                  entry.setValue(value);
                  entry.setUpdatedTime(new Date().toString());
                  map.put(export.getName(),new ArrayList(Arrays.asList(entry)));
                  log.info("String_Node_Str",export.getName(),value);
                }
              }
              modifiedGroups.add(exportGroupName);
            }
          }
          publishModifiedExportGroups(modifiedGroups);
        }
        log.info("String_Node_Str",heartBeat.getHostname());
        componentStatus.setConfigReported(true);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Process return status for component instances
 * @param heartBeat
 * @param componentStatus
 */
protected void publishConfigAndExportGroups(HeartBeat heartBeat,ComponentInstanceState componentStatus,String componentGroup){
  List<ComponentStatus> statuses=heartBeat.getComponentStatus();
  if (statuses != null && !statuses.isEmpty()) {
    log.info("String_Node_Str",statuses.size());
    for (    ComponentStatus status : statuses) {
      log.info("String_Node_Str",status.toString());
      if (status.getConfigs() != null) {
        Application application=getMetaInfo(componentGroup).getApplication();
        if ((!canAnyMasterPublishConfig(componentGroup) || canPublishConfig(componentGroup)) && !getAmState().getAppConfSnapshot().getComponentOptBool(componentGroup,AgentKeys.AM_CONFIG_GENERATION,false)) {
          Set<String> exportedConfigs=new HashSet();
          String exportedConfigsStr=application.getExportedConfigs();
          boolean exportedAllConfigs=exportedConfigsStr == null || exportedConfigsStr.isEmpty();
          if (!exportedAllConfigs) {
            for (            String exportedConfig : exportedConfigsStr.split("String_Node_Str")) {
              if (exportedConfig.trim().length() > 0) {
                exportedConfigs.add(exportedConfig.trim());
              }
            }
          }
          for (          String key : status.getConfigs().keySet()) {
            if ((!exportedAllConfigs && exportedConfigs.contains(key)) || exportedAllConfigs) {
              Map<String,String> configs=status.getConfigs().get(key);
              publishApplicationInstanceData(key,key,configs.entrySet());
            }
          }
        }
        List<ExportGroup> appExportGroups=application.getExportGroups();
        boolean hasExportGroups=SliderUtils.isNotEmpty(appExportGroups);
        Set<String> appExports=new HashSet();
        String appExportsStr=getApplicationComponent(componentGroup).getAppExports();
        if (SliderUtils.isSet(appExportsStr)) {
          for (          String appExport : appExportsStr.split("String_Node_Str")) {
            if (!appExport.trim().isEmpty()) {
              appExports.add(appExport.trim());
            }
          }
        }
        if (hasExportGroups && !appExports.isEmpty()) {
          String configKeyFormat="String_Node_Str";
          String hostKeyFormat="String_Node_Str";
          Map<String,String> replaceTokens=new HashMap<String,String>();
          for (          Map.Entry<String,Map<String,ClusterNode>> entry : getRoleClusterNodeMapping().entrySet()) {
            String hostName=getHostsList(entry.getValue().values(),true).iterator().next();
            replaceTokens.put(String.format(hostKeyFormat,entry.getKey().toUpperCase(Locale.ENGLISH)),hostName);
          }
          for (          String key : status.getConfigs().keySet()) {
            Map<String,String> configs=status.getConfigs().get(key);
            for (            String configKey : configs.keySet()) {
              String lookupKey=String.format(configKeyFormat,key,configKey);
              replaceTokens.put(lookupKey,configs.get(configKey));
            }
          }
          Set<String> modifiedGroups=new HashSet<String>();
          for (          ExportGroup exportGroup : appExportGroups) {
            List<Export> exports=exportGroup.getExports();
            if (SliderUtils.isNotEmpty(exports)) {
              String exportGroupName=exportGroup.getName();
              ConcurrentHashMap<String,List<ExportEntry>> map=(ConcurrentHashMap<String,List<ExportEntry>>)getCurrentExports(exportGroupName);
              for (              Export export : exports) {
                if (canBeExported(exportGroupName,export.getName(),appExports)) {
                  String value=export.getValue();
                  for (                  String token : replaceTokens.keySet()) {
                    if (value.contains(token)) {
                      value=value.replaceAll(Pattern.quote(token),replaceTokens.get(token));
                    }
                  }
                  ExportEntry entry=new ExportEntry();
                  entry.setLevel(APPLICATION_TAG);
                  entry.setValue(value);
                  entry.setUpdatedTime(new Date().toString());
                  map.put(export.getName(),new ArrayList(Arrays.asList(entry)));
                  log.info("String_Node_Str",export.getName(),value);
                }
              }
              modifiedGroups.add(exportGroupName);
            }
          }
          publishModifiedExportGroups(modifiedGroups);
        }
        log.info("String_Node_Str",heartBeat.getHostname());
        componentStatus.setConfigReported(true);
      }
    }
  }
}