Program: 114799
Project: 114799
Buggy source:
private void updateSwaggerResources(GenericArtifact[] artifacts,Tenant tenant) throws APIMigrationException {
  log.debug("String_Node_Str");
  APIDefinitionFromSwagger20 definitionFromSwagger20=new APIDefinitionFromSwagger20();
  for (  GenericArtifact artifact : artifacts) {
    API api=registryService.getAPI(artifact);
    if (api != null) {
      APIIdentifier apiIdentifier=api.getId();
      String apiName=apiIdentifier.getApiName();
      String apiVersion=apiIdentifier.getVersion();
      String apiProviderName=apiIdentifier.getProviderName();
      try {
        String swagger2location=ResourceUtil.getSwagger2ResourceLocation(apiName,apiVersion,apiProviderName);
        String swagger12location=ResourceUtil.getSwagger12ResourceLocation(apiName,apiVersion,apiProviderName);
        String swagger2Document;
        if (!registryService.isGovernanceRegistryResourceExists(swagger12location)) {
          log.debug("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName);
          swagger2Document=definitionFromSwagger20.generateAPIDefinition(api);
        }
 else {
          log.debug("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName);
          swagger2Document=getSwagger2docUsingSwagger12RegistryResources(tenant,swagger12location,api);
        }
        registryService.addGovernanceRegistryResource(swagger2location,swagger2Document,"String_Node_Str");
        registryService.setGovernanceRegistryResourcePermissions(apiProviderName,null,null,swagger2location);
      }
 catch (      RegistryException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      ParseException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      UserStoreException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      MalformedURLException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      APIManagementException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
    }
  }
}

Fixed version (ground truth):
private void updateSwaggerResources(GenericArtifact[] artifacts,Tenant tenant) throws APIMigrationException {
  log.debug("String_Node_Str");
  APIDefinitionFromSwagger20 definitionFromSwagger20=new APIDefinitionFromSwagger20();
  for (  GenericArtifact artifact : artifacts) {
    API api=registryService.getAPI(artifact);
    if (api != null) {
      APIIdentifier apiIdentifier=api.getId();
      String apiName=apiIdentifier.getApiName();
      String apiVersion=apiIdentifier.getVersion();
      String apiProviderName=apiIdentifier.getProviderName();
      try {
        String swagger2location=ResourceUtil.getSwagger2ResourceLocation(apiName,apiVersion,apiProviderName);
        String swagger12location=ResourceUtil.getSwagger12ResourceLocation(apiName,apiVersion,apiProviderName);
        String swagger2Document;
        if (!registryService.isGovernanceRegistryResourceExists(swagger12location)) {
          log.debug("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName);
          swagger2Document=definitionFromSwagger20.generateAPIDefinition(api);
        }
 else {
          log.debug("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName);
          swagger2Document=getSwagger2docUsingSwagger12RegistryResources(tenant,swagger12location,api);
        }
        registryService.addGovernanceRegistryResource(swagger2location,swagger2Document,"String_Node_Str");
        registryService.setGovernanceRegistryResourcePermissions(apiProviderName,null,null,swagger2location);
      }
 catch (      RegistryException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      ParseException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      UserStoreException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      MalformedURLException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      APIManagementException e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
catch (      Exception e) {
        log.error("String_Node_Str" + apiName + '-'+ apiVersion+ '-'+ apiProviderName+ "String_Node_Str"+ tenant.getId()+ '('+ tenant.getDomain()+ ')',e);
      }
    }
  }
}