Source:
protected void processAutomationProvider(Bundle bundle) { synchronized (providerPortfolio) { for (Vendor vendor : providerPortfolio.keySet()) { if (vendor.getVendorSymbolicName().equals(bundle.getSymbolicName()) && !vendor.getVendorVersion().equals(bundle.getVersion().toString())) { List<String> portfolio = providerPortfolio.remove(vendor); if (portfolio != null && !portfolio.isEmpty()) { for (String uid : portfolio) { synchronized (providedObjectsHolder) { providedObjectsHolder.remove(uid); } } } break; } } } Enumeration<URL> urlEnum = null; try { urlEnum = bundle.findEntries(path, null, false); } catch (IllegalStateException e) { logger.error("Can't read from resource of bundle with ID " + bundle.getBundleId(), e); processAutomationProviderUninstalled(bundle); } if (urlEnum == null) { return; } Vendor vendor = new Vendor(bundle.getSymbolicName(), bundle.getVersion().toString()); while (urlEnum.hasMoreElements()) { URL url = urlEnum.nextElement(); String parserType = getParserType(url); Parser<E> parser = parsers.get(parserType); synchronized (waitingProviders) { List<URL> urlList = waitingProviders.get(bundle); if (parser != null) { if (urlList != null && urlList.remove(url) && urlList.isEmpty()) { waitingProviders.remove(bundle); } InputStreamReader reader = null; try { importData(vendor, parser, reader = new InputStreamReader(url.openStream())); } catch (IOException e) { logger.error("Can't read from resource of bundle with ID " + bundle.getBundleId(), e); processAutomationProviderUninstalled(bundle); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignore) { } } } } else if (parser == null) { if (urlList == null) { urlList = new ArrayList<URL>(); } urlList.add(url); waitingProviders.put(bundle, urlList); } } } }

Target:
protected void processAutomationProvider(Bundle bundle) { synchronized (providerPortfolio) { for (Vendor vendor : providerPortfolio.keySet()) { if (vendor.getVendorSymbolicName().equals(bundle.getSymbolicName()) && !vendor.getVendorVersion().equals(bundle.getVersion().toString())) { List<String> portfolio = providerPortfolio.remove(vendor); if (portfolio != null && !portfolio.isEmpty()) { for (String uid : portfolio) { synchronized (providedObjectsHolder) { providedObjectsHolder.remove(uid); } } } break; } } } Enumeration<URL> urlEnum = null; try { urlEnum = bundle.findEntries(path, null, false); } catch (IllegalStateException e) { logger.debug("Can't read from resource of bundle with ID " + bundle.getBundleId() + ". The bundle is uninstalled.", e); processAutomationProviderUninstalled(bundle); } if (urlEnum == null) { return; } Vendor vendor = new Vendor(bundle.getSymbolicName(), bundle.getVersion().toString()); while (urlEnum.hasMoreElements()) { URL url = urlEnum.nextElement(); String parserType = getParserType(url); Parser<E> parser = parsers.get(parserType); synchronized (waitingProviders) { List<URL> urlList = waitingProviders.get(bundle); if (parser != null) { if (urlList != null && urlList.remove(url) && urlList.isEmpty()) { waitingProviders.remove(bundle); } InputStreamReader reader = null; try { importData(vendor, parser, reader = new InputStreamReader(url.openStream())); } catch (IOException e) { logger.error("Can't read from resource of bundle with ID " + bundle.getBundleId(), e); processAutomationProviderUninstalled(bundle); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignore) { } } } } else if (parser == null) { if (urlList == null) { urlList = new ArrayList<URL>(); } urlList.add(url); waitingProviders.put(bundle, urlList); } } } }