Program: 167313
Project: 167313
Buggy source:
protected void refresh(String projectVersionId,List<Plugin> distinctPlugins){
  long ts=System.currentTimeMillis();
  loadComponentsForClassloader(projectVersionId,"String_Node_Str" + VersionUtils.getCurrentVersion(),getClass().getClassLoader());
  List<PluginRepository> remoteRepostiories=pluginService.findPluginRepositories();
  List<ProjectVersionDefinitionPlugin> pvcps=configurationService.findProjectVersionComponentPlugins(projectVersionId);
  GenericVersionScheme versionScheme=new GenericVersionScheme();
  for (  Plugin configuredPlugin : distinctPlugins) {
    logger.info("String_Node_Str",configuredPlugin.toString(),projectVersionId);
    boolean matched=false;
    for (    ProjectVersionDefinitionPlugin pvcp : pvcps) {
      if (pvcp.matches(configuredPlugin)) {
        try {
          matched=true;
          String latestVersion=pluginManager.getLatestLocalVersion(pvcp.getArtifactGroup(),pvcp.getArtifactName());
          if (isNotBlank(latestVersion)) {
            Version version=versionScheme.parseVersion(latestVersion);
            if (!pvcp.getArtifactVersion().equals(latestVersion)) {
              Version previousVersion=versionScheme.parseVersion(pvcp.getArtifactVersion());
              if (previousVersion.compareTo(version) == -1) {
                if (!pvcp.isPinVersion()) {
                  logger.info("String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),latestVersion);
                  pvcp.setArtifactVersion(latestVersion);
                  pvcp.setLatestArtifactVersion(latestVersion);
                }
 else {
                  logger.info("String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),latestVersion);
                  pvcp.setLatestArtifactVersion(latestVersion);
                }
                configurationService.save(pvcp);
              }
 else {
                logger.info("String_Node_Str" + "String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),latestVersion);
              }
            }
          }
          matched=null != load(projectVersionId,pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),remoteRepostiories);
          if (!matched) {
            logger.warn("String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion());
            pluginService.delete(pvcp);
            pluginService.delete((Plugin)pvcp);
          }
        }
 catch (        InvalidVersionSpecificationException e) {
          logger.error("String_Node_Str",e);
        }
        break;
      }
    }
    if (!matched) {
      String latestVersion=pluginManager.getLatestLocalVersion(configuredPlugin.getArtifactGroup(),configuredPlugin.getArtifactName());
      if (latestVersion != null) {
        String pluginId=load(projectVersionId,configuredPlugin.getArtifactGroup(),configuredPlugin.getArtifactName(),latestVersion,remoteRepostiories);
        List<XMLAbstractDefinition> definitions=definitionsByPluginId.get(pluginId);
        if (definitions != null) {
          definitions=new ArrayList<>(definitionsByPluginId.get(pluginId));
          for (          XMLAbstractDefinition definition : definitions) {
            ProjectVersionDefinitionPlugin plugin=new ProjectVersionDefinitionPlugin();
            plugin.setProjectVersionId(projectVersionId);
            plugin.setDefinitionTypeId(definition.getId());
            plugin.setDefinitionName(definition.getName());
            plugin.setArtifactGroup(configuredPlugin.getArtifactGroup());
            plugin.setArtifactName(configuredPlugin.getArtifactName());
            plugin.setArtifactVersion(latestVersion);
            plugin.setLatestArtifactVersion(latestVersion);
            if (definition instanceof XMLComponentDefinition) {
              plugin.setDefinitionType(DEFINTION_TYPE_COMPONENT);
            }
 else             if (definition instanceof XMLResourceDefinition) {
              plugin.setDefinitionType(DEFINTION_TYPE_RESOURCE);
            }
 else {
              throw new IllegalStateException("String_Node_Str");
            }
            configurationService.save(plugin);
          }
        }
 else {
          logger.warn("String_Node_Str",pluginId);
        }
      }
 else {
        logger.warn("String_Node_Str",configuredPlugin.getArtifactGroup(),configuredPlugin.getArtifactName());
      }
    }
  }
  long time=System.currentTimeMillis() - ts;
  if (time > 1000) {
    logger.info("String_Node_Str",time,projectVersionId);
  }
}

Fixed version (ground truth):
protected void refresh(String projectVersionId,List<Plugin> distinctPlugins){
  long ts=System.currentTimeMillis();
  loadComponentsForClassloader(projectVersionId,"String_Node_Str" + VersionUtils.getCurrentVersion(),getClass().getClassLoader());
  List<PluginRepository> remoteRepostiories=pluginService.findPluginRepositories();
  List<ProjectVersionDefinitionPlugin> pvcps=configurationService.findProjectVersionComponentPlugins(projectVersionId);
  GenericVersionScheme versionScheme=new GenericVersionScheme();
  for (  Plugin configuredPlugin : distinctPlugins) {
    boolean matched=false;
    for (    ProjectVersionDefinitionPlugin pvcp : pvcps) {
      if (pvcp.matches(configuredPlugin)) {
        try {
          matched=true;
          String latestVersion=pluginManager.getLatestLocalVersion(pvcp.getArtifactGroup(),pvcp.getArtifactName());
          if (isNotBlank(latestVersion)) {
            Version version=versionScheme.parseVersion(latestVersion);
            if (!pvcp.getArtifactVersion().equals(latestVersion)) {
              Version previousVersion=versionScheme.parseVersion(pvcp.getArtifactVersion());
              if (previousVersion.compareTo(version) == -1) {
                if (!pvcp.isPinVersion()) {
                  logger.info("String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),latestVersion);
                  pvcp.setArtifactVersion(latestVersion);
                  pvcp.setLatestArtifactVersion(latestVersion);
                }
 else {
                  logger.info("String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),latestVersion);
                  pvcp.setLatestArtifactVersion(latestVersion);
                }
                configurationService.save(pvcp);
              }
 else {
                logger.info("String_Node_Str" + "String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),latestVersion);
              }
            }
          }
          matched=null != load(projectVersionId,pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion(),remoteRepostiories);
          if (!matched) {
            logger.warn("String_Node_Str",pvcp.getArtifactGroup(),pvcp.getArtifactName(),pvcp.getArtifactVersion());
            pluginService.delete(pvcp);
            pluginService.delete((Plugin)pvcp);
          }
        }
 catch (        InvalidVersionSpecificationException e) {
          logger.error("String_Node_Str",e);
        }
        break;
      }
    }
    if (!matched) {
      String latestVersion=pluginManager.getLatestLocalVersion(configuredPlugin.getArtifactGroup(),configuredPlugin.getArtifactName());
      if (latestVersion != null) {
        String pluginId=load(projectVersionId,configuredPlugin.getArtifactGroup(),configuredPlugin.getArtifactName(),latestVersion,remoteRepostiories);
        List<XMLAbstractDefinition> definitions=definitionsByPluginId.get(pluginId);
        if (definitions != null) {
          definitions=new ArrayList<>(definitionsByPluginId.get(pluginId));
          for (          XMLAbstractDefinition definition : definitions) {
            ProjectVersionDefinitionPlugin plugin=new ProjectVersionDefinitionPlugin();
            plugin.setProjectVersionId(projectVersionId);
            plugin.setDefinitionTypeId(definition.getId());
            plugin.setDefinitionName(definition.getName());
            plugin.setArtifactGroup(configuredPlugin.getArtifactGroup());
            plugin.setArtifactName(configuredPlugin.getArtifactName());
            plugin.setArtifactVersion(latestVersion);
            plugin.setLatestArtifactVersion(latestVersion);
            if (definition instanceof XMLComponentDefinition) {
              plugin.setDefinitionType(DEFINTION_TYPE_COMPONENT);
            }
 else             if (definition instanceof XMLResourceDefinition) {
              plugin.setDefinitionType(DEFINTION_TYPE_RESOURCE);
            }
 else {
              throw new IllegalStateException("String_Node_Str");
            }
            configurationService.save(plugin);
          }
        }
 else {
          logger.warn("String_Node_Str",pluginId);
        }
      }
 else {
        logger.warn("String_Node_Str",configuredPlugin.getArtifactGroup(),configuredPlugin.getArtifactName());
      }
    }
  }
  long time=System.currentTimeMillis() - ts;
  if (time > 1000) {
    logger.info("String_Node_Str",time,projectVersionId);
  }
}