Program: 79743
Project: 79743
Buggy source:
public Set getAssignedServices(SSOToken token,IdType type,String name,Map mapOfServiceNamesAndOCs,String amOrgName,String amsdkDN) throws IdRepoException, SSOException {
  IdRepoException origEx=null;
  checkPermission(token,amOrgName,name,null,IdOperation.READ,type);
  Set configuredPluginClasses=idrepoCache.getIdRepoPlugins(amOrgName,IdOperation.SERVICE,type);
  if ((configuredPluginClasses == null) || configuredPluginClasses.isEmpty()) {
    if (ServiceManager.getBaseDN().equalsIgnoreCase(amOrgName) && (type.equals(IdType.REALM))) {
      return (configuredPluginClasses);
    }
 else {
      throw new IdRepoException(IdRepoBundle.BUNDLE_NAME,"String_Node_Str",null);
    }
  }
  Iterator it=configuredPluginClasses.iterator();
  int noOfSuccess=configuredPluginClasses.size();
  IdRepo idRepo=null;
  Set resultsSet=new HashSet();
  while (it.hasNext()) {
    IdRepo repo=(IdRepo)it.next();
    try {
      Set services=null;
      if (repo.getClass().getName().equals(IdConstants.AMSDK_PLUGIN) && amsdkDN != null) {
        services=repo.getAssignedServices(token,type,amsdkDN,mapOfServiceNamesAndOCs);
      }
 else {
        services=repo.getAssignedServices(token,type,name,mapOfServiceNamesAndOCs);
      }
      if (services != null && !services.isEmpty()) {
        resultsSet.addAll(services);
      }
    }
 catch (    IdRepoUnsupportedOpException ide) {
      if (idRepo != null && DEBUG.messageEnabled()) {
        DEBUG.message("String_Node_Str" + "String_Node_Str" + repo.getClass().getName() + "String_Node_Str"+ ide.getMessage());
      }
      noOfSuccess--;
      origEx=(origEx == null) ? ide : origEx;
    }
catch (    IdRepoFatalException idf) {
      DEBUG.error("String_Node_Str" + "String_Node_Str",idf);
      throw idf;
    }
catch (    IdRepoException ide) {
      if (idRepo != null && DEBUG.warningEnabled()) {
        DEBUG.warning("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + idRepo.getClass().getName() + "String_Node_Str"+ ide.getMessage());
      }
      noOfSuccess--;
      origEx=(origEx == null) ? ide : origEx;
    }
  }
  if (noOfSuccess == 0) {
    if (DEBUG.warningEnabled()) {
      DEBUG.warning("String_Node_Str" + "String_Node_Str" + type.getName() + "String_Node_Str"+ name+ "String_Node_Str",origEx);
    }
    throw origEx;
  }
 else {
    return resultsSet;
  }
}

Fixed version (ground truth):
public Set<String> getAssignedServices(SSOToken token,IdType type,String name,Map mapOfServiceNamesAndOCs,String amOrgName,String amsdkDN) throws IdRepoException, SSOException {
  IdRepoException origEx=null;
  checkPermission(token,amOrgName,name,null,IdOperation.READ,type);
  Set<IdRepo> configuredPluginClasses=idrepoCache.getIdRepoPlugins(amOrgName,IdOperation.SERVICE,type);
  if (configuredPluginClasses == null || configuredPluginClasses.isEmpty()) {
    if (type.equals(IdType.REALM)) {
      return Collections.emptySet();
    }
  }
  int noOfSuccess=configuredPluginClasses.size();
  Set<String> resultsSet=new HashSet<String>();
  for (  IdRepo repo : configuredPluginClasses) {
    try {
      Set<String> services;
      if (repo.getClass().getName().equals(IdConstants.AMSDK_PLUGIN) && amsdkDN != null) {
        services=repo.getAssignedServices(token,type,amsdkDN,mapOfServiceNamesAndOCs);
      }
 else {
        services=repo.getAssignedServices(token,type,name,mapOfServiceNamesAndOCs);
      }
      if (services != null && !services.isEmpty()) {
        resultsSet.addAll(services);
      }
    }
 catch (    IdRepoUnsupportedOpException ide) {
      if (DEBUG.messageEnabled()) {
        DEBUG.message("String_Node_Str" + repo.getClass().getName() + "String_Node_Str"+ ide.getMessage());
      }
      noOfSuccess--;
      origEx=origEx == null ? ide : origEx;
    }
catch (    IdRepoFatalException idf) {
      DEBUG.error("String_Node_Str",idf);
      throw idf;
    }
catch (    IdRepoException ide) {
      if (DEBUG.warningEnabled()) {
        DEBUG.warning("String_Node_Str" + "String_Node_Str" + repo.getClass().getName() + "String_Node_Str"+ ide.getMessage());
      }
      noOfSuccess--;
      origEx=(origEx == null) ? ide : origEx;
    }
  }
  if (noOfSuccess == 0) {
    if (DEBUG.warningEnabled()) {
      DEBUG.warning("String_Node_Str" + type.getName() + "String_Node_Str"+ name+ "String_Node_Str",origEx);
    }
    throw origEx;
  }
 else {
    return resultsSet;
  }
}