[jira] [Resolved] (SLING-12019) Avoid duplicate ResourceResolverFactory registrations
[ https://issues.apache.org/jira/browse/SLING-12019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julian Sedding resolved SLING-12019. Resolution: Fixed Merged PR. > Avoid duplicate ResourceResolverFactory registrations > - > > Key: SLING-12019 > URL: https://issues.apache.org/jira/browse/SLING-12019 > Project: Sling > Issue Type: Bug > Components: ResourceResolver >Affects Versions: Resource Resolver 1.10.0 >Reporter: Carsten Ziegeler >Assignee: Julian Sedding >Priority: Critical > Fix For: Resource Resolver 1.11.0 > > > It seems that in some situations a new resource resolver factory is > registered without unregistering the old one - which leads to two factories > being registered. As not all components do eager service binding, these > components stick to the old factory - and the old factory in turn is > basically "empty" meaning all resource providers are unregistered. This > prevents those components from reaching any resource, although everything > looks fine. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding merged pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
jsedding merged PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
sonarcloud[bot] commented on PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#issuecomment-1717676464 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![81.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '81.9%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [81.9% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] cziegeler merged pull request #97: Issues/sling 11742
cziegeler merged PR #97: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/97 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Resolved] (SLING-11742) Provide alternative equitable terminology for properties
[ https://issues.apache.org/jira/browse/SLING-11742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carsten Ziegeler resolved SLING-11742. -- Resolution: Fixed Applied the PR > Provide alternative equitable terminology for properties > > > Key: SLING-11742 > URL: https://issues.apache.org/jira/browse/SLING-11742 > Project: Sling > Issue Type: Improvement >Reporter: Cioriia Cristian >Assignee: Cioriia Cristian >Priority: Major > Fix For: Resource Resolver 1.11.0 > > Time Spent: 1h 40m > Remaining Estimate: 0h > > The "resource.resolver.vanitypath.blacklist" and > "resource.resolver.vanitypath.whitelist" proeprties contain terms which are > considered inequitable terminology and some customers are prevented to use > these terms by their git commit policies. > Therefore, some more acceptable equivalents should be provided for these > terms. The proposal is to provide the > "resource.resolver.vanitypath.deniedlist" and > "resource.resolver.vanitypath.allowedlist" alternatives for them. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-resourceresolver] rombert commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
rombert commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324447258 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { Review Comment: Thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
sonarcloud[bot] commented on PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#issuecomment-1717542331 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![81.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '81.9%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [81.9% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
jsedding commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324438406 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { +final Runnable unregisterTask = runnables.get(runnables.size() - 2); +unregisterTask.run(); +} +} +} catch (InterruptedException e) { +Thread.currentThread().interrupt(); +} +} + +/** + * Check the preconditions and if it changed, either register factory or unregister + */ +void maybeRegisterFactory(final String unavailableName, final String unavailableServicePid) { +if (!factoryRegistrationWorker.isShutdown()) { +LOG.debug("submitting maybeRegisterFactory"); +factoryRegistrationWorker.submit(() -> { +final boolean preconditionsOk = factoryPreconditions.checkPreconditions(unavailableName, unavailableServicePid); +if ( preconditionsOk && this.factoryRegistration == null ) { +// check system bundle state - if stopping, don't register new factory +final Bundle systemBundle = activator.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION); +if ( systemBundle != null && systemBundle.getState() != Bundle.STOPPING ) { +withThreadName("ResourceResolverFactory registration", this::doRegisterFactory); +} +} else if ( !preconditionsOk && this.factoryRegistration != null ) { +LOG.debug("performing unregisterFactory via maybeRegisterFactory"); +withThreadName("ResourceResolverFactory deregistration", this::doUnregisterFactory); +} +}); +} +} + +void unregisterFactory() { +LOG.debug("submitting unregisterFactory"); +factoryRegistrationWorker.submit(() -> withThreadName("ResourceResolverFactory deregistration", +this::doUnregisterFactory)); +} + +/** + * Regi
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
sonarcloud[bot] commented on PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#issuecomment-1717534348 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![81.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '81.9%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [81.9% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
jsedding commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324435077 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { +final Runnable unregisterTask = runnables.get(runnables.size() - 2); +unregisterTask.run(); +} +} +} catch (InterruptedException e) { +Thread.currentThread().interrupt(); +} +} + +/** + * Check the preconditions and if it changed, either register factory or unregister + */ +void maybeRegisterFactory(final String unavailableName, final String unavailableServicePid) { +if (!factoryRegistrationWorker.isShutdown()) { +LOG.debug("submitting maybeRegisterFactory"); +factoryRegistrationWorker.submit(() -> { +final boolean preconditionsOk = factoryPreconditions.checkPreconditions(unavailableName, unavailableServicePid); +if ( preconditionsOk && this.factoryRegistration == null ) { +// check system bundle state - if stopping, don't register new factory +final Bundle systemBundle = activator.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION); +if ( systemBundle != null && systemBundle.getState() != Bundle.STOPPING ) { +withThreadName("ResourceResolverFactory registration", this::doRegisterFactory); +} +} else if ( !preconditionsOk && this.factoryRegistration != null ) { +LOG.debug("performing unregisterFactory via maybeRegisterFactory"); +withThreadName("ResourceResolverFactory deregistration", this::doUnregisterFactory); +} +}); +} +} + +void unregisterFactory() { +LOG.debug("submitting unregisterFactory"); +factoryRegistrationWorker.submit(() -> withThreadName("ResourceResolverFactory deregistration", +this::doUnregisterFactory)); +} + +/** + * Regi
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
jsedding commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324434631 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { Review Comment: Fixed with https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100/commits/64a00364721b44d9319219ce9ac0e102fa8032fa -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] rombert commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
rombert commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324433044 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { +final Runnable unregisterTask = runnables.get(runnables.size() - 2); +unregisterTask.run(); +} +} +} catch (InterruptedException e) { +Thread.currentThread().interrupt(); +} +} + +/** + * Check the preconditions and if it changed, either register factory or unregister + */ +void maybeRegisterFactory(final String unavailableName, final String unavailableServicePid) { +if (!factoryRegistrationWorker.isShutdown()) { +LOG.debug("submitting maybeRegisterFactory"); +factoryRegistrationWorker.submit(() -> { +final boolean preconditionsOk = factoryPreconditions.checkPreconditions(unavailableName, unavailableServicePid); +if ( preconditionsOk && this.factoryRegistration == null ) { +// check system bundle state - if stopping, don't register new factory +final Bundle systemBundle = activator.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION); +if ( systemBundle != null && systemBundle.getState() != Bundle.STOPPING ) { +withThreadName("ResourceResolverFactory registration", this::doRegisterFactory); +} +} else if ( !preconditionsOk && this.factoryRegistration != null ) { +LOG.debug("performing unregisterFactory via maybeRegisterFactory"); +withThreadName("ResourceResolverFactory deregistration", this::doUnregisterFactory); +} +}); +} +} + +void unregisterFactory() { +LOG.debug("submitting unregisterFactory"); +factoryRegistrationWorker.submit(() -> withThreadName("ResourceResolverFactory deregistration", +this::doUnregisterFactory)); +} + +/** + * Regis
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
jsedding commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324431204 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { Review Comment: I think you found an artifact from a previous iteration of the patch. The intention was to make sure that the RRF is unregistered before we exit the `close()` method. I'll fix the code accordingly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
jsedding commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324428679 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { +final Runnable unregisterTask = runnables.get(runnables.size() - 2); +unregisterTask.run(); +} +} +} catch (InterruptedException e) { +Thread.currentThread().interrupt(); +} +} + +/** + * Check the preconditions and if it changed, either register factory or unregister + */ +void maybeRegisterFactory(final String unavailableName, final String unavailableServicePid) { +if (!factoryRegistrationWorker.isShutdown()) { +LOG.debug("submitting maybeRegisterFactory"); +factoryRegistrationWorker.submit(() -> { +final boolean preconditionsOk = factoryPreconditions.checkPreconditions(unavailableName, unavailableServicePid); +if ( preconditionsOk && this.factoryRegistration == null ) { +// check system bundle state - if stopping, don't register new factory +final Bundle systemBundle = activator.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION); +if ( systemBundle != null && systemBundle.getState() != Bundle.STOPPING ) { +withThreadName("ResourceResolverFactory registration", this::doRegisterFactory); +} +} else if ( !preconditionsOk && this.factoryRegistration != null ) { +LOG.debug("performing unregisterFactory via maybeRegisterFactory"); +withThreadName("ResourceResolverFactory deregistration", this::doUnregisterFactory); +} +}); +} +} + +void unregisterFactory() { +LOG.debug("submitting unregisterFactory"); +factoryRegistrationWorker.submit(() -> withThreadName("ResourceResolverFactory deregistration", +this::doUnregisterFactory)); +} + +/** + * Regi
[GitHub] [sling-org-apache-sling-resourceresolver] rombert commented on a diff in pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
rombert commented on code in PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#discussion_r1324414773 ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +private final ResourceResolverFactoryActivator activator; + +private final FactoryPreconditions factoryPreconditions; + +private final ExecutorService factoryRegistrationWorker; + +@SuppressWarnings("java:S3077") // The field is only ever set to null or to a new FactoryRegistration instance, which is safe. +private volatile FactoryRegistration factoryRegistration; + +public FactoryRegistrationHandler( +ResourceResolverFactoryActivator activator, FactoryPreconditions factoryPreconditions) { +this.factoryPreconditions = factoryPreconditions; +this.activator = activator; +this.factoryRegistrationWorker = Executors.newSingleThreadExecutor( +r -> new Thread(r, "ResourceResolverFactory registration/deregistration")); +} + +@Override +public void close() { +unregisterFactory(); +factoryRegistrationWorker.shutdown(); +try { +if (!factoryRegistrationWorker.awaitTermination(5, TimeUnit.SECONDS)) { +final List runnables = factoryRegistrationWorker.shutdownNow(); +if (runnables.size() >= 2) { Review Comment: This deserves a comment/method, I can't tell why we check for more than two runnables or why we ignore the first two. ## src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java: ## @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.resourceresolver.impl; + +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.runtime.RuntimeService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class FactoryRegistrationHandler implements AutoCloseable { + +private static final Logger LOG = LoggerFactory.getLogger(FactoryRegistrationHandler.class); + +
[jira] [Assigned] (SLING-12019) Avoid duplicate ResourceResolverFactory registrations
[ https://issues.apache.org/jira/browse/SLING-12019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Munteanu reassigned SLING-12019: --- Assignee: Julian Sedding > Avoid duplicate ResourceResolverFactory registrations > - > > Key: SLING-12019 > URL: https://issues.apache.org/jira/browse/SLING-12019 > Project: Sling > Issue Type: Bug > Components: ResourceResolver >Affects Versions: Resource Resolver 1.10.0 >Reporter: Carsten Ziegeler >Assignee: Julian Sedding >Priority: Critical > Fix For: Resource Resolver 1.11.0 > > > It seems that in some situations a new resource resolver factory is > registered without unregistering the old one - which leads to two factories > being registered. As not all components do eager service binding, these > components stick to the old factory - and the old factory in turn is > basically "empty" meaning all resource providers are unregistered. This > prevents those components from reaching any resource, although everything > looks fine. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #78: Various improvements for the webconsole plugin
sonarcloud[bot] commented on PR #78: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/78#issuecomment-1717472315 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&resolved=false&types=CODE_SMELL) [![2.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0-16px.png '2.1%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&metric=new_coverage&view=list) [2.1% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=78&metric=new_duplicated_lines_density&view=list) ![idea](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png 'idea') Catch issues before they fail your Quality Gate with our IDE extension ![sonarlint](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png 'sonarlint') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #100: SLING-12019 - Avoid duplicate ResourceResolverFactory registrations
sonarcloud[bot] commented on PR #100: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/100#issuecomment-1717471488 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&resolved=false&types=CODE_SMELL) [![80.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '80.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [80.0% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=100&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-starter] rombert merged pull request #230: Exclude the xmlParserAPIs dependency from the classpath
rombert merged PR #230: URL: https://github.com/apache/sling-org-apache-sling-starter/pull/230 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #97: Issues/sling 11742
sonarcloud[bot] commented on PR #97: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/97#issuecomment-1717470972 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=BUG) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=BUG) [2 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=CODE_SMELL) [10 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&resolved=false&types=CODE_SMELL) [![69.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '69.1%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&metric=new_coverage&view=list) [69.1% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=97&metric=new_duplicated_lines_density&view=list) ![idea](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png 'idea') Catch issues before they fail your Quality Gate with our IDE extension ![sonarlint](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png 'sonarlint') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #101: SLING-11715 in the optimized code path avoid resource resolution
sonarcloud[bot] commented on PR #101: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/101#issuecomment-1717470556 SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&resolved=false&types=CODE_SMELL) [![74.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '74.4%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&metric=new_coverage&view=list) [74.4% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=101&metric=new_duplicated_lines_density&view=list) ![idea](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png 'idea') Catch issues before they fail your Quality Gate with our IDE extension ![sonarlint](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png 'sonarlint') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #89: [SLING-11742] Provide alternative equitable terminology for properties
sonarcloud[bot] commented on PR #89: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/89#issuecomment-1717471449 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&resolved=false&types=CODE_SMELL) [![88.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '88.9%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&metric=new_coverage&view=list) [88.9% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=89&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #84: SLING-11352 - Fix parsing of path-only mappings
sonarcloud[bot] commented on PR #84: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/84#issuecomment-1717471352 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&resolved=false&types=CODE_SMELL) [![100.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/100-16px.png '100.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=84&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Resolved] (SLING-12020) resource resolver: alias metric has confusing name
[ https://issues.apache.org/jira/browse/SLING-12020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julian Reschke resolved SLING-12020. Fix Version/s: Resource Resolver 1.10.2 Resolution: Fixed > resource resolver: alias metric has confusing name > -- > > Key: SLING-12020 > URL: https://issues.apache.org/jira/browse/SLING-12020 > Project: Sling > Issue Type: Bug > Components: ResourceResolver >Reporter: Julian Reschke >Assignee: Julian Reschke >Priority: Major > Fix For: Resource Resolver 1.10.2 > > > The metric "numberOfAliases" has a very very misleading name; actually it's > the number of nodes that have any number of child nodes with aliases. So, > this could be a magnitude less than the actual number of aliases. > Rename? Fix? (that would require counting instead of just returning the map > size) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-resourceresolver] reschke merged pull request #103: SLING-12020: resource resolver: correct name of alias metric
reschke merged PR #103: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/103 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[Jenkins] Sling » Modules » sling-org-apache-sling-starter » master #1013 is FIXED
Please see https://ci-builds.apache.org/job/Sling/job/modules/job/sling-org-apache-sling-starter/job/master/1013/ for details. No further emails will be sent until the status of the build is changed.
[GitHub] [sling-org-apache-sling-resourceresolver] reschke commented on a diff in pull request #103: SLING-12020: resource resolver: correct name of alias metric
reschke commented on code in PR #103: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/103#discussion_r1324353323 ## src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverMetrics.java: ## @@ -77,11 +77,11 @@ public class ResourceResolverMetrics { private ServiceRegistration> numberOfVanityPathBloomFalsePositiveGauge; private Supplier numberOfVanityPathBloomFalsePositiveSupplier = ZERO_SUPPLIER; -// number of aliases -private ServiceRegistration> numberOfAliasesGauge; -private Supplier numberOfAliasesSupplier = ZERO_SUPPLIER; +// number of resources with aliased children +private ServiceRegistration> numberOfResourcesWithAliasedChildrenGauge; +private Supplier numberOfResourcesWithAliasedChildrenSupplier = ZERO_SUPPLIER; Review Comment: Maybe. In practive it's only set once in MapEntries's init code (not it's a supplier, not the actual value). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] jsedding commented on a diff in pull request #103: SLING-12020: resource resolver: correct name of alias metric
jsedding commented on code in PR #103: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/103#discussion_r1324348613 ## src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverMetrics.java: ## @@ -77,11 +77,11 @@ public class ResourceResolverMetrics { private ServiceRegistration> numberOfVanityPathBloomFalsePositiveGauge; private Supplier numberOfVanityPathBloomFalsePositiveSupplier = ZERO_SUPPLIER; -// number of aliases -private ServiceRegistration> numberOfAliasesGauge; -private Supplier numberOfAliasesSupplier = ZERO_SUPPLIER; +// number of resources with aliased children +private ServiceRegistration> numberOfResourcesWithAliasedChildrenGauge; +private Supplier numberOfResourcesWithAliasedChildrenSupplier = ZERO_SUPPLIER; Review Comment: Not really this PR, just related: I think all `Supplier` fields need to be volatile. It looks like they can be updated at any moment. Am I missing something? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (SLING-8974) Shows a 200 OK for a delete operation even if the node does not exist.
[ https://issues.apache.org/jira/browse/SLING-8974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764586#comment-17764586 ] Robert Munteanu commented on SLING-8974: Thinking about it some more, I think 400 would be a good compromise - 'bad request' since the client should know that the node does not exist. > Shows a 200 OK for a delete operation even if the node does not exist. > -- > > Key: SLING-8974 > URL: https://issues.apache.org/jira/browse/SLING-8974 > Project: Sling > Issue Type: Bug > Components: Servlets >Reporter: Anisha Narang >Priority: Major > > When you try any curl query for a 'delete' operation, it shows a 200 OK even > even the node does not exist. > curl query: > {code:java} > $ curl -F":operation=delete" http://slinghosturl.com/content/invalid_node > > > Content modified /content/invalid_node > > > Content modified /content/invalid_node > > > > Status > 200 > > > Message > OK > > > Location > id="Location">/invalid_node > > > Parent Location > /content > > > Path > /content/invalid_node > > > Referer > > > > ChangeLog > id="ChangeLog">deleted("/content/invalid_node");> > > > Modified Resource > Parent of Modified Resource > > {code} > So, even though this node does not exist, there is a 200 OK response for the > same which is not expected as per the documentation here -> > [https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#content-removal] > Expected result: > The response should be 404 not found if the not does not exist. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (SLING-11998) SlingPostServlet responds with wrong status code upon Oak Access error
[ https://issues.apache.org/jira/browse/SLING-11998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764583#comment-17764583 ] Robert Munteanu commented on SLING-11998: - [~yumeier] - what kind of access are you trying to perform? I just tried this with the latest SNAPSHOT version and got a 404 {noformat}$ curl --head http://localhost:8080/apps.json HTTP/1.1 404 Not Found Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked {noformat} BTW, you can easily try our latest snapshot version to verify a bug with {noformat}$ docker run --rm -p 8080:8080 apache/sling:snapshot{noformat} > SlingPostServlet responds with wrong status code upon Oak Access error > -- > > Key: SLING-11998 > URL: https://issues.apache.org/jira/browse/SLING-11998 > Project: Sling > Issue Type: Bug > Components: Engine > Environment: Sling 12 >Reporter: Juerg Meier >Priority: Major > > In Sling 12, the SlingPostServlet sends back a HTTP status 422 Invalid > Payload if the underlying OAK persistence layer reports an access error to a > resource. > The correct response code is HTTP 403 Forbidden: > ??The request contained valid data and was understood by the server, but the > server is refusing action. This may be due to the user not having the > necessary permissions for a resource...?? > This is exactly opposite to 422, which indicates that the payload is > erroneous. This misleads subsequent debugging efforts. Additionally, this > error is not logged with launcher/error.log. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[GitHub] [sling-org-apache-sling-resourceresolver] sonarcloud[bot] commented on pull request #103: SLING-12020: resource resolver: correct name of alias metric
sonarcloud[bot] commented on PR #103: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/103#issuecomment-1717364047 Kudos, SonarCloud Quality Gate passed! [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103) [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=BUG) [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=VULNERABILITY) [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=SECURITY_HOTSPOT) [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&resolved=false&types=CODE_SMELL) [![100.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/100-16px.png '100.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&metric=new_coverage&view=list) [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-resourceresolver&pullRequest=103&metric=new_duplicated_lines_density&view=list) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [sling-org-apache-sling-resourceresolver] reschke opened a new pull request, #103: SLING-12020: resource resolver: correct name of alias metric
reschke opened a new pull request, #103: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/103 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Assigned] (SLING-12020) resource resolver: alias metric has confusing name
[ https://issues.apache.org/jira/browse/SLING-12020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julian Reschke reassigned SLING-12020: -- Assignee: Julian Reschke > resource resolver: alias metric has confusing name > -- > > Key: SLING-12020 > URL: https://issues.apache.org/jira/browse/SLING-12020 > Project: Sling > Issue Type: Bug > Components: ResourceResolver >Reporter: Julian Reschke >Assignee: Julian Reschke >Priority: Major > > The metric "numberOfAliases" has a very very misleading name; actually it's > the number of nodes that have any number of child nodes with aliases. So, > this could be a magnitude less than the actual number of aliases. > Rename? Fix? (that would require counting instead of just returning the map > size) -- This message was sent by Atlassian Jira (v8.20.10#820010)