Source:
<code>public SourceInfoResponse getSourceInfo( SourceInfoRequest sourceInfoRequest, boolean fanoutEnabled) throws SourceUnavailableException { SourceInfoResponse response; Set<SourceDescriptor> sourceDescriptors; if (fanoutEnabled) { return getFanoutSourceInfo(sourceInfoRequest); } boolean addCatalogProviderDescriptor = false; try { validateSourceInfoRequest(sourceInfoRequest); sourceDescriptors = new LinkedHashSet<>(); Set<String> requestedSourceIds = sourceInfoRequest.getSourceIds(); if (sourceInfoRequest.isEnterprise()) { sourceDescriptors = getFederatedSourceDescriptors(frameworkProperties.getFederatedSources(), true); } else if (requestedSourceIds != null) { LOGGER.debug("getSourceRequest contains requested source ids"); Set<FederatedSource> discoveredSources = new HashSet<>(); for (String requestedSourceId : requestedSourceIds) { final Optional<FederatedSource> source = frameworkProperties .getFederatedSources() .stream() .filter(e -> e.getId().equals(requestedSourceId)) <START> .findFirst(); <END> source.ifPresent( e -> { LOGGER.debug("Found federated source: {}", requestedSourceId); discoveredSources.add(e); }); if (!source.isPresent()) { LOGGER.debug("Unable to find source: {}", requestedSourceId); if (requestedSourceId.equals(getId())) { LOGGER.debug( "adding CatalogSourceDescriptor since it was in sourceId list as: {}", requestedSourceId); addCatalogProviderDescriptor = true; } } } sourceDescriptors = getFederatedSourceDescriptors(discoveredSources, addCatalogProviderDescriptor); } else { addCatalogSourceDescriptor(sourceDescriptors); } response = new SourceInfoResponseImpl(sourceInfoRequest, null, sourceDescriptors); } catch (RuntimeException re) { LOGGER.debug("Exception during runtime while performing getSourceInfo", re); throw new SourceUnavailableException( "Exception during runtime while performing getSourceInfo"); } return response; }</code><technical_language>Is a risk of more source requestedSourceId? this case handled (e.g. log something)</technical_language>

Target:
public SourceInfoResponse getSourceInfo( SourceInfoRequest sourceInfoRequest, boolean fanoutEnabled) throws SourceUnavailableException { SourceInfoResponse response; Set<SourceDescriptor> sourceDescriptors; if (fanoutEnabled) { return getFanoutSourceInfo(sourceInfoRequest); } boolean addCatalogProviderDescriptor = false; try { validateSourceInfoRequest(sourceInfoRequest); sourceDescriptors = new LinkedHashSet<>(); Set<String> requestedSourceIds = sourceInfoRequest.getSourceIds(); if (sourceInfoRequest.isEnterprise()) { sourceDescriptors = getFederatedSourceDescriptors(frameworkProperties.getFederatedSources(), true); } else if (requestedSourceIds != null) { LOGGER.debug("getSourceRequest contains requested source ids"); Set<FederatedSource> discoveredSources = new HashSet<>(); for (String requestedSourceId : requestedSourceIds) { final List<FederatedSource> sources = frameworkProperties .getFederatedSources() .stream() .filter(e -> e.getId().equals(requestedSourceId)) .collect(Collectors.toList()); if (!sources.isEmpty()) { String logMsg = (sources.size() == 1) ? "Found federated source: {}" : "Multiple FederatedSources found for id: {}"; LOGGER.debug(logMsg, requestedSourceId); discoveredSources.add(sources.get(0)); } else { LOGGER.debug("Unable to find source: {}", requestedSourceId); if (requestedSourceId.equals(getId())) { LOGGER.debug( "adding CatalogSourceDescriptor since it was in sourceId list as: {}", requestedSourceId); addCatalogProviderDescriptor = true; } } } sourceDescriptors = getFederatedSourceDescriptors(discoveredSources, addCatalogProviderDescriptor); } else { addCatalogSourceDescriptor(sourceDescriptors); } response = new SourceInfoResponseImpl(sourceInfoRequest, null, sourceDescriptors); } catch (RuntimeException re) { LOGGER.debug("Exception during runtime while performing getSourceInfo", re); throw new SourceUnavailableException( "Exception during runtime while performing getSourceInfo"); } return response; }