Source:
private void updateSharedComponentsMap() { ResourceResolver resourceResolver = null; try { log.debug("Calculating map of components with shared properties dialogs"); Map<String, Object> authInfo = Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, (Object) SERVICE_NAME); resourceResolver = resourceResolverFactory.getServiceResourceResolver(authInfo); ComponentManager componentManager = resourceResolver.adaptTo(ComponentManager.class); Map<String, List<Boolean>> localComponentsWithSharedProperties = new HashMap<>(); for (Component component : componentManager.getComponents()) { if (component.getPath().startsWith("/apps")) { boolean hasSharedDialogForTouch = componentHasTouchDialog(component, "dialogshared"); boolean hasGlobalDialogForTouch = componentHasTouchDialog(component, "dialogglobal"); boolean hasSharedDialogForClassic = componentHasClassicDialog(component, "dialog_shared"); boolean hasGlobalDialogForClassic = componentHasClassicDialog(component, "dialog_global"); if (hasSharedDialogForTouch || hasGlobalDialogForTouch || hasSharedDialogForClassic || hasGlobalDialogForClassic) { localComponentsWithSharedProperties.put(component.getResourceType(), Arrays.asList(hasSharedDialogForTouch, hasGlobalDialogForTouch, hasSharedDialogForClassic, hasGlobalDialogForClassic)); } } } componentsWithSharedProperties = localComponentsWithSharedProperties; log.debug("Calculated map of components with shared properties dialogs: {}", componentsWithSharedProperties); } catch (org.apache.sling.api.resource.LoginException e) { log.error("Unable to log into service user to determine list of components with shared properties dialogs", e); } catch (RepositoryException e) { log.error("Unexpected error attempting to determine list of components with shared properties dialogs", e); } finally { if (resourceResolver != null) { resourceResolver.close(); } } }

Target:
private void updateSharedComponentsMap() { ResourceResolver resourceResolver = null; try { log.debug("Calculating map of components with shared properties dialogs"); Map<String, Object> authInfo = Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, (Object) SERVICE_NAME); resourceResolver = resourceResolverFactory.getServiceResourceResolver(authInfo); resourceResolver.refresh(); ComponentManager componentManager = resourceResolver.adaptTo(ComponentManager.class); Map<String, List<Boolean>> localComponentsWithSharedProperties = new HashMap<>(); for (Component component : componentManager.getComponents()) { if (component.getPath().startsWith("/apps")) { boolean hasSharedDialogForTouch = componentHasTouchDialog(component, "dialogshared"); boolean hasGlobalDialogForTouch = componentHasTouchDialog(component, "dialogglobal"); boolean hasSharedDialogForClassic = componentHasClassicDialog(component, "dialog_shared"); boolean hasGlobalDialogForClassic = componentHasClassicDialog(component, "dialog_global"); if (hasSharedDialogForTouch || hasGlobalDialogForTouch || hasSharedDialogForClassic || hasGlobalDialogForClassic) { localComponentsWithSharedProperties.put(component.getResourceType(), Arrays.asList(hasSharedDialogForTouch, hasGlobalDialogForTouch, hasSharedDialogForClassic, hasGlobalDialogForClassic)); } } } componentsWithSharedProperties = Collections.unmodifiableMap(localComponentsWithSharedProperties); log.debug("Calculated map of components with shared properties dialogs: {}", componentsWithSharedProperties); } catch (org.apache.sling.api.resource.LoginException e) { log.error("Unable to log into service user to determine list of components with shared properties dialogs", e); } catch (RepositoryException e) { log.error("Unexpected error attempting to determine list of components with shared properties dialogs", e); } finally { if (resourceResolver != null) { resourceResolver.close(); } } }