Source:
<code>public List<Map<String, Object>> getServices(String applicationID) { List<Service> services = configAdmin.listServices(getDefaultFactoryLdapFilter(), getDefaultLdapFilter()); List<Map<String, Object>> returnValues = new ArrayList<Map<String, Object>>(); BundleContext context = getContext(); if (!services.isEmpty()) { Application app = appService.getApplication(applicationID); MetaTypeService metatypeService = getMetaTypeService(); if (app != null) { try { Set<BundleInfo> bundles = app.getBundles(); Set<String> bundleLocations = new HashSet<String>(); Set<MetaTypeInformation> metatypeInformation = new HashSet<MetaTypeInformation>(); for (BundleInfo info : bundles) { bundleLocations.add(info.getLocation()); } if (metatypeService != null) { for (Bundle bundle : context.getBundles()) { <START> for (BundleInfo info : bundles) { <END> if (info.getLocation().equals(bundle.getLocation())) { metatypeInformation.add(metatypeService.getMetaTypeInformation(bundle)); } } } } for (Map<String, Object> service : services) { if (service.containsKey("configurations")) { List<Map<String, Object>> configurations = (List<Map<String, Object>>) service.get("configurations"); for (Map<String, Object> item : configurations) { if (item.containsKey("bundle_location")) { String bundleLocation = (String) item.get("bundle_location"); if (bundleLocations.contains(bundleLocation)) { returnValues.add(service); break; } } } } else { if (checkForMetaTypesForService(metatypeInformation, service)) { returnValues.add(service); } } } } catch (ApplicationServiceException e) { LOGGER.warn("There was an error while trying to access the application", e); return new ArrayList<Map<String, Object>>(); } } } return returnValues; }</code><technical_language>Minor nit, variable names (bundle bundles info) crossed eyes for a moment. rename bundleSet bundleInfo</technical_language>

Target:
public List<Map<String, Object>> getServices(String applicationID) { List<Map<String, Object>> returnValues = new ArrayList<>(); List<Service> services = configAdmin.listServices(getDefaultFactoryLdapFilter(), getDefaultLdapFilter()); if (services.isEmpty()) { return returnValues; } Set<BundleInfo> bundleInfos = getBundleInfosForApplication(applicationID); if (bundleInfos == null) { return returnValues; } Set<String> bundleLocations = new HashSet<>(); for (BundleInfo each : bundleInfos) { bundleLocations.add(each.getLocation()); } MetaTypeService metatypeService = getMetaTypeService(); Set<MetaTypeInformation> metatypeInformation = new HashSet<>(); if (metatypeService != null) { for (Bundle each : getContext().getBundles()) { for (BundleInfo bundleInfo : bundleInfos) { if (bundleInfo.getLocation().equals(each.getLocation())) { metatypeInformation.add(metatypeService.getMetaTypeInformation(each)); } } } } for (Map<String, Object> each : services) { if (each.containsKey("configurations")) { List<Map<String, Object>> configurations = (List<Map<String, Object>>) each.get("configurations"); for (Map<String, Object> item : configurations) { if (item.containsKey("bundle_location")) { String bundleLocation = (String) item.get("bundle_location"); if (bundleLocations.contains(bundleLocation)) { returnValues.add(each); break; } } } } else { if (checkForMetaTypesForService(metatypeInformation, each)) { returnValues.add(each); } } } return returnValues; }