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()); } <START> if (context != null) { <END> for (Bundle bundle : context.getBundles()) { for (BundleInfo info : bundles) { if (info.getLocation().equals(bundle.getLocation()) && metatypeService != null) { 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>getContext() method tagged @Nullable return null</technical_language>

Target:
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()) { for (BundleInfo info : bundles) { 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; }